Skip to content

Commit

Permalink
Fix install script.sh (ezsystems#464)
Browse files Browse the repository at this point in the history
* [Docker] Removed superfluous ; and indenting ifs in install_script.sh

* [Docker] Fixed so that install_script.sh exits properly on composer install fails
  • Loading branch information
vidarl authored and andrerom committed Oct 2, 2019
1 parent fa4d8a8 commit bffbb05
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions doc/docker/install_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,27 @@
# Dumping autoload using --optimize-autoloader to keep performenace on a usable level, not needed on linux host.
# Second chown line: For dev and behat tests we give a bit extra rights, never do this for prod.

for i in $(seq 1 3); do composer install --no-progress --no-interaction --prefer-dist --no-suggest --optimize-autoloader && s=0 && break || s=$? && sleep 1; done; (exit $s);
mkdir -p web/var;
for i in $(seq 1 3); do
composer install --no-progress --no-interaction --prefer-dist --no-suggest --optimize-autoloader && s=0 && break || s=$? && sleep 1
done
if [ "$s" != "0" ]; then
echo "ERROR : composer install failed, exit code : $s"
exit $s
fi
mkdir -p web/var

if [ "${INSTALL_DATABASE}" == "1" ]; then
php /scripts/wait_for_db.php;
composer ezplatform-install;
if [ "$SYMFONY_CMD" != '' ]; then echo '> Executing' "$SYMFONY_CMD"; php bin/console $SYMFONY_CMD; fi;
echo 'Dumping database into doc/docker/entrypoint/mysql/2_dump.sql for use by mysql on startup.';
mysqldump -u $DATABASE_USER --password=$DATABASE_PASSWORD -h $DATABASE_HOST --add-drop-table --extended-insert --protocol=tcp $DATABASE_NAME > doc/docker/entrypoint/mysql/2_dump.sql;
php /scripts/wait_for_db.php
composer ezplatform-install
if [ "$SYMFONY_CMD" != '' ]; then
echo '> Executing' "$SYMFONY_CMD"; php bin/console $SYMFONY_CMD
fi
echo 'Dumping database into doc/docker/entrypoint/mysql/2_dump.sql for use by mysql on startup.'
mysqldump -u $DATABASE_USER --password=$DATABASE_PASSWORD -h $DATABASE_HOST --add-drop-table --extended-insert --protocol=tcp $DATABASE_NAME > doc/docker/entrypoint/mysql/2_dump.sql
fi;

rm -Rf var/logs/* var/cache/*/*;
chown -R www-data:www-data var/cache var/logs web/var;
find var/cache var/logs web/var -type d -print0 | xargs -0 chmod -R 775;
find var/cache var/logs web/var -type f -print0 | xargs -0 chmod -R 664;
chown -R www-data:www-data app/config src;
rm -Rf var/logs/* var/cache/*/*
chown -R www-data:www-data var/cache var/logs web/var
find var/cache var/logs web/var -type d -print0 | xargs -0 chmod -R 775
find var/cache var/logs web/var -type f -print0 | xargs -0 chmod -R 664
chown -R www-data:www-data app/config src

0 comments on commit bffbb05

Please sign in to comment.