diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index aa4fe3c509e1bf8b5f40415b8c4e49d07f12ac01..5c5e5901c264d3ed2619fc46d4d7ef68fff9c31a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -25,7 +25,7 @@ test_backend 1 15: script: #xvfb is for X11 connection used by some parts of the java code: https://stackoverflow.com/a/47575851/1127920 - apt-get update - - apt-get install -y xvfb + - DEBIAN_FRONTEND=noninteractive apt-get install -y xvfb - Xvfb :99 & - export DISPLAY=:99 @@ -203,9 +203,9 @@ build_war: - minerva.war script: - apt-get update - - apt-get install -y curl gnupg git ant + - DEBIAN_FRONTEND=noninteractive apt-get install -y curl gnupg git ant - curl -sL https://deb.nodesource.com/setup_9.x | bash - - - apt-get install -y nodejs + - DEBIAN_FRONTEND=noninteractive apt-get install -y nodejs - ant maven-build - cp web/target/web-1.0.war minerva.war @@ -214,9 +214,9 @@ java_11_compatibility: stage: test script: - apt-get update - - apt-get install -y curl gnupg git ant + - DEBIAN_FRONTEND=noninteractive apt-get install -y curl gnupg git ant - curl -sL https://deb.nodesource.com/setup_9.x | bash - - - apt-get install -y nodejs + - DEBIAN_FRONTEND=noninteractive apt-get install -y nodejs - mvn clean install -DskipTests=true @@ -225,9 +225,9 @@ dependency_conflict_check: stage: test script: - apt-get update - - apt-get install -y curl gnupg git ant + - DEBIAN_FRONTEND=noninteractive apt-get install -y curl gnupg git ant - curl -sL https://deb.nodesource.com/setup_9.x | bash - - - apt-get install -y nodejs + - DEBIAN_FRONTEND=noninteractive apt-get install -y nodejs - mvn clean install -DskipTests=true - set +e @@ -254,7 +254,7 @@ build_debian_package: - mkdir web/target/ - mv minerva.war web/target/web-1.0.war - apt-get update - - apt-get install -y dh-make build-essential lintian devscripts xsltproc fakeroot xsltproc docbook-xsl + - DEBIAN_FRONTEND=noninteractive apt-get install -y dh-make build-essential lintian devscripts xsltproc fakeroot xsltproc docbook-xsl - export DEBFULLNAME="Piotr Gawron" - export DEBEMAIL="piotr.gawron@uni.lu" - debian/create-debian-pkg.sh @@ -274,19 +274,26 @@ test_upgrade_debian_package: - build_debian_package script: - apt-get update - - apt-get install -y ssh software-properties-common dirmngr wget curl apt-transport-https + - DEBIAN_FRONTEND=noninteractive apt-get install -y ssh software-properties-common dirmngr wget curl apt-transport-https postgresql + - service postgresql start - debian_file=$(ls debian/*.deb) - version=$(echo $debian_file| cut -f2 -d"_") - echo "PUT $debian_file /docker/incoming" | sftp -o StrictHostKeyChecking=no user@debian-repo - ssh root@debian-repo /usr/local/sbin/reprepro-import - apt-add-repository "deb http://repo-r3lab.uni.lu/debian/ stable main" - apt-key adv --no-tty --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0xcb185f4e31872412 + - echo debconf minerva/internal/skip-preseed boolean true | debconf-set-selections + - echo debconf minerva/dbconfig-install select true | debconf-set-selections + - echo debconf minerva/pgsql/app-pass select secret_password | debconf-set-selections + - echo debconf minerva/remote/host select localhost | debconf-set-selections + - echo debconf minerva/db/dbname select minerva_db | debconf-set-selections + - echo debconf minerva/db/app-user select minerva_user@localhost | debconf-set-selections - apt-get update #hacky way of installing minerva on docker - by default rc-invoke is preventing services changes on docker - mv /usr/sbin/policy-rc.d /usr/sbin/policy-rc.d.backup - mv gitlab-ci-policy-rc.d /usr/sbin/policy-rc.d - chmod 0755 /usr/sbin/policy-rc.d - - apt-get install -y --allow-unauthenticated minerva + - DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated minerva #local repository with new version - apt-add-repository "deb http://debian-repo/ unstable main" @@ -318,17 +325,24 @@ test_install_debian_package: - build_debian_package script: - apt-get update - - apt-get install -y ssh software-properties-common dirmngr wget curl + - DEBIAN_FRONTEND=noninteractive apt-get install -y ssh software-properties-common dirmngr wget curl postgresql + - service postgresql start - debian_file=$(ls debian/*.deb) - echo "PUT $debian_file /docker/incoming" | sftp -o StrictHostKeyChecking=no user@debian-repo - ssh root@debian-repo /usr/local/sbin/reprepro-import - apt-add-repository "deb http://debian-repo/ unstable main" + - echo debconf minerva/internal/skip-preseed boolean true | debconf-set-selections + - echo debconf minerva/dbconfig-install select true | debconf-set-selections + - echo debconf minerva/pgsql/app-pass select secret_password | debconf-set-selections + - echo debconf minerva/remote/host select localhost | debconf-set-selections + - echo debconf minerva/db/dbname select minerva_db | debconf-set-selections + - echo debconf minerva/db/app-user select minerva_user@localhost | debconf-set-selections - apt-get update #hacky way of installing minerva on docker - by default rc-invoke is preventing services changes on docker - mv /usr/sbin/policy-rc.d /usr/sbin/policy-rc.d.backup - mv gitlab-ci-policy-rc.d /usr/sbin/policy-rc.d - chmod 0755 /usr/sbin/policy-rc.d - - apt-get install -y --allow-unauthenticated minerva + - DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated minerva - mv /usr/sbin/policy-rc.d.backup /usr/sbin/policy-rc.d - service tomcat8 start #we need to wait a bit for tomcat start @@ -380,7 +394,7 @@ test_deploy_with_db_without_superadmin_rights: - tags script: - apt-get update - - apt-get install -y postgresql-client + - DEBIAN_FRONTEND=noninteractive apt-get install -y postgresql-client - mkdir /etc/minerva - echo "database.uri=jdbc:postgresql://postgres:5432/test" > /etc/minerva/db.properties - echo "database.username=test" >> /etc/minerva/db.properties diff --git a/CHANGELOG b/CHANGELOG index a70f238e18f6cb41f09fdcfaf90c85926d4303a3..710eb2f066ffa2eff4ad0d5b2426aaa7fa715282 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,7 +1,11 @@ minerva (14.0.0~alpha.0) unstable; urgency=low * Feature: log4j is replaced with log4j2 logging mechanism (#291) + * Feature: database installed via debian package is done via dbconfig-commons + (#469) * Feature removal: BioCompendium annotator removed (#32) + -- Piotr Gawron <piotr.gawron@uni.lu> Thu, 16 May 2019 15:00:00 +0200 + minerva (13.1.0~alpha.0) unstable; urgency=low * Feature: annotators are more flexible - you can define set of input and outputs used by annotator (#617) diff --git a/debian/create-debian-pkg.sh b/debian/create-debian-pkg.sh index 6eef85de2294e01a8bf6b202ae9e1c94ab17395f..b77a52a7b65aba19f34ce48a6da65511b0c1a442 100755 --- a/debian/create-debian-pkg.sh +++ b/debian/create-debian-pkg.sh @@ -45,6 +45,8 @@ gzip -n $SRC_DIR/minerva.txt #copy configuration of logrotate cp debian/logrotate/* $SRC_DIR/ +touch $SRC_DIR/pgsql + cp debian/scripts/common.sh $SRC_DIR/ #copy changelog file @@ -60,13 +62,6 @@ current_version=`cat CHANGELOG |grep minerva |head -1 | cut -f2 -d'(' | cut -f1 echo "Current version: " $current_version echo "Flyway was introduced in version: " $MAX_DB_VERSION_FOR_MIGRTION -#default connection params (if /etc/minerva/db.properties is not defined) -DB_HOST=`cat persist/src/main/resources/db.properties |grep "uri" |cut -f3 -d"/" |cut -f1 -d":"` -DB_PORT=`cat persist/src/main/resources/db.properties |grep "uri" |cut -f3 -d"/" |cut -f2 -d":"` -DB_DATABASE_NAME=`cat persist/src/main/resources/db.properties |grep "uri" |cut -f4 -d"/"` -DB_USERNAME=`cat persist/src/main/resources/db.properties |grep "username" |cut -f2 -d"="` -DB_PASSWORD=`cat persist/src/main/resources/db.properties |grep "password" |cut -f2 -d"="` - #------------------------------------------ # Now we have all db schema diff files. Let's start preparing # debian package @@ -101,13 +96,9 @@ sed -i "s/__LOG_FILE__/$LOG_FILE/g" common.sh #in the filesystem where package is installed sed -i "s/__DB_SCRIPT_DIR__/$DB_SCRIPT_DIR/g" common.sh -sed -i "s/__DB_HOST__/$DB_HOST/g" common.sh -sed -i "s/__DB_PORT__/$DB_PORT/g" common.sh -sed -i "s/__DB_DATABASE_NAME__/$DB_DATABASE_NAME/g" common.sh -sed -i "s/__DB_USERNAME__/$DB_USERNAME/g" common.sh -sed -i "s/__DB_PASSWORD__/$DB_PASSWORD/g" common.sh sed -i "s/__MAX_DB_VERSION_FOR_MIGRTION__/$MAX_DB_VERSION_FOR_MIGRTION/g" common.sh +sed -i -e "1r common.sh" debian/config sed -i -e "1r common.sh" debian/postinst sed -i -e "1r common.sh" debian/postrm sed -i -e "1r common.sh" debian/preinst diff --git a/debian/scripts/common.sh b/debian/scripts/common.sh index 256219e140dd72bde0a10ad2e35e19789c1bd722..ccaa42f66f256bc7118854f1e8b5bd371c2007d5 100644 --- a/debian/scripts/common.sh +++ b/debian/scripts/common.sh @@ -31,74 +31,3 @@ fi POSTGRES_OK=$(dpkg-query -W --showformat='${Status}\n' postgresql|grep "install ok installed") -DB_HOST="__DB_HOST__" -DB_PORT="__DB_PORT__" -DB_DATABASE_NAME="__DB_DATABASE_NAME__" -DB_USERNAME="__DB_USERNAME__" -DB_PASSWORD="__DB_PASSWORD__" - - -if [ -f /etc/minerva/db.properties ]; then - DB_PROPERTIES_FILE="/etc/minerva/db.properties" - log "$DB_PROPERTIES_FILE file found" - DB_HOST=`cat $DB_PROPERTIES_FILE |grep "uri" |cut -f3 -d"/" |cut -f1 -d":"` - DB_PORT=`cat $DB_PROPERTIES_FILE |grep "uri" |cut -f3 -d"/" |cut -f2 -d":"` - DB_DATABASE_NAME=`cat $DB_PROPERTIES_FILE |grep "uri" |cut -f4 -d"/"` - DB_USERNAME=`cat $DB_PROPERTIES_FILE |grep "username" |cut -f2 -d"="` - DB_PASSWORD=`cat $DB_PROPERTIES_FILE |grep "password" |cut -f2 -d"="` -fi - - -#if we connect to something that is not in localhost then we need to provide login and password -#because we won't have access to it as postgres user -if [ "$DB_HOST" != "localhost" ] && [ "$DB_HOST" != "127.0.0.1" ] -then - log "DB is located on the remote server: $DB_HOST" - IS_REMOTE_DB=true -else - log "DB is at localhost: $DB_HOST" - IS_REMOTE_DB=false -fi - -exec_sql(){ - log "Execute SQL : '$1'" - echo "$1" |PGPASSWORD=$DB_PASSWORD psql -h $DB_HOST -p $DB_PORT -U $DB_USERNAME $DB_DATABASE_NAME >>$LOG_FILE 2>>$LOG_FILE -} -exec_sql_file(){ - log "Execute SQL file: $1" - PGPASSWORD=$DB_PASSWORD psql -h $DB_HOST -p $DB_PORT -U $DB_USERNAME $DB_DATABASE_NAME -f $1 >>$LOG_FILE 2>>$LOG_FILE -} -create_db(){ - log "Create db: (remote=$IS_REMOTE_DB)" - if [ $IS_REMOTE_DB = false ] - then - su - postgres -c "createuser -d -r -s -p $DB_PORT $DB_USERNAME" >>$LOG_FILE 2>>$LOG_FILE - log "User created" - su - postgres -c "echo \"ALTER USER $DB_USERNAME WITH PASSWORD '$DB_PASSWORD';\"| psql -p $DB_PORT " >>$LOG_FILE 2>>$LOG_FILE - log "User credentials updated" - su - postgres -c "createdb -p $DB_PORT -O $DB_USERNAME $DB_DATABASE_NAME" >>$LOG_FILE 2>>$LOG_FILE - log "Db created" - - hba_conf=`su - postgres -c "psql -t -P format=unaligned -c 'show hba_file';"`; - cp $hba_conf $hba_conf".bac" - cat $hba_conf".bac" |grep -v "all[ \t]*peer" >$hba_conf - printf "local all all md5\n" >>$hba_conf - invoke-rc.d postgresql restart - else - log "HOST is remote, assuming db and user are already there" - fi -} -stop_postgres() { - log "Stop postgres: (remote=$IS_REMOTE_DB)" - if [ $IS_REMOTE_DB = false ] - then - invoke-rc.d postgresql stop || true - fi -} -start_postgres() { - log "Start postgres: (remote=$IS_REMOTE_DB)" - if [ $IS_REMOTE_DB = false ] - then - invoke-rc.d postgresql restart - fi -} diff --git a/debian/template/README.Debian b/debian/template/README.Debian index 67a6f0771559f79469e4750e4778e9a723051a46..1dd3a4cde49a0c3520af80e60051a5f9ad2d1c8e 100644 --- a/debian/template/README.Debian +++ b/debian/template/README.Debian @@ -1,5 +1,14 @@ minerva for Debian ------------------ -minerva is a package used to visualize Disease Maps. Disease Map is a scientific representation of disease model. +minerva is a package used to visualize Disease Maps. Disease Map is a scientific representation of disease model. More information about the project can be found here: https://minerva.pages.uni.lu/doc/ + +DB configuration: +------------------ +Database configuration for the package usually is done using dbconfig-common. If sysadmin decides to not use it the database configuration must be manually placed in a file: /etc/minerva/db.properties. Example config file can be found here: https://git-r3lab.uni.lu/minerva/core/blob/master/persist/src/main/resources/db.properties + +Log configuration: +------------------ +Project uses log4j2 for logging. By default minerva logs should be located in directory: $CATALINA_HOME/logs/minerva.txt. Default configuration can be overriden by providing custom properties file. This would allow to enable/disable some log entries or change way of logging. Custom configuration should be placed here: /etc/minerva/log4j2.properties. Default configuration used by minerva can be found here: https://git-r3lab.uni.lu/minerva/core/raw/master/web/src/main/webapp/WEB-INF/resources/log4j2.properties. More information how to configure log4j2 logger can be found here: https://logging.apache.org/log4j/2.x/manual/configuration.html#Properties. + -- Piotr Gawron <piotr.gawron@uni.lu> Mon, 28 Sep 2015 10:30:53 -0400 diff --git a/debian/template/config b/debian/template/config new file mode 100644 index 0000000000000000000000000000000000000000..d2a4aed6c2eae311dbb5242269d448b4b782c67d --- /dev/null +++ b/debian/template/config @@ -0,0 +1,45 @@ +#!/bin/sh + +log "Running config" $1 $2; + +set -e + +. /usr/share/debconf/confmodule + +db_version 2.0 + +if [ ! -d "/etc/minerva/" ] +then + mkdir /etc/minerva/ +fi + + +if [ -f /usr/share/dbconfig-common/dpkg/config.pgsql ]; then + . /usr/share/dbconfig-common/dpkg/config.pgsql + DB_HOST="localhost" + DB_PORT="5432" + DB_DATABASE_NAME="map_viewer" + DB_USERNAME="map_viewer" + DB_PASSWORD="123qweasdzxc" + + if [ -f /etc/minerva/db.properties ]; then + DB_PROPERTIES_FILE="/etc/minerva/db.properties" + DB_HOST=`cat $DB_PROPERTIES_FILE |grep "uri" |cut -f3 -d"/" |cut -f1 -d":"` + DB_PORT=`cat $DB_PROPERTIES_FILE |grep "uri" |cut -f3 -d"/" |cut -f2 -d":"` + DB_DATABASE_NAME=`cat $DB_PROPERTIES_FILE |grep "uri" |cut -f4 -d"/"` + DB_USERNAME=`cat $DB_PROPERTIES_FILE |grep "username" |cut -f2 -d"="` + DB_PASSWORD=`cat $DB_PROPERTIES_FILE |grep "password" |cut -f2 -d"="` + db_set minerva/dbconfig-install true + db_fset minerva/dbconfig-install seen true + fi + echo "dbserver=$DB_HOST" > /etc/minerva/old.sh + echo "dbport=$DB_PORT" >> /etc/minerva/old.sh + echo "dbname=$DB_DATABASE_NAME" >> /etc/minerva/old.sh + echo "dbuser=$DB_USERNAME" >> /etc/minerva/old.sh + echo "dbpass=$DB_PASSWORD" >> /etc/minerva/old.sh + + dbc_first_version="14.0.0~alpha.0" + dbc_load_include="sh:/etc/minerva/old.sh" + + dbc_go minerva $@ +fi diff --git a/debian/template/control b/debian/template/control index 99f34103128fad5117c47961968f88ff727aabf2..027e158e5384687ab3a3cca8c83a34b10b558946 100644 --- a/debian/template/control +++ b/debian/template/control @@ -10,7 +10,9 @@ Description: Standalone web application for visualization, exploration and management of molecular networks encoded in SBGN-compliant format. After installation, the resource is used and managed via a webbrowser, under the default address 'http://localhost:8080/minerva/'. You can configure your - Tomcat server later to change the address. + Tomcat server later to change the address. Full documentation can be found + here: https://minerva.pages.uni.lu/doc/ Section: science Homepage: http://r3lab.uni.lu/web/minerva-website/ -Depends: ${misc:Depends}, openjdk-8-jre-headless, tomcat7 | tomcat8, postgresql (>=9.3) +Recommends: postgresql (>=9.3) +Depends: ${misc:Depends}, dbconfig-pgsql | dbconfig-no-thanks, tomcat7 | tomcat8 diff --git a/debian/template/copyright b/debian/template/copyright index ff553ffdbb6b8874c98af59fe3a70372814fe1af..bc0ca95c1353512da459fa2e86fcee44f785d68e 100644 --- a/debian/template/copyright +++ b/debian/template/copyright @@ -1,6 +1,6 @@ Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: minerva -Source: http://minerva.uni.lu/ +Source: https://minerva.pages.uni.lu/doc/ Files: minerva.txt.gz Copyright: 2015 Piotr Gawron <piotr.gawron@uni.lu> diff --git a/debian/template/install b/debian/template/install index 7e81d5fb433700abf97710e8570f13708aa0b5ef..fedd4bdb8f1f867ec46b1fc1a97a39069dfa2525 100644 --- a/debian/template/install +++ b/debian/template/install @@ -1 +1,2 @@ minerva.war /usr/share/minerva/ +pgsql /usr/share/dbconfig-common/data/minerva/install/ diff --git a/debian/template/postinst b/debian/template/postinst index 8420297695ab4ba49349a7fb0ca16288ff5bfa5d..016862312efc8431812e4f24218d2e73a1d699de 100644 --- a/debian/template/postinst +++ b/debian/template/postinst @@ -16,29 +16,68 @@ log "Running postinst" $1 $2; invoke-rc.d $TOMCAT_PACKAGE status >> $LOG_FILE +mkdir /etc/minerva 2>/dev/null + +. /usr/share/debconf/confmodule + +db_version 2.0 + # we execute it here because if some packages are missing then dpkg will return non-zero exit code set -e case "$1" in configure) - start_postgres - - #if we install - if [ "$OLD_VERSION" = "" ] - then - create_db + + #if we update the package from version before flyway was introduced + if [ -f $DB_SCRIPT_DIR/db_${OLD_VERSION}_to_${MAX_DB_VERSION_FOR_MIGRTION}.sql ]; then + mkdir -p /usr/share/dbconfig-common/data/minerva/upgrade/pgsql/ + cp $DB_SCRIPT_DIR/db_${OLD_VERSION}_to_${MAX_DB_VERSION_FOR_MIGRTION}.sql /usr/share/dbconfig-common/data/minerva/upgrade/pgsql/$CURRENT_VERSION else - #if we update the package - if [ -f $DB_SCRIPT_DIR/db_${OLD_VERSION}_to_${MAX_DB_VERSION_FOR_MIGRTION}.sql ]; then - exec_sql_file "$DB_SCRIPT_DIR/db_${OLD_VERSION}_to_${MAX_DB_VERSION_FOR_MIGRTION}.sql" - else - log "INFO: File doesn't exist: $DB_SCRIPT_DIR/db_${OLD_VERSION}_to_${MAX_DB_VERSION_FOR_MIGRTION}.sql" - fi + log "INFO: File doesn't exist: $DB_SCRIPT_DIR/db_${OLD_VERSION}_to_${MAX_DB_VERSION_FOR_MIGRTION}.sql" fi -#we have to restart tomcat, because application was started on the old database and it might crash during deplyment -#for instance in the new war file there was init script that uses some new database features, but they are not -#availble when new war is deployed from debian package, so tomcat will catch SQL exception and stop deployment + . /usr/share/dbconfig-common/dpkg/postinst.pgsql + dbc_generate_include_owner="root:root" + dbc_generate_include_perms="0640" + dbc_generate_include=sh:/etc/minerva/db.sh + + #version when dbcommons-config was introduced + dbc_first_version="14.0.0~alpha.0" + dbc_load_include="sh:/etc/minerva/old.sh" + + # Need to start postgresql, so it doesn't fail on the installer + invoke-rc.d postgresql restart || true + dbc_go minerva $@ + + # if there is a config file generated by db_config_common (on upgrade this file might not be generated) + if [ -f /etc/minerva/db.sh ] + then + . /etc/minerva/db.sh + + # when configuration was cancelled don't create config file + if [ ! -z "$dbuser" ] + then + if [ -z "$dbport" ] + then + dbport=5432 + fi + + #create db configuration file + cat /etc/minerva/db.sh | grep '#' > /etc/minerva/db.properties + echo "" >> /etc/minerva/db.properties + echo "database.uri=jdbc:postgresql://$dbserver:$dbport/$dbname" >> /etc/minerva/db.properties + echo "database.username=$dbuser" >> /etc/minerva/db.properties + echo "database.password=$dbpass" >> /etc/minerva/db.properties + + fi + rm /etc/minerva/db.sh + fi + rm /etc/minerva/old.sh + + #we have to restart tomcat, because application was started on the old database and it might crash during deployment + #for instance in the new war file there was init script that uses some new database features, but they are not + #available when new war is deployed from debian package, so tomcat will catch SQL exception and stop deployment + invoke-rc.d $TOMCAT_PACKAGE stop || true rm -rf /var/lib/$TOMCAT_PACKAGE/webapps/minerva ln -sf /usr/share/minerva/minerva.war /var/lib/$TOMCAT_PACKAGE/webapps/minerva.war diff --git a/debian/template/postrm b/debian/template/postrm index 6c517b351c62b103aaf36e2479c2f6cec49f9db0..aa589403c063c52fbe5ab90e8ed25635b45ec4fe 100644 --- a/debian/template/postrm +++ b/debian/template/postrm @@ -13,6 +13,13 @@ log "Running postrm" $1 $2; # we execute it here because if some packages are missing then dpkg will return non-zero exit code set -e +if [ -f /usr/share/dbconfig-common/dpkg/postrm.pgsql ]; then + . /usr/share/debconf/confmodule + . /usr/share/dbconfig-common/dpkg/postrm.pgsql + dbc_go minerva $@ +fi + + case "$1" in upgrade) rm -rf /var/lib/$TOMCAT_PACKAGE/webapps/minerva @@ -22,35 +29,9 @@ case "$1" in rm -rf /var/lib/$TOMCAT_PACKAGE/webapps/minerva rm -rf /var/lib/$TOMCAT_PACKAGE/webapps/minerva.war invoke-rc.d $TOMCAT_PACKAGE start || true - if [ $IS_REMOTE_DB = true ] - then - exec_sql "drop owned by $DB_USERNAME;" - else - if [ "" = "$POSTGRES_OK" ] - then - log "No postgresql package found."; - else - start_postgres - su - postgres -c "dropdb -p $DB_PORT $DB_DATABASE_NAME" - su - postgres -c "dropuser -p $DB_PORT $DB_USERNAME" - fi - fi ;; abort-install) invoke-rc.d $TOMCAT_PACKAGE start || true - if [ $IS_REMOTE_DB = true ] - then - exec_sql "drop owned by $DB_USER" - else - if [ "" = "$POSTGRES_OK" ]; - then - log "No postgresql package found."; - else - start_postgres - su - postgres -c "dropdb -p $DB_PORT $DB_DATABASE_NAME" - su - postgres -c "dropuser -p $DB_PORT $DB_USERNAME" - fi - fi ;; *) echo "postrm called with unknown argument \`$1'" >&2 diff --git a/debian/template/preinst b/debian/template/preinst index 728bfe76108920582eddcff255a32e0908f69b13..3ee9547bfccda5e81b1831deb613e6ba4ca3b7bf 100644 --- a/debian/template/preinst +++ b/debian/template/preinst @@ -17,11 +17,9 @@ set -e case "$1" in install|upgrade) invoke-rc.d $TOMCAT_PACKAGE stop || true - stop_postgres ;; abort-upgrade) invoke-rc.d $TOMCAT_PACKAGE stop || true - stop_postgres ;; *) echo "preinst called with unknown argument \`$1'" >&2 diff --git a/debian/template/prerm b/debian/template/prerm index b131100dbb7790d8628054bd04fae91e19575a03..6750a42459a5f9b5f147b95afc58946e57117089 100644 --- a/debian/template/prerm +++ b/debian/template/prerm @@ -11,26 +11,20 @@ set -e log "Running preinst" $1 $2; - # we execute it here because if some packages are missing then dpkg will return non-zero exit code set -e log Running prerm $1 $2; -invoke-rc.d postgresql start || true -TIMESTAMP=$(date +"%F_%H%M%S") -DUMP_FILE=$DB_SCRIPT_DIR/dump_$TIMESTAMP -log "dump $DB_DATABASE_NAME database to file $DUMP_FILE" -PGPASSWORD=$DB_PASSWORD pg_dump -h $DB_HOST -p $DB_PORT -U $DB_USERNAME $DB_DATABASE_NAME | gzip > "$DUMP_FILE".gz +. /usr/share/debconf/confmodule +. /usr/share/dbconfig-common/dpkg/prerm.pgsql +dbc_go minerva $@ case "$1" in - upgrade) invoke-rc.d $TOMCAT_PACKAGE stop || true - stop_postgres ;; remove) invoke-rc.d $TOMCAT_PACKAGE stop || true - stop_postgres ;; *) echo "prerm called with unknown argument \`$1'" >&2 diff --git a/frontend-js/package-lock.json b/frontend-js/package-lock.json index 17af1d3c74801220445bc910e69128516887d881..2e2d590dfa9b450c8e1d089ea26bac37ab4fc1ea 100644 --- a/frontend-js/package-lock.json +++ b/frontend-js/package-lock.json @@ -87,6 +87,7 @@ "version": "0.1.4", "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", + "optional": true, "requires": { "kind-of": "^3.0.2", "longest": "^1.0.1", @@ -3309,7 +3310,8 @@ "longest": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", - "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=" + "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=", + "optional": true }, "loose-envify": { "version": "1.3.1", diff --git a/gitlab-ci-policy-rc.d b/gitlab-ci-policy-rc.d index 319de32fd8336e398fe58d8eed8c3e88857cd698..0cf6dac1a4597b26416ad4e9097e1ad1ccbf93fc 100644 --- a/gitlab-ci-policy-rc.d +++ b/gitlab-ci-policy-rc.d @@ -6,7 +6,7 @@ echo "policy-rc.d for " $1 -if [ "$1" = "tomcat7" ] || [ "$1" = "tomcat8" ]; +if [ "$1" = "tomcat7" ] || [ "$1" = "tomcat8" ] || [ "$1" = "postgresql" ]; then exit 101 fi