diff --git a/CHANGELOG.md b/CHANGELOG.md index 8061fb3..c291a65 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,10 @@ # nystudio107/craft Change Log -## 2.5.0 - 2022.03.19 +## 2.5.1 - 2022.03.26 +### Added +* Dramatically sped up the startup time for the PHP containers by moving the permissions setting script to run asynchronously in the queue container via the `run_queue.sh` script +## 2.5.0 - 2022.03.19 ### Added * Switch the main branch to `craft-vite` so the default project now uses Vite.js * Significantly increased startup times via a `composer_install.sh` script that only runs `composer install` at container startup time if `composer.lock` or `vendor/` is missing diff --git a/docker-config/php-dev-craft/Dockerfile b/docker-config/php-dev-craft/Dockerfile index a632557..0ba0db1 100755 --- a/docker-config/php-dev-craft/Dockerfile +++ b/docker-config/php-dev-craft/Dockerfile @@ -54,7 +54,5 @@ RUN mkdir -p /var/www/project/cms/storage \ WORKDIR /var/www/project/cms -# Force permissions, update Craft, and start php-fpm -CMD chown -R www-data:www-data /var/www/project \ - && \ - php-fpm +# Start php-fpm +CMD php-fpm diff --git a/docker-config/php-prod-craft/Dockerfile b/docker-config/php-prod-craft/Dockerfile index 16f4280..6f960dc 100755 --- a/docker-config/php-prod-craft/Dockerfile +++ b/docker-config/php-prod-craft/Dockerfile @@ -57,17 +57,12 @@ RUN chmod a+x run_queue.sh \ COPY ./composer_install.sh . RUN chmod a+x composer_install.sh -# Force permissions, update Craft, and start php-fpm - -# Do a `composer install` without running any Composer scripts -# - If `composer.lock` is present, it will install what is in the lock file -# - If `composer.lock` is missing, it will update to the latest dependencies -# and create the `composer.lock` file -# This automatic running adds to the startup overhead of `docker-compose up` -# but saves far more time in not having to deal with out of sync versions -# when working with teams or multiple environments -CMD chown -R www-data:www-data /var/www/project \ - && \ - ./composer_install.sh \ +# Run the composer_install.sh script that will do a `composer install`: +# - If `composer.lock` is missing +# - If `vendor/` is missing +# ...then start up php-fpm. The `run_queue.sh` script in the queue container +# will take care of running any pending migrations and apply any Project Config changes, +# as well as set permissions via an async CLI process +CMD ./composer_install.sh \ && \ php-fpm diff --git a/docker-config/php-prod-craft/run_queue.sh b/docker-config/php-prod-craft/run_queue.sh index 6d5bd97..df7937a 100755 --- a/docker-config/php-prod-craft/run_queue.sh +++ b/docker-config/php-prod-craft/run_queue.sh @@ -13,6 +13,8 @@ # @license MIT cd /var/www/project/cms +# Force the permissions to be set properly +chown -R www-data:www-data /var/www/project & # Wait until the MySQL db container responds until eval "mysql -h mysql -u $DB_USER -p$DB_PASSWORD $DB_DATABASE -e 'select 1' > /dev/null 2>&1" do