diff options
Diffstat (limited to 'docker-common')
-rwxr-xr-x | docker-common/nextcloud/020nextcloud | 2 | ||||
-rw-r--r-- | docker-common/nextcloud/ncp-provisioning.sh | 46 |
2 files changed, 1 insertions, 47 deletions
diff --git a/docker-common/nextcloud/020nextcloud b/docker-common/nextcloud/020nextcloud index 76299b7f..3f5fa761 100755 --- a/docker-common/nextcloud/020nextcloud +++ b/docker-common/nextcloud/020nextcloud @@ -18,7 +18,7 @@ OCC="$NCDIR/occ" } echo "Provisioning" -/usr/local/bin/ncp-provisioning.sh +bash /usr/local/bin/ncp-provisioning.sh echo "Starting Redis" mkdir -p /var/run/redis diff --git a/docker-common/nextcloud/ncp-provisioning.sh b/docker-common/nextcloud/ncp-provisioning.sh deleted file mode 100644 index 014bd814..00000000 --- a/docker-common/nextcloud/ncp-provisioning.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash - -# this script runs at startup to provide an unique random passwords for each instance - -## redis provisioning - -REDISPASS="$( grep "^requirepass" /etc/redis/redis.conf | cut -f2 -d' ' )" - -### IF redis password is the default one, generate a new one - -[[ "$REDISPASS" == "default" ]] && { - REDISPASS="$( openssl rand -base64 32 )" - echo Provisioning Redis password - sed -i -E "s|^requirepass .*|requirepass $REDISPASS|" /etc/redis/redis.conf -} - -### If there exists already a configuration adjust the password -test -f /data/app/config/config.php && { - echo Updating NextCloud config with Redis password $REDISPASS - sed -i "s|'password'.*|'password' => '$REDISPASS',|" /data/app/config/config.php -} - -## mariaDB provisioning - -DBADMIN=ncadmin -DBPASSWD=$( grep password /root/.my.cnf | cut -d= -f2 ) -[[ "$DBPASSWD" == "default" ]] && { - DBPASSWD=$( openssl rand -base64 32 ) - echo Provisioning MariaDB password - echo -e "[client]\npassword=$DBPASSWD" > /root/.my.cnf - chmod 600 /root/.my.cnf - mysql <<EOF -GRANT USAGE ON *.* TO '$DBADMIN'@'localhost' IDENTIFIED BY '$DBPASSWD'; -DROP USER '$DBADMIN'@'localhost'; -CREATE USER '$DBADMIN'@'localhost' IDENTIFIED BY '$DBPASSWD'; -GRANT ALL PRIVILEGES ON nextcloud.* TO $DBADMIN@localhost; -EXIT -EOF -} - -test -f /data/app/config/config.php && { - echo Updating NextCloud config with MariaDB password $DBPASSWD - sed -i "s|'dbpassword' =>.*|'dbpassword' => '$DBPASSWD',|" /data/app/config/config.php -} - -exit 0 |