diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7c67e4bdae47fc72f046d5bcba016ed21603d67f..3d36836b046324e34acd0a78737564f30fc5d1ed 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,14 +12,12 @@ before_script: - apt-get update - apt-get install postgresql-contrib -y - /etc/init.d/postgresql start - #- adduser tester --disabled-password --gecos "" #create system user to test - su postgres -c "createuser -drS root" #create posgresql user with permission to create databases and roles run_tests: stage: test script: - mv test/config.js.example test/config.js - gulp test - #- su tester -c gulp test tags: - node - postgres diff --git a/database/pg_hba.conf b/database/pg_hba.conf deleted file mode 100644 index 4a544e6b12e45b8418a44cfa5919bf2a2aa841ea..0000000000000000000000000000000000000000 --- a/database/pg_hba.conf +++ /dev/null @@ -1,100 +0,0 @@ -# PostgreSQL Client Authentication Configuration File -# =================================================== -# -# Refer to the "Client Authentication" section in the PostgreSQL -# documentation for a complete description of this file. A short -# synopsis follows. -# -# This file controls: which hosts are allowed to connect, how clients -# are authenticated, which PostgreSQL user names they can use, which -# databases they can access. Records take one of these forms: -# -# local DATABASE USER METHOD [OPTIONS] -# host DATABASE USER ADDRESS METHOD [OPTIONS] -# hostssl DATABASE USER ADDRESS METHOD [OPTIONS] -# hostnossl DATABASE USER ADDRESS METHOD [OPTIONS] -# -# (The uppercase items must be replaced by actual values.) -# -# The first field is the connection type: "local" is a Unix-domain -# socket, "host" is either a plain or SSL-encrypted TCP/IP socket, -# "hostssl" is an SSL-encrypted TCP/IP socket, and "hostnossl" is a -# plain TCP/IP socket. -# -# DATABASE can be "all", "sameuser", "samerole", "replication", a -# database name, or a comma-separated list thereof. The "all" -# keyword does not match "replication". Access to replication -# must be enabled in a separate record (see example below). -# -# USER can be "all", a user name, a group name prefixed with "+", or a -# comma-separated list thereof. In both the DATABASE and USER fields -# you can also write a file name prefixed with "@" to include names -# from a separate file. -# -# ADDRESS specifies the set of hosts the record matches. It can be a -# host name, or it is made up of an IP address and a CIDR mask that is -# an integer (between 0 and 32 (IPv4) or 128 (IPv6) inclusive) that -# specifies the number of significant bits in the mask. A host name -# that starts with a dot (.) matches a suffix of the actual host name. -# Alternatively, you can write an IP address and netmask in separate -# columns to specify the set of hosts. Instead of a CIDR-address, you -# can write "samehost" to match any of the server's own IP addresses, -# or "samenet" to match any address in any subnet that the server is -# directly connected to. -# -# METHOD can be "trust", "reject", "md5", "password", "gss", "sspi", -# "ident", "peer", "pam", "ldap", "radius" or "cert". Note that -# "password" sends passwords in clear text; "md5" is preferred since -# it sends encrypted passwords. -# -# OPTIONS are a set of options for the authentication in the format -# NAME=VALUE. The available options depend on the different -# authentication methods -- refer to the "Client Authentication" -# section in the documentation for a list of which options are -# available for which authentication methods. -# -# Database and user names containing spaces, commas, quotes and other -# special characters must be quoted. Quoting one of the keywords -# "all", "sameuser", "samerole" or "replication" makes the name lose -# its special character, and just match a database or username with -# that name. -# -# This file is read on server startup and when the postmaster receives -# a SIGHUP signal. If you edit the file on a running system, you have -# to SIGHUP the postmaster for the changes to take effect. You can -# use "pg_ctl reload" to do that. - -# Put your actual configuration here -# ---------------------------------- -# -# If you want to allow non-local connections, you need to add more -# "host" records. In that case you will also need to make PostgreSQL -# listen on a non-local interface via the listen_addresses -# configuration parameter, or via the -i or -h command line switches. - - - - -# DO NOT DISABLE! -# If you change this first entry you will need to make sure that the -# database superuser can access the database using some other method. -# Noninteractive access to all databases is required during automatic -# maintenance (custom daily cronjobs, replication, and similar tasks). -# -# Database administrative login by Unix domain socket -local all postgres peer - -local all user md5 -# TYPE DATABASE USER ADDRESS METHOD - -# "local" is for Unix domain socket connections only -local all all peer -# IPv4 local connections: -host all all 127.0.0.1/32 md5 -# IPv6 local connections: -host all all ::1/128 md5 -# Allow replication connections from localhost, by a user with the -# replication privilege. -#local replication postgres peer -#host replication postgres 127.0.0.1/32 md5 -#host replication postgres ::1/128 md5 diff --git a/gulpfile.js b/gulpfile.js index b385c65f4a9501eb0f6a55ce04cb9be4e0f9ced4..1228d962701ed7f93445fd6dd665627f42410ac9 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -13,6 +13,7 @@ var dev_config_file = './config.js'; var test_config_file = './test/config.js'; //var config = require(configFile); + // define the default task and add the watch task to it gulp.task('default', ['run','watch']); @@ -38,9 +39,9 @@ gulp.task('create_database_test', function(){ var config = require(test_config_file); - return gulp.src("database") - .pipe(shell("./database/create.sh " + config.db_config.database)) - .pipe(shell("./database/create_user.sh " + config.db_config.user + " " + config.db_config.password + " " + config.db_config.database )); + return gulp.src("scripts_database") + .pipe(shell("./scripts_database/create_database.sh " + config.db_config.database)) + .pipe(shell("./scripts_database/create_user.sh " + config.db_config.user + " " + config.db_config.password + " " + config.db_config.database )); }); gulp.task('test',['create_database_test'], function(){ return gulp.src(['test/*.js']) @@ -50,7 +51,6 @@ gulp.task('test',['create_database_test'], function(){ }); -// gulp.task('test', ['create_database','mocha']) module.exports = gulp; diff --git a/database/create/schema/bd.sql b/scripts_database/create/schema/bd.sql similarity index 100% rename from database/create/schema/bd.sql rename to scripts_database/create/schema/bd.sql diff --git a/database/create.sh b/scripts_database/create_database.sh similarity index 71% rename from database/create.sh rename to scripts_database/create_database.sh index ad7b98fd9db774adaa956c2d5847e142b2a7fd62..4f48ea1936d6d698b4c1580a141028a89c13fda5 100755 --- a/database/create.sh +++ b/scripts_database/create_database.sh @@ -20,7 +20,6 @@ # USA. -#TODO:PASS THE USER AS ARGV #DB_LINK_LOCATION=/usr/share/postgresql/9.1/extension/dblink.sql #DATABASE_DIR=$(pwd) @@ -47,7 +46,6 @@ fi function error_exit() { dropdb $DB_NAME - # dropuser $DB_NAME exit 1 } @@ -59,7 +57,6 @@ if psql -lqt | cut -d \| -f 1 | grep -qw "$DB_NAME"; then y | Y | yes | YES ) echo "Dropping database $DB_NAME" dropdb $DB_NAME - # dropuser $DB_NAME ;; * ) echo "Exiting script." @@ -68,18 +65,10 @@ if psql -lqt | cut -d \| -f 1 | grep -qw "$DB_NAME"; then esac fi -# create user -#echo "INFO: Creating user: $DB_NAME"; -#createuser -DRS $DB_NAME || error_exit - # create db echo "INFO: Creating database: $DB_NAME"; createdb $DB_NAME -# importing extensions -#psql $DB_NAME -c 'CREATE EXTENSION IF NOT EXISTS dblink;' -#psql $DB_NAME -c 'CREATE EXTENSION IF NOT EXISTS pgcrypto;' -#psql $DB_NAME -c 'CREATE EXTENSION IF NOT EXISTS postgi s;' # creating database tables and structure echo "INFO: Creating database tables and structure"; @@ -87,19 +76,3 @@ for file in $(ls -B "${SCHEMA_DIR}"); do echo "--- Executing: $file"; psql -d $DB_NAME -f $SCHEMA_DIR$file || error_exit done - -# restore database data -# echo "INFO: Restoring database data"; -# for file in $(ls -B "${DATA_DIR}"); do -# echo "--- Executing: $file"; -# psql $DB_NAME -f $file -v DATABASE_DIR="$DATABASE_DIR" || error_exit -# done - -# Create functions and views that are needed for the rest of the process -#psql $DB_NAME -f functions/db_versioning.sql || error_exit - -# upgrade schmema and create functions -#./upgrade.sh -d $DB_NAME - -# installing crontab -#./cron.sh $DB_NAME diff --git a/database/create_user.sh b/scripts_database/create_user.sh similarity index 100% rename from database/create_user.sh rename to scripts_database/create_user.sh