diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c6ebe5485bc1a0c53bdaac15bf34bd725db4048f..868182678fd86ffea1f3713f6b0b0ec31833e6b7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,3 +1,9 @@ +# +# CI for Aegir Hosting System +# +# For docs see http://docs.aegirproject.org +# and http://docs.aegirproject.org/en/3.x/community/release-process/#setting-up-a-gitlab-runner + # Is performed before the scripts in the stages step before_script: - source /etc/profile @@ -9,7 +15,11 @@ stages: - publish - upgradetest -# Stage "build" + +# +### Stage "build" +# + build:deb: stage: build image: aegir/hostmaster:packaging_base @@ -31,7 +41,10 @@ build:deb: - build/* -# Stage "test" +# +### Stage "test" +# + test:debian-jessie-aegir3-apt: stage: test image: debian:jessie @@ -131,7 +144,9 @@ test:behat: - sudo docker-compose -f docker-compose-provision.yml run hostmaster - +# +### Stage "publish" +# publish:unstable-repo: stage: publish @@ -165,6 +180,10 @@ publish:unstable-repo: # reprepro should pick this up in seconds and update the repository index. +# +### Stage "upgradetest" +# + # Upgrade the latest stable Aegir to our unstable repo. upgradetest:debian-jessie-aegir3-apt-upgrade: stage: upgradetest diff --git a/debian/aegir3-hostmaster.postinst b/debian/aegir3-hostmaster.postinst index ed831def607eca2a5db86c87f8705dcc33ea90f9..dc64d1d8f6079755c843a070f396e07ab9238e01 100644 --- a/debian/aegir3-hostmaster.postinst +++ b/debian/aegir3-hostmaster.postinst @@ -43,7 +43,10 @@ case "$1" in fi db_get "aegir/profile" if [ ! -z "$RET" ]; then - FLAGS="$FLAGS --profile='$RET'" + PROFILE=$RET + FLAGS="$FLAGS --profile='$PROFILE'" + else + PROFILE='hostmaster' fi db_get "aegir/webserver" if [ ! -z "$RET" ]; then @@ -111,28 +114,57 @@ case "$1" in fi db_get "aegir/db_host" AEGIR_DB_HOST="$RET" - db_get "aegir/db_user" - AEGIR_DB_USER="$RET" - db_get "aegir/db_password" - AEGIR_DB_PASS="$RET" - if [ -z "$AEGIR_DB_PASS" ]; then - echo EMPTY database password, can not be good. + + # Determin if we create a db accoount or ask for it. + # Starting from MariaDB 10.1... https://www.drupal.org/node/2770819 + # TODO: Work with future versions + if dpkg -s mariadb-server-10.1 > /dev/null 2>&1 + then + # MariaDB > 10.1 + CREATEUSER=1 + else + # Mysql & MariaDB < 10.1 + CREATEUSER=0 + fi + + + if [ $CREATEUSER = 0 ]; then + db_get "aegir/db_user" + AEGIR_DB_USER="$RET" + db_get "aegir/db_password" + AEGIR_DB_PASS="$RET" + if [ -z "$AEGIR_DB_PASS" ]; then + echo EMPTY database password, can not be good. + fi fi + db_get "aegir/email" EMAIL="$RET" db_go - # forget the DB password in debconf storage - db_reset aegir/db_password || true - db_fset aegir/db_password "seen" "true" || true + if [ $CREATEUSER = 0 ]; then + # forget the DB password in debconf storage + db_reset aegir/db_password || true + db_fset aegir/db_password "seen" "true" || true + fi + db_stop + + if [ $CREATEUSER = 1 ]; then + AEGIR_DB_USER="aegir_root" + + # Random password, will be stored in /var/aegir/.drush/server_localhost.alias.drushrc.php + AEGIR_DB_PASS=$(openssl rand -base64 12) + + /usr/bin/mysql -e "GRANT ALL ON *.* TO '$AEGIR_DB_USER'@'localhost' IDENTIFIED BY '$AEGIR_DB_PASS' WITH GRANT OPTION" + fi if [ -d $AEGIRHOME/.drush/provision ]; then echo "existing provision in $AEGIRHOME/.drush/provision detected, move away and try again" exit 1 fi - echo "installing the Aegir frontend (Drupal with the hostmaster profile), please wait..." + echo "installing the Aegir frontend (Drupal with the $PROFILE profile), please wait..." if [ "$DPKG_DEBUG" = "developer" ]; then DEBUG="--debug" fi diff --git a/scripts/ci-aegir-dev-install-apt-debian9.sh b/scripts/ci-aegir-dev-install-apt-debian9.sh index 57f0e3f3c29e2a1f310307faf3264fbe51c345ea..5010a195d15bb598687e9ef4b3a80521bb3e6fe5 100755 --- a/scripts/ci-aegir-dev-install-apt-debian9.sh +++ b/scripts/ci-aegir-dev-install-apt-debian9.sh @@ -23,7 +23,6 @@ EOF set -x sudo apt-get install --yes mariadb-server-10.1 php7.0-mysql php7.0-cli -sudo /usr/bin/mysql -e "GRANT ALL ON *.* TO 'aegir_root'@'localhost' IDENTIFIED BY 'PASSWORD' WITH GRANT OPTION" sudo DPKG_DEBUG=developer dpkg --install build/aegir3_*.deb build/aegir3-provision*.deb build/aegir3-hostmaster*.deb