From 50e450f082748952ee429a4ef3256fd73fff79cc Mon Sep 17 00:00:00 2001 From: Hugo Sales Date: Wed, 6 May 2020 15:32:07 +0000 Subject: [PATCH] [TOOLS][DOCKER] Further fixes in the docker environment and fixed the install script --- docker/db/wait_for_db.sh | 2 +- docker/php/Dockerfile | 2 ++ docker/social/install.sh | 16 +++++++++------- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/docker/db/wait_for_db.sh b/docker/db/wait_for_db.sh index 384da26cd9..712299cc67 100755 --- a/docker/db/wait_for_db.sh +++ b/docker/db/wait_for_db.sh @@ -5,7 +5,7 @@ case $DBMS in CMD="mysqladmin ping --silent -hdb -uroot -p${MYSQL_ROOT_PASSWORD}" ;; "postgres") - CMD="pg_isready -hdb -q" + CMD="pg_isready -hdb -q -Upostgres" ;; *) exit 1 diff --git a/docker/php/Dockerfile b/docker/php/Dockerfile index 9bd7e73107..46f9fdb4e3 100644 --- a/docker/php/Dockerfile +++ b/docker/php/Dockerfile @@ -11,3 +11,5 @@ RUN apk add --virtual .phpize-deps $PHPIZE_DEPS \ && apk del .phpize-deps > /dev/null RUN docker-php-ext-install ${exts} + +WORKDIR /var/www/social diff --git a/docker/social/install.sh b/docker/social/install.sh index 3eb99bfa22..a4117086d8 100755 --- a/docker/social/install.sh +++ b/docker/social/install.sh @@ -1,6 +1,11 @@ #!/bin/sh -if [ ! -e /var/www/social/config.php ]; then +PGPASSWORD="${POSTGRES_PASSWORD}" psql -ltq -Upostgres -hdb | \ + cut -d '|' -f1 | grep -wq "${SOCIAL_DB}" + +if [ ! $? ]; then + + echo ${SOCIAL_DB} echo -e "Installing GNU social\nInstalling composer dependencies" @@ -8,13 +13,10 @@ if [ ! -e /var/www/social/config.php ]; then composer install - chmod g+w -R /var/www/social - chown -R :www-data /var/www/social + chmod g+w -R . + chown -R :www-data . - php /var/www/social/scripts/install_cli.php --server="${SOCIAL_DOMAIN}" --sitename="${SOCIAL_SITENAME}" \ - --host=db --fancy=yes --database="${SOCIAL_DB}" \ - --username="${SOCIAL_USER}" --password="${SOCIAL_PASSWORD}" \ - --admin-nick="${SOCIAL_ADMIN_NICK}" --admin-pass="${SOCIAL_ADMIN_PASSWORD}" || exit 1 + php bin/console doctrine:database:create || exit 1 echo "GNU social is installed" fi