From 8d438d9056bc1d8cb211bff0e5360b0ccb2142f3 Mon Sep 17 00:00:00 2001 From: Ben Croker <57572400+bencroker@users.noreply.github.com> Date: Tue, 25 Apr 2023 08:40:29 -0500 Subject: [PATCH 1/7] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 1d9e34d..5000f9d 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ }, "sort-packages": true, "platform": { - "php": "8.0.2" + "php": "8.1" } } } From bfa7ccdecaa054e80e1b26a183351552983455c6 Mon Sep 17 00:00:00 2001 From: Ben Croker <57572400+bencroker@users.noreply.github.com> Date: Tue, 25 Apr 2023 11:51:01 -0500 Subject: [PATCH 2/7] Remove platform requirement --- composer.json | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 5000f9d..16324a5 100644 --- a/composer.json +++ b/composer.json @@ -16,9 +16,6 @@ "craftcms/plugin-installer": true, "yiisoft/yii2-composer": true }, - "sort-packages": true, - "platform": { - "php": "8.1" - } + "sort-packages": true } } From 1620a79e9b02f0e2fe289279bac67fcc80282859 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Tue, 25 Apr 2023 19:11:51 -0400 Subject: [PATCH 3/7] fix: Wait not just for the database to be available, but also that the `info` table has been populated before proceeding with the `queue` container ([#2](https://github.com/nystudio107/spin-up-craft/issues/2)) --- .docker-config/php/run_queue.sh | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/.docker-config/php/run_queue.sh b/.docker-config/php/run_queue.sh index 06cb5af..7800bc6 100755 --- a/.docker-config/php/run_queue.sh +++ b/.docker-config/php/run_queue.sh @@ -13,17 +13,25 @@ # @license MIT cd /var/www/project +# Wait until the `composer install` is done by looking for the `vendor/autoload.php` file +echo "### Waiting for vendor/autoload.php" +while [ ! -f "composer.lock" ] || [ ! -d "vendor" ] || [ ! -f "vendor/autoload.php" ] +do + sleep 5 +done # Wait until the MySQL db container responds -echo "### Waiting for MySQL database" -until eval "mysql -h mysql -u $CRAFT_DB_USER -p$CRAFT_DB_PASSWORD $CRAFT_DB_DATABASE -e 'select 1' > /dev/null 2>&1" +COMMAND="mysql -h mysql -u $CRAFT_DB_USER -p$CRAFT_DB_PASSWORD $CRAFT_DB_DATABASE -se 'SELECT EXISTS(SELECT * FROM info)'" +# First wait until the command runs without error +until eval "$COMMAND > /dev/null 2>&1" do - sleep 1 + echo "### Waiting for MySQL database" + sleep 5 done -# Wait until the `composer install` is done by looking for the `vendor/autoload.php` file -echo "### Waiting for vendor/autoload.php" -while [ ! -f vendor/autoload.php ] +# Second wait until content in the `info` table exists +until [ $(eval "$COMMAND") != "0" ] do - sleep 1 + echo "### Waiting for database `info` table" + sleep 5 done # Ensure permissions on directories Craft needs to write to chown -R www-data:www-data /var/www/project/storage From a297fe7fd001ecc0bf51d5bf7f722bb7211503e1 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Tue, 25 Apr 2023 19:12:09 -0400 Subject: [PATCH 4/7] refactor: Wait on mysql, not php --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index a0264d4..93fd9f0 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -71,7 +71,7 @@ services: *php-build command: /var/www/run_queue.sh depends_on: - - "php" + - "mysql" env_file: *env_file environment: From 030b993998e7fdc4dac48704f050e52276abc1fc Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Tue, 25 Apr 2023 19:12:18 -0400 Subject: [PATCH 5/7] chore: Version 1.0.14 --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index db10986..ff979b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # nystudio107/spin-up-craft Change Log +## 1.0.14 - UNRELEASED +### Fixed +* Wait not just for the database to be available, but also that the `info` table has been populated before proceeding with the `queue` container ([#2](https://github.com/nystudio107/spin-up-craft/issues/2)) + +### Changed +* Remove PHP platform version + ## 1.0.13 - 2023.03.30 ### Changed * Clean up the `Makefile` by using `docker compose` api From 49770df05ca835167b3f7549d3356b67758615fa Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Tue, 25 Apr 2023 22:03:10 -0400 Subject: [PATCH 6/7] refactor: Backticks to quotes --- .docker-config/php/run_queue.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.docker-config/php/run_queue.sh b/.docker-config/php/run_queue.sh index 7800bc6..e4dc385 100755 --- a/.docker-config/php/run_queue.sh +++ b/.docker-config/php/run_queue.sh @@ -30,7 +30,7 @@ done # Second wait until content in the `info` table exists until [ $(eval "$COMMAND") != "0" ] do - echo "### Waiting for database `info` table" + echo "### Waiting for database 'info' table" sleep 5 done # Ensure permissions on directories Craft needs to write to From 7a29b3969af6e4583594a44f494e2ec62773c1e5 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Tue, 25 Apr 2023 22:05:35 -0400 Subject: [PATCH 7/7] chore: Version 1.0.14 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ff979b0..9d4b9b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # nystudio107/spin-up-craft Change Log -## 1.0.14 - UNRELEASED +## 1.0.14 - 2023.04.25 ### Fixed * Wait not just for the database to be available, but also that the `info` table has been populated before proceeding with the `queue` container ([#2](https://github.com/nystudio107/spin-up-craft/issues/2))