summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHerman van Rink2017-09-17 22:15:51 +0200
committerHerman van Rink2017-09-17 22:18:57 +0200
commit6102223fb09871221e7425914938f56ebe5041d6 (patch)
tree1af91ac63508044996261dd7eebb307d992bd9c3
parent6098ed53ff991f94dd42e65f24b8ad54150a0db5 (diff)
Issue #2770819 by helmo: Support Maria DB install without password (10.1+)
-rw-r--r--.gitlab-ci.yml25
-rw-r--r--debian/aegir3-hostmaster.postinst54
-rwxr-xr-xscripts/ci-aegir-dev-install-apt-debian9.sh1
3 files changed, 65 insertions, 15 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index c6ebe54..8681826 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 ed831de..dc64d1d 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 57f0e3f..5010a19 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