From a7adc8c5e933284e77ccc79994c7b13600b708d4 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Sun, 23 May 2021 15:53:45 -0400 Subject: [PATCH 01/68] Run container as www-data to avoid permmissions issues --- docker-config/php-dev-craft/Dockerfile | 3 +++ docker-config/php-prod-craft/Dockerfile | 3 +++ 2 files changed, 6 insertions(+) diff --git a/docker-config/php-dev-craft/Dockerfile b/docker-config/php-dev-craft/Dockerfile index d4efb7a..6d390c7 100755 --- a/docker-config/php-dev-craft/Dockerfile +++ b/docker-config/php-dev-craft/Dockerfile @@ -55,3 +55,6 @@ RUN mkdir -p /var/www/project/cms/web/cpresources && \ chown -R www-data:www-data /var/www/project/cms/web/cpresources WORKDIR /var/www/project/cms + +# run container as the www-data user +USER www-data diff --git a/docker-config/php-prod-craft/Dockerfile b/docker-config/php-prod-craft/Dockerfile index 4739338..501715a 100755 --- a/docker-config/php-prod-craft/Dockerfile +++ b/docker-config/php-prod-craft/Dockerfile @@ -62,6 +62,9 @@ RUN chown -R www-data:www-data /var/www/project/cms/web WORKDIR /var/www/project/cms +# run container as the www-data user +USER www-data + # Force permissions, update Craft, and start php-fpm # Do a `composer install` without running any Composer scripts From 15e163348fe300ba84b0c51161bdbc1f9a07beb7 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Sun, 23 May 2021 15:55:17 -0400 Subject: [PATCH 02/68] Version 2.4.38 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6823274..fc13335 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # nystudio107/craft Change Log +## 2.4.38 - 2021.05.23 +### Changed +* Run php container as the `www-data` user to avoid permissions issues + ## 2.4.37 - 2021.05.14 ### Changed * Added `logs` and `compiled_templates` dirs back in, so they appear on the client side From b03f1f5bb60083b58c471c93677b5019cca33b76 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Sun, 23 May 2021 15:57:20 -0400 Subject: [PATCH 03/68] Change order --- docker-config/php-dev-craft/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-config/php-dev-craft/Dockerfile b/docker-config/php-dev-craft/Dockerfile index 6d390c7..879aec1 100755 --- a/docker-config/php-dev-craft/Dockerfile +++ b/docker-config/php-dev-craft/Dockerfile @@ -54,7 +54,7 @@ RUN mkdir -p /var/www/project/cms/storage && \ RUN mkdir -p /var/www/project/cms/web/cpresources && \ chown -R www-data:www-data /var/www/project/cms/web/cpresources -WORKDIR /var/www/project/cms - # run container as the www-data user USER www-data + +WORKDIR /var/www/project/cms From 2497095afdfc2d5496ddd740455ff93b45a9c09e Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Sun, 23 May 2021 15:59:14 -0400 Subject: [PATCH 04/68] Revert order --- docker-config/php-dev-craft/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-config/php-dev-craft/Dockerfile b/docker-config/php-dev-craft/Dockerfile index 879aec1..6d390c7 100755 --- a/docker-config/php-dev-craft/Dockerfile +++ b/docker-config/php-dev-craft/Dockerfile @@ -54,7 +54,7 @@ RUN mkdir -p /var/www/project/cms/storage && \ RUN mkdir -p /var/www/project/cms/web/cpresources && \ chown -R www-data:www-data /var/www/project/cms/web/cpresources +WORKDIR /var/www/project/cms + # run container as the www-data user USER www-data - -WORKDIR /var/www/project/cms From 967d3c5e6600acc95b30ecdcc6a78e2aa0b16ccb Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Fri, 11 Jun 2021 11:25:46 -0400 Subject: [PATCH 05/68] Remove whitelist --- buildchain/tailwind.config.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/buildchain/tailwind.config.js b/buildchain/tailwind.config.js index cc10341..219a3dc 100644 --- a/buildchain/tailwind.config.js +++ b/buildchain/tailwind.config.js @@ -13,9 +13,6 @@ module.exports = { ], mode: 'layers', options: { - whitelist: [ - '../src/css/components/**/*.{css}', - ], } }, theme: { From 087575ec6fb307e65755ebc23528ea18dc5bb6bd Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Fri, 11 Jun 2021 11:27:18 -0400 Subject: [PATCH 06/68] Version 2.4.39 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc13335..e186439 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # nystudio107/craft Change Log +## 2.4.39 - UNRELEASED +### Changed +* Removed whitelist settings in `tailwind.conf.js` + ## 2.4.38 - 2021.05.23 ### Changed * Run php container as the `www-data` user to avoid permissions issues From e13d814bfb0045d959b268f69b0f5432a9135bbc Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Fri, 11 Jun 2021 12:27:39 -0400 Subject: [PATCH 07/68] Cleaned up the `php-dev-craft` & `php-prod-craft` Dockerfile file permissions --- docker-config/php-dev-craft/Dockerfile | 13 +++++------- docker-config/php-prod-craft/Dockerfile | 28 +++++++------------------ 2 files changed, 12 insertions(+), 29 deletions(-) diff --git a/docker-config/php-dev-craft/Dockerfile b/docker-config/php-dev-craft/Dockerfile index 6d390c7..d18ffc5 100755 --- a/docker-config/php-dev-craft/Dockerfile +++ b/docker-config/php-dev-craft/Dockerfile @@ -45,14 +45,11 @@ RUN set -eux; \ WORKDIR /var/www/project -# Create the storage directory and make it writeable by PHP -RUN mkdir -p /var/www/project/cms/storage && \ - mkdir -p /var/www/project/cms/storage/runtime && \ - chown -R www-data:www-data /var/www/project/cms/storage - -# Create the cpresources directory and make it writeable by PHP -RUN mkdir -p /var/www/project/cms/web/cpresources && \ - chown -R www-data:www-data /var/www/project/cms/web/cpresources +RUN mkdir -p /var/www/project/cms/storage \ + && \ + mkdir -p /var/www/project/cms/web/cpresources \ + && \ + chown -R www-data:www-data /var/www/project WORKDIR /var/www/project/cms diff --git a/docker-config/php-prod-craft/Dockerfile b/docker-config/php-prod-craft/Dockerfile index 501715a..fb71e39 100755 --- a/docker-config/php-prod-craft/Dockerfile +++ b/docker-config/php-prod-craft/Dockerfile @@ -46,19 +46,13 @@ RUN set -eux; \ WORKDIR /var/www/project COPY ./run_queue.sh . -RUN chmod a+x run_queue.sh - -# Create the storage directory and make it writeable by PHP -RUN mkdir -p /var/www/project/cms/storage && \ - mkdir -p /var/www/project/cms/storage/runtime && \ - chown -R www-data:www-data /var/www/project/cms/storage - -# Create the cpresources directory and make it writeable by PHP -RUN mkdir -p /var/www/project/cms/web/cpresources && \ - chown -R www-data:www-data /var/www/project/cms/web/cpresources - -# Permissions -RUN chown -R www-data:www-data /var/www/project/cms/web +RUN chmod a+x run_queue.sh \ + && \ + mkdir -p /var/www/project/cms/storage \ + && \ + mkdir -p /var/www/project/cms/web/cpresources \ + && \ + chown -R www-data:www-data /var/www/project WORKDIR /var/www/project/cms @@ -75,14 +69,6 @@ USER www-data # but saves far more time in not having to deal with out of sync versions # when working with teams or multiple environments CMD composer install --verbose --no-progress --no-scripts --optimize-autoloader --no-interaction \ - && \ - chown -R www-data:www-data /var/www/project/cms/config \ - && \ - chown -R www-data:www-data /var/www/project/cms/storage \ - && \ - chown -R www-data:www-data /var/www/project/cms/vendor \ - && \ - chown -R www-data:www-data /var/www/project/cms/web \ && \ composer craft-update \ && \ From 4e01b9226bc8df0b8cb837d97d38ac6cfc559488 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Fri, 11 Jun 2021 12:27:46 -0400 Subject: [PATCH 08/68] Added comment --- docker-compose.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index a6fd852..15243f8 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -30,9 +30,10 @@ services: volumes: &php-volumes - cpresources:/var/www/project/cms/web/cpresources:delegated - storage:/var/www/project/cms/storage:delegated + - ./cms:/var/www/project/cms:cached + # Specific directories that need to be bind-mounted - ./cms/storage/logs:/var/www/project/cms/storage/logs:delegated - ./cms/storage/runtime/compiled_templates:/var/www/project/cms/storage/runtime/compiled_templates:delegated - - ./cms:/var/www/project/cms:cached - ./cms/vendor:/var/www/project/cms/vendor:delegated # php - run php-fpm with xdebug php_xdebug: From 90ff0a1ad8a8a211f2627d3aa733d1b16cd68a46 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Fri, 11 Jun 2021 12:28:08 -0400 Subject: [PATCH 09/68] Version 2.4.39 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e186439..391746b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## 2.4.39 - UNRELEASED ### Changed * Removed whitelist settings in `tailwind.conf.js` +* Cleaned up the `php-dev-craft` & `php-prod-craft` Dockerfile file permissions ## 2.4.38 - 2021.05.23 ### Changed From 47425c53386a5cea37c545ccd92c611d81506675 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Fri, 11 Jun 2021 12:37:00 -0400 Subject: [PATCH 10/68] Version 2.4.39 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 391746b..d7fd6be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # nystudio107/craft Change Log -## 2.4.39 - UNRELEASED +## 2.4.39 - 2021.06.11 ### Changed * Removed whitelist settings in `tailwind.conf.js` * Cleaned up the `php-dev-craft` & `php-prod-craft` Dockerfile file permissions From 0f2eaf1e0045730829ebf3e392faddf14017653e Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Mon, 14 Jun 2021 18:50:38 -0400 Subject: [PATCH 11/68] Add --remove-vcs Signed-off-by: Andrew Welch --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 449a69f..e07316f 100644 --- a/README.md +++ b/README.md @@ -42,11 +42,11 @@ You can read more about it in the [Setting up a New Craft 3 CMS Project](https:/ This project package works exactly the way Pixel & Tonic's [craftcms/craft](https://github.com/craftcms/craft) package works; you create a new project by first creating & installing the project: - composer create-project nystudio107/craft PATH --no-install + composer create-project nystudio107/craft PATH --no-install --remove-vcs Make sure that `PATH` is the path to your project, including the name you want for the project, e.g.: - composer create-project nystudio107/craft craft3 --no-install + composer create-project nystudio107/craft craft3 --no-install --remove-vcs We use `--no-install` so that the composer packages for the root project are not installed. From 67cfab5dcad35842f7dc7c62eda693018409de4b Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Tue, 15 Jun 2021 13:05:34 -0400 Subject: [PATCH 12/68] Removed `USER` directive in the PHP containers, since the pool runs as `www-data` already --- docker-config/php-dev-craft/Dockerfile | 3 --- docker-config/php-prod-craft/Dockerfile | 5 ++--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/docker-config/php-dev-craft/Dockerfile b/docker-config/php-dev-craft/Dockerfile index d18ffc5..a62715a 100755 --- a/docker-config/php-dev-craft/Dockerfile +++ b/docker-config/php-dev-craft/Dockerfile @@ -52,6 +52,3 @@ RUN mkdir -p /var/www/project/cms/storage \ chown -R www-data:www-data /var/www/project WORKDIR /var/www/project/cms - -# run container as the www-data user -USER www-data diff --git a/docker-config/php-prod-craft/Dockerfile b/docker-config/php-prod-craft/Dockerfile index fb71e39..e86f205 100755 --- a/docker-config/php-prod-craft/Dockerfile +++ b/docker-config/php-prod-craft/Dockerfile @@ -56,9 +56,6 @@ RUN chmod a+x run_queue.sh \ WORKDIR /var/www/project/cms -# run container as the www-data user -USER www-data - # Force permissions, update Craft, and start php-fpm # Do a `composer install` without running any Composer scripts @@ -69,6 +66,8 @@ USER www-data # but saves far more time in not having to deal with out of sync versions # when working with teams or multiple environments CMD composer install --verbose --no-progress --no-scripts --optimize-autoloader --no-interaction \ + && \ + chown -R www-data:www-data /var/www/project && \ composer craft-update \ && \ From 116b1d1d4ddaffeba7de828fde7df98179fd1dfb Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Tue, 15 Jun 2021 13:05:42 -0400 Subject: [PATCH 13/68] Version 2.4.40 --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d7fd6be..9a2bae6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # nystudio107/craft Change Log +## 2.4.40 - 2021.06.15 +### Changed +* Removed `USER` directive in the PHP containers, since the pool runs as `www-data` already +* Fix permissions regression + ## 2.4.39 - 2021.06.11 ### Changed * Removed whitelist settings in `tailwind.conf.js` From b17de3febba9dc6c75042810c57bff43fef70da7 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Tue, 15 Jun 2021 14:49:43 -0400 Subject: [PATCH 14/68] Fixed typo in Dockerfile that would cause the PHP container to not build --- docker-config/php-prod-craft/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-config/php-prod-craft/Dockerfile b/docker-config/php-prod-craft/Dockerfile index e86f205..29b74b8 100755 --- a/docker-config/php-prod-craft/Dockerfile +++ b/docker-config/php-prod-craft/Dockerfile @@ -67,7 +67,7 @@ WORKDIR /var/www/project/cms # when working with teams or multiple environments CMD composer install --verbose --no-progress --no-scripts --optimize-autoloader --no-interaction \ && \ - chown -R www-data:www-data /var/www/project + chown -R www-data:www-data /var/www/project \ && \ composer craft-update \ && \ From 21f485897968f853b28c64803cc8ae6f9f58630c Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Tue, 15 Jun 2021 14:49:50 -0400 Subject: [PATCH 15/68] Version 2.4.41 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a2bae6..aa6a127 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # nystudio107/craft Change Log +## 2.4.41 - 2021.06.15 +### Fixed +* Fixed typo in Dockerfile that would cause the PHP container to not build + ## 2.4.40 - 2021.06.15 ### Changed * Removed `USER` directive in the PHP containers, since the pool runs as `www-data` already From c4903936a923237787c69d4241a4693362157200 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Tue, 22 Jun 2021 15:12:29 -0400 Subject: [PATCH 16/68] Continue running the `php-fpm` containers as root (since `php-fpm` uses worker pools with the proper user/group), but switch to `su-exec` to ensure any craft CLI commands are run as `www-data` --- docker-compose.yml | 4 ---- docker-config/php-dev-craft/Dockerfile | 6 ++++++ docker-config/php-prod-craft/Dockerfile | 7 ++++--- docker-config/php-prod-craft/run_queue.sh | 8 ++++---- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 15243f8..4312a71 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -47,7 +47,6 @@ services: expose: - "9000" init: true - user: www-data volumes: *php-volumes # queue - runs queue jobs via php craft queue/listen @@ -59,10 +58,7 @@ services: - "php" env_file: *env - expose: - - "9001" init: true - user: www-data volumes: *php-volumes # mariadb - database diff --git a/docker-config/php-dev-craft/Dockerfile b/docker-config/php-dev-craft/Dockerfile index a62715a..a632557 100755 --- a/docker-config/php-dev-craft/Dockerfile +++ b/docker-config/php-dev-craft/Dockerfile @@ -23,6 +23,7 @@ RUN set -eux; \ && \ # Packages to install apk add --no-cache \ + su-exec \ gifsicle \ jpegoptim \ libwebp-tools \ @@ -52,3 +53,8 @@ RUN mkdir -p /var/www/project/cms/storage \ chown -R www-data:www-data /var/www/project 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 diff --git a/docker-config/php-prod-craft/Dockerfile b/docker-config/php-prod-craft/Dockerfile index 29b74b8..69462fc 100755 --- a/docker-config/php-prod-craft/Dockerfile +++ b/docker-config/php-prod-craft/Dockerfile @@ -23,6 +23,7 @@ RUN set -eux; \ && \ # Packages to install apk add --no-cache \ + su-exec \ gifsicle \ jpegoptim \ libwebp-tools \ @@ -65,10 +66,10 @@ WORKDIR /var/www/project/cms # 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 composer install --verbose --no-progress --no-scripts --optimize-autoloader --no-interaction \ +CMD chown -R www-data:www-data /var/www/project \ && \ - chown -R www-data:www-data /var/www/project \ + su-exec www-data composer install --verbose --no-progress --no-scripts --optimize-autoloader --no-interaction \ && \ - composer craft-update \ + su-exec www-data composer craft-update \ && \ php-fpm diff --git a/docker-config/php-prod-craft/run_queue.sh b/docker-config/php-prod-craft/run_queue.sh index ec5e470..05b4b25 100755 --- a/docker-config/php-prod-craft/run_queue.sh +++ b/docker-config/php-prod-craft/run_queue.sh @@ -4,7 +4,7 @@ # # This shell script runs the Craft CMS queue via `php craft queue/listen` # It's wrapped in a "keep alive" infinite loop that restarts the command -# (after a 30 second sleep) should it exit unexpectedly for any reason +# (after a 60 second sleep) should it exit unexpectedly for any reason # # @author nystudio107 # @copyright Copyright (c) 2020 nystudio107 @@ -14,7 +14,7 @@ while true do cd /var/www/project/cms - php craft queue/listen 10 - echo "-> craft queue/listen will retry in 30 seconds" - sleep 30 + su-exec www-data php craft queue/listen 10 + echo "-> craft queue/listen will retry in 60 seconds" + sleep 60 done From 51bf2241fb98b2659b588225a665aa7ee0652706 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Tue, 22 Jun 2021 15:12:39 -0400 Subject: [PATCH 17/68] Version 2.4.42 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index aa6a127..6f36c8c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # nystudio107/craft Change Log +## 2.4.42 - 2021.06.22 +### Changed +* Continue running the `php-fpm` containers as root (since `php-fpm` uses worker pools with the proper user/group), but switch to `su-exec` to ensure any craft CLI commands are run as `www-data` + ## 2.4.41 - 2021.06.15 ### Fixed * Fixed typo in Dockerfile that would cause the PHP container to not build From 7fe5968725cf96e289b68d502d0831e2871d1a82 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Mon, 19 Jul 2021 14:20:03 -0400 Subject: [PATCH 18/68] Remove `storage/` dir --- .gitignore | 1 - cms/storage/config-deltas/.gitignore | 2 -- 2 files changed, 3 deletions(-) delete mode 100644 cms/storage/config-deltas/.gitignore diff --git a/.gitignore b/.gitignore index 49bd2ea..a057752 100644 --- a/.gitignore +++ b/.gitignore @@ -19,7 +19,6 @@ # CRAFT STORAGE */storage/* -!*/storage/.gitkeep # ASSETS /cms/web/assets/* diff --git a/cms/storage/config-deltas/.gitignore b/cms/storage/config-deltas/.gitignore deleted file mode 100644 index d6b7ef3..0000000 --- a/cms/storage/config-deltas/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore From 5d57a77febb49483a0e43bd9c3b30f5c04173d68 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Mon, 19 Jul 2021 14:20:50 -0400 Subject: [PATCH 19/68] Version 2.4.43 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f36c8c..66f55e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # nystudio107/craft Change Log +## 2.4.43 - 2021.07.19 +### Changed +* Remove `storage/` dir + ## 2.4.42 - 2021.06.22 ### Changed * Continue running the `php-fpm` containers as root (since `php-fpm` uses worker pools with the proper user/group), but switch to `su-exec` to ensure any craft CLI commands are run as `www-data` From bc6a2bd691b0937b06fbfc4669b09e8b1efac129 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Tue, 20 Jul 2021 15:20:44 -0400 Subject: [PATCH 20/68] Fix breaking changes due to `webpack-dev-server` `^4.0.0-rc.0` --- buildchain/package.json | 2 +- buildchain/webpack-configs/dev-server.config.js | 7 +++++-- buildchain/webpack-settings/dev-server.settings.js | 1 - cms/example.env | 1 - 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/buildchain/package.json b/buildchain/package.json index 7caa925..df96e06 100644 --- a/buildchain/package.json +++ b/buildchain/package.json @@ -111,7 +111,7 @@ "webpack": "^5.13.0", "webpack-bundle-analyzer": "^4.3.0", "webpack-cli": "^4.3.0", - "webpack-dev-server": "^4.0.0-beta.3", + "webpack-dev-server": "^4.0.0-rc.0", "webpack-manifest-plugin": "^3.0.0", "webpack-merge": "^5.7.0", "workbox-webpack-plugin": "^6.0.0" diff --git a/buildchain/webpack-configs/dev-server.config.js b/buildchain/webpack-configs/dev-server.config.js index 1359c6b..8ecd4bc 100644 --- a/buildchain/webpack-configs/dev-server.config.js +++ b/buildchain/webpack-configs/dev-server.config.js @@ -13,13 +13,17 @@ module.exports = (type = 'modern', settings) => { const common = () => ({ devServer: { client: { + allowedHosts: "all", overlay: true, progress: false, + webSocketURL: { + hostname: settings.host(), + port: settings.port(), + }, }, devMiddleware: { publicPath: '/', }, - firewall: false, headers: { 'Access-Control-Allow-Origin': '*' }, @@ -27,7 +31,6 @@ module.exports = (type = 'modern', settings) => { hot: true, https: !!parseInt(settings.https()), port: settings.port(), - public: settings.public(), static: { directory: path.resolve(__dirname, settings.contentBase()), publicPath: '/', diff --git a/buildchain/webpack-settings/dev-server.settings.js b/buildchain/webpack-settings/dev-server.settings.js index c6139c7..1e23d05 100644 --- a/buildchain/webpack-settings/dev-server.settings.js +++ b/buildchain/webpack-settings/dev-server.settings.js @@ -10,5 +10,4 @@ module.exports = { https: () => process.env.DEVSERVER_HTTPS || false, poll: () => process.env.DEVSERVER_POLL || false, port: () => process.env.DEVSERVER_PORT || 8080, - public: () => process.env.DEVSERVER_PUBLIC || 'http://localhost:8080', }; diff --git a/cms/example.env b/cms/example.env index be5e944..0df7bde 100644 --- a/cms/example.env +++ b/cms/example.env @@ -44,7 +44,6 @@ REDIS_CRAFT_DB=1 # webpack settings PUBLIC_PATH=/dist/ -DEVSERVER_PUBLIC=http://localhost:8080 DEVSERVER_HOST=0.0.0.0 DEVSERVER_POLL=0 DEVSERVER_PORT=8080 From 452383aeed6c2d1578a610edfd7dfc6c20b16cfc Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Tue, 20 Jul 2021 15:20:50 -0400 Subject: [PATCH 21/68] Version 2.4.44 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 66f55e2..d273171 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # nystudio107/craft Change Log +## 2.4.44 - 2021.07.20 +### Fixed +* Fix breaking changes due to `webpack-dev-server` `^4.0.0-rc.0` + ## 2.4.43 - 2021.07.19 ### Changed * Remove `storage/` dir From 63010926e207b924f48e2fa5114add556125b014 Mon Sep 17 00:00:00 2001 From: michael Date: Tue, 20 Jul 2021 22:09:47 +0200 Subject: [PATCH 22/68] setting allowedHosts as root option from devServer / removed publicPath from output --- buildchain/webpack-configs/dev-server.config.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/buildchain/webpack-configs/dev-server.config.js b/buildchain/webpack-configs/dev-server.config.js index 8ecd4bc..88642e4 100644 --- a/buildchain/webpack-configs/dev-server.config.js +++ b/buildchain/webpack-configs/dev-server.config.js @@ -12,8 +12,8 @@ module.exports = (type = 'modern', settings) => { // common config const common = () => ({ devServer: { + allowedHosts: "all", client: { - allowedHosts: "all", overlay: true, progress: false, webSocketURL: { @@ -50,7 +50,6 @@ module.exports = (type = 'modern', settings) => { output: { filename: path.join('./js', '[name].js'), path: path.resolve(__dirname, settings.paths.dist), - publicPath: settings.public() + '/', }, plugins: [ new webpack.EvalSourceMapDevToolPlugin({ From 2a60131a2664c83c9b55f3d00febfa8ee99c684d Mon Sep 17 00:00:00 2001 From: michael Date: Tue, 20 Jul 2021 22:37:28 +0200 Subject: [PATCH 23/68] added publicPath back into play, dev-server breaks when outputPath isn't available --- buildchain/webpack-configs/dev-server.config.js | 1 + buildchain/webpack-settings/dev-server.settings.js | 1 + cms/example.env | 1 + 3 files changed, 3 insertions(+) diff --git a/buildchain/webpack-configs/dev-server.config.js b/buildchain/webpack-configs/dev-server.config.js index 88642e4..c36c2a8 100644 --- a/buildchain/webpack-configs/dev-server.config.js +++ b/buildchain/webpack-configs/dev-server.config.js @@ -50,6 +50,7 @@ module.exports = (type = 'modern', settings) => { output: { filename: path.join('./js', '[name].js'), path: path.resolve(__dirname, settings.paths.dist), + publicPath: settings.public() + '/', }, plugins: [ new webpack.EvalSourceMapDevToolPlugin({ diff --git a/buildchain/webpack-settings/dev-server.settings.js b/buildchain/webpack-settings/dev-server.settings.js index 1e23d05..c6139c7 100644 --- a/buildchain/webpack-settings/dev-server.settings.js +++ b/buildchain/webpack-settings/dev-server.settings.js @@ -10,4 +10,5 @@ module.exports = { https: () => process.env.DEVSERVER_HTTPS || false, poll: () => process.env.DEVSERVER_POLL || false, port: () => process.env.DEVSERVER_PORT || 8080, + public: () => process.env.DEVSERVER_PUBLIC || 'http://localhost:8080', }; diff --git a/cms/example.env b/cms/example.env index 0df7bde..5972dfb 100644 --- a/cms/example.env +++ b/cms/example.env @@ -48,6 +48,7 @@ DEVSERVER_HOST=0.0.0.0 DEVSERVER_POLL=0 DEVSERVER_PORT=8080 DEVSERVER_HTTPS=0 +DEVSERVER_PUBLIC=http://localhost:8080 # Twigpack settings TWIGPACK_DEV_SERVER_MANIFEST_PATH=http://webpack:8080/ From 9b7c1dd940abb6f53b2511757843f135af1580b6 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Tue, 20 Jul 2021 16:47:06 -0400 Subject: [PATCH 24/68] Version 2.4.45 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d273171..7f43c8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # nystudio107/craft Change Log +## 2.4.45 - 2021.07.20 +### Fixed +* Add `publicPath` back in, and fix `allowedHosts` location in the config + ## 2.4.44 - 2021.07.20 ### Fixed * Fix breaking changes due to `webpack-dev-server` `^4.0.0-rc.0` From 8d8e11fe377b5b0e80a5f6a7c8fc8bc17c995740 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Tue, 20 Jul 2021 17:34:15 -0400 Subject: [PATCH 25/68] Single quotes Signed-off-by: Andrew Welch --- buildchain/webpack-configs/dev-server.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildchain/webpack-configs/dev-server.config.js b/buildchain/webpack-configs/dev-server.config.js index c36c2a8..7d46534 100644 --- a/buildchain/webpack-configs/dev-server.config.js +++ b/buildchain/webpack-configs/dev-server.config.js @@ -12,7 +12,7 @@ module.exports = (type = 'modern', settings) => { // common config const common = () => ({ devServer: { - allowedHosts: "all", + allowedHosts: 'all', client: { overlay: true, progress: false, From d1e65d55e7a3e3fd91bc33a346c253894d1eb831 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Thu, 29 Jul 2021 11:15:37 -0400 Subject: [PATCH 26/68] Version 2.4.46 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f43c8d..26d7953 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # nystudio107/craft Change Log +## 2.4.46 - 2021.07.29 +### Added +* Added `putyourlightson/craft-autocomplete` for the Twig + Symfony plugin auto-complete, removed FauxTwigExtension.php + ## 2.4.45 - 2021.07.20 ### Fixed * Add `publicPath` back in, and fix `allowedHosts` location in the config From 28f2f773ebaafce4285f7b9cd80b507d5cb6ca48 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Thu, 29 Jul 2021 11:16:13 -0400 Subject: [PATCH 27/68] Added `putyourlightson/craft-autocomplete` for the Twig + Symfony plugin auto-complete, removed FauxTwigExtension.php --- cms/composer.json | 1 + src/php/FauxTwigExtension.php | 111 ---------------------------------- 2 files changed, 1 insertion(+), 111 deletions(-) delete mode 100644 src/php/FauxTwigExtension.php diff --git a/cms/composer.json b/cms/composer.json index 9f29f6a..730b867 100644 --- a/cms/composer.json +++ b/cms/composer.json @@ -3,6 +3,7 @@ "craftcms/cms": "^3.6.9", "vlucas/phpdotenv": "^3.4.0", "yiisoft/yii2-redis": "^2.0.6", + "putyourlightson/craft-autocomplete": "^1.0.0", "nystudio107/craft-imageoptimize": "^1.0.0", "nystudio107/craft-fastcgicachebust": "^1.0.0", "nystudio107/craft-minify": "^1.2.5", diff --git a/src/php/FauxTwigExtension.php b/src/php/FauxTwigExtension.php deleted file mode 100644 index fab6958..0000000 --- a/src/php/FauxTwigExtension.php +++ /dev/null @@ -1,111 +0,0 @@ - Include Path. - * You never call it, it's never included anywhere via PHP directly nor does it affect other - * classes or Twig in any way. But PhpStorm will index it, and think all those variables - * are in every single template and thus allows you to use Intellisense auto completion. - * - * Thanks to Robin Schambach; for context, see: - * https://github.com/Haehnchen/idea-php-symfony2-plugin/issues/1103 - * - * @link https://nystudio107.com - * @copyright Copyright (c) 2019 nystudio107 - * @license MIT - * @license https://opensource.org/licenses/MIT MIT Licensed - */ - -namespace nystudio107\craft; - -/** - * Class FauxCraftVariable extends the actual Craft Variable, but with added properties - * that reflect things that are added to the Craft Variable dynamically by - * plugins or modules. - * - * @property \craft\web\twig\variables\Cp $cp - * @property \craft\web\twig\variables\Io $io - * @property \craft\web\twig\variables\Routes $routes - * @property \craft\web\twig\variables\CategoryGroups $categoryGroups - * @property \craft\web\twig\variables\Config $config - * @property \craft\web\twig\variables\Deprecator $deprecator - * @property \craft\web\twig\variables\ElementIndexes $elementIndexes - * @property \craft\web\twig\variables\EntryRevisions $entryRevisions - * @property \craft\web\twig\variables\Feeds $feeds - * @property \craft\web\twig\variables\Fields $fields - * @property \craft\web\twig\variables\Globals $globals - * @property \craft\web\twig\variables\I18N $i18n - * @property \craft\web\twig\variables\Request $request - * @property \craft\web\twig\variables\Sections $sections - * @property \craft\web\twig\variables\SystemSettings $systemSettings - * @property \craft\web\twig\variables\UserSession $session - * @property \craft\commerce\web\twig\CraftVariableBehavior $commerce - * @property \putyourlightson\blitz\variables\BlitzVariable $blitz - * @property \nystudio107\twigpack\variables\ManifestVariable $twigpack - * @property \modules\sitemodule\SiteModule $site - * @mixin \craft\commerce\web\twig\CraftVariableBehavior - * - * @author nystudio107 - * @package nystudio107\craft - * @since 1.0.1 - */ -class FauxCraftVariable extends \craft\web\twig\variables\CraftVariable -{ -} - -/** - * Class FauxTwigExtension provides a faux Twig extension for PhpStorm to index - * so that we get Intellisense auto-complete in our Twig templates. - * - * @author nystudio107 - * @package nystudio107\craft - * @since 1.0.1 - */ -class FauxTwigExtension extends \Twig\Extension\AbstractExtension implements \Twig\Extension\GlobalsInterface -{ - public function getGlobals(): array - { - return [ - // Craft Variable - 'craft' => new FauxCraftVariable(), - // Craft Elements - 'asset' => new \craft\elements\Asset(), - 'category' => new \craft\elements\Category(), - 'entry' => new \craft\elements\Entry(), - 'tag' => new \craft\elements\Tag(), - // Craft "Constants" - 'SORT_ASC' => 4, - 'SORT_DESC' => 3, - 'SORT_REGULAR' => 0, - 'SORT_NUMERIC' => 1, - 'SORT_STRING' => 2, - 'SORT_LOCALE_STRING' => 5, - 'SORT_NATURAL' => 6, - 'SORT_FLAG_CASE' => 8, - 'POS_HEAD' => 1, - 'POS_BEGIN' => 2, - 'POS_END' => 3, - 'POS_READY' => 4, - 'POS_LOAD' => 5, - // Misc. Craft globals - 'currentUser' => new \craft\elements\User(), - 'currentSite' => new \craft\models\Site(), - 'now' => new DateTime(), - // Commerce Elements - 'lineItem' => new \craft\commerce\models\LineItem(), - 'order' => new \craft\commerce\elements\Order(), - 'product' => new \craft\commerce\elements\Product(), - // Third party globals - 'seomatic' => new \nystudio107\seomatic\variables\SeomaticVariable(), - ]; - } -} From 581897bfafb8c3f481ef3a5225f00546b658e595 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Tue, 3 Aug 2021 19:08:48 -0400 Subject: [PATCH 28/68] Handle both XDEBUG_SESSION and XDEBUG_PROFILE cookies Signed-off-by: Andrew Welch --- docker-config/nginx/default.conf | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docker-config/nginx/default.conf b/docker-config/nginx/default.conf index 926a2b1..a483bca 100755 --- a/docker-config/nginx/default.conf +++ b/docker-config/nginx/default.conf @@ -1,9 +1,11 @@ # default Docker DNS server resolver 127.0.0.11; -map $cookie_XDEBUG_SESSION $my_fastcgi_pass { +# If a cookie doesn't exist, it evaluates to an empty string, so if neither cookie exists, it'll match : +# (empty string on either side of the :), but if either or both cookies are set, it won't match, and will hit the default rule +map $cookie_XDEBUG_SESSION:$cookie_XDEBUG_PROFILE $my_fastcgi_pass { default php_xdebug; - '' php; + ':' php; } server { From 58b0cb3b4c36dd104adaa665f6801d01fa1bb616 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Tue, 3 Aug 2021 19:10:30 -0400 Subject: [PATCH 29/68] Version 2.4.47 Signed-off-by: Andrew Welch --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 26d7953..b9fdad3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # nystudio107/craft Change Log +## 2.4.47 - UNRELEASED +### Added +* Handle both `XDEBUG_SESSION` and `XDEBUG_PROFILE` cookies + ## 2.4.46 - 2021.07.29 ### Added * Added `putyourlightson/craft-autocomplete` for the Twig + Symfony plugin auto-complete, removed FauxTwigExtension.php From c91247734084ffca26f32b6928057f332ed25844 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Sat, 7 Aug 2021 14:07:16 -0400 Subject: [PATCH 30/68] Added `compiled_templates` as a bind mount in `docker-compose.yaml` for IDE autocompletion --- docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.yml b/docker-compose.yml index 4312a71..189ab89 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -34,6 +34,7 @@ services: # Specific directories that need to be bind-mounted - ./cms/storage/logs:/var/www/project/cms/storage/logs:delegated - ./cms/storage/runtime/compiled_templates:/var/www/project/cms/storage/runtime/compiled_templates:delegated + - ./cms/storage/runtime/compiled_classes:/var/www/project/cms/storage/runtime/compiled_classes:delegated - ./cms/vendor:/var/www/project/cms/vendor:delegated # php - run php-fpm with xdebug php_xdebug: From e51d9bb30c2f1ff409652fa592107f5becb43eb8 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Sat, 7 Aug 2021 14:07:24 -0400 Subject: [PATCH 31/68] Version 2.4.47 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b9fdad3..a4724b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## 2.4.47 - UNRELEASED ### Added * Handle both `XDEBUG_SESSION` and `XDEBUG_PROFILE` cookies +* Added `compiled_templates` as a bind mount in `docker-compose.yaml` for IDE autocompletion ## 2.4.46 - 2021.07.29 ### Added From a386ff30a1d1e757b5ff15bb131dd8edf0902a1a Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Sat, 7 Aug 2021 14:13:41 -0400 Subject: [PATCH 32/68] Added `nystudio107/craft-autocomplete` for autocomplete of variables in Twig templates --- cms/composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cms/composer.json b/cms/composer.json index 730b867..58853a1 100644 --- a/cms/composer.json +++ b/cms/composer.json @@ -3,7 +3,7 @@ "craftcms/cms": "^3.6.9", "vlucas/phpdotenv": "^3.4.0", "yiisoft/yii2-redis": "^2.0.6", - "putyourlightson/craft-autocomplete": "^1.0.0", + "nystudio107/craft-autocomplete": "^1.0.0", "nystudio107/craft-imageoptimize": "^1.0.0", "nystudio107/craft-fastcgicachebust": "^1.0.0", "nystudio107/craft-minify": "^1.2.5", From f2b01e49303831b5ab28ea0a53fc267009a6bc9d Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Sat, 7 Aug 2021 14:13:49 -0400 Subject: [PATCH 33/68] version 2.4.47 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a4724b2..faca67a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Added * Handle both `XDEBUG_SESSION` and `XDEBUG_PROFILE` cookies * Added `compiled_templates` as a bind mount in `docker-compose.yaml` for IDE autocompletion +* Added `nystudio107/craft-autocomplete` for autocomplete of variables in Twig templates ## 2.4.46 - 2021.07.29 ### Added From a381489c5b820ccebbc504df96aee91c84bcc4dd Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Sat, 7 Aug 2021 23:20:06 -0400 Subject: [PATCH 34/68] Version 2.4.47 Signed-off-by: Andrew Welch --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index faca67a..61d95c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # nystudio107/craft Change Log -## 2.4.47 - UNRELEASED +## 2.4.47 - 2021.08.07 ### Added * Handle both `XDEBUG_SESSION` and `XDEBUG_PROFILE` cookies * Added `compiled_templates` as a bind mount in `docker-compose.yaml` for IDE autocompletion From cd98dcca0af5dc0a3fb6fd1e27055b8ec5b152c1 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Wed, 20 Oct 2021 10:50:39 -0400 Subject: [PATCH 35/68] Updated the `Makefile` to accommodate the change in Docker to using `-` instead of `_` in container names --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index efda326..59b3057 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ -CONTAINER?=$(shell basename $(CURDIR))_php_1 -BUILDCHAIN?=$(shell basename $(CURDIR))_webpack_1 +CONTAINER?=$(shell basename $(CURDIR))-php-1 +BUILDCHAIN?=$(shell basename $(CURDIR))-webpack-1 .PHONY: build clean composer dev npm pulldb restoredb up From 84149ee0fe8e2beefb3e60f5371bb1a57d74290d Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Wed, 20 Oct 2021 10:50:50 -0400 Subject: [PATCH 36/68] Version 2.4.48 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 61d95c8..08fe440 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # nystudio107/craft Change Log +## 2.4.48 - 2021.10.20 +### Changed +* Updated the `Makefile` to accommodate the change in Docker to using `-` instead of `_` in container names + ## 2.4.47 - 2021.08.07 ### Added * Handle both `XDEBUG_SESSION` and `XDEBUG_PROFILE` cookies From 2f310dafa3b15744fbca4d8ebe64830eceddb452 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Fri, 22 Oct 2021 18:46:23 -0400 Subject: [PATCH 37/68] Move Craft Autocomplete to `require-dev` --- cms/composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cms/composer.json b/cms/composer.json index 58853a1..118dfca 100644 --- a/cms/composer.json +++ b/cms/composer.json @@ -3,7 +3,6 @@ "craftcms/cms": "^3.6.9", "vlucas/phpdotenv": "^3.4.0", "yiisoft/yii2-redis": "^2.0.6", - "nystudio107/craft-autocomplete": "^1.0.0", "nystudio107/craft-imageoptimize": "^1.0.0", "nystudio107/craft-fastcgicachebust": "^1.0.0", "nystudio107/craft-minify": "^1.2.5", @@ -15,6 +14,7 @@ "nystudio107/craft-twigpack": "^1.2.9" }, "require-dev": { + "nystudio107/craft-autocomplete": "^1.0.0", "yiisoft/yii2-shell": "^2.0.3" }, "autoload": { From 9ecf18b9f32f233c166bdb92aa0343951bfbb3b2 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Fri, 22 Oct 2021 18:46:28 -0400 Subject: [PATCH 38/68] Version 2.4.49 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 08fe440..81a3e71 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # nystudio107/craft Change Log +## 2.4.49 - UNRELEASED +### Changed +* Move Craft Autocomplete to `require-dev` + ## 2.4.48 - 2021.10.20 ### Changed * Updated the `Makefile` to accommodate the change in Docker to using `-` instead of `_` in container names From bf760a381640d4e6f673f040d1b4b487f4004acd Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Mon, 25 Oct 2021 13:31:15 -0400 Subject: [PATCH 39/68] `poll` -> `usePolling` --- buildchain/webpack-configs/dev-server.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildchain/webpack-configs/dev-server.config.js b/buildchain/webpack-configs/dev-server.config.js index 7d46534..b908159 100644 --- a/buildchain/webpack-configs/dev-server.config.js +++ b/buildchain/webpack-configs/dev-server.config.js @@ -35,7 +35,7 @@ module.exports = (type = 'modern', settings) => { directory: path.resolve(__dirname, settings.contentBase()), publicPath: '/', watch: { - poll: settings.poll() | 0, + usePolling: settings.poll() | 0, ignored: /node_modules/, }, }, From a213dd972f2fd3c483ba68bbd3d9b2515c377d62 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Mon, 25 Oct 2021 13:31:24 -0400 Subject: [PATCH 40/68] Version 2.4.49 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 81a3e71..d44634d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## 2.4.49 - UNRELEASED ### Changed * Move Craft Autocomplete to `require-dev` +* `poll` -> `usePolling` ## 2.4.48 - 2021.10.20 ### Changed From 47c97776d5e101272726e1b6d0fb0e866efdddb8 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Sat, 20 Nov 2021 01:12:32 -0500 Subject: [PATCH 41/68] feat: Use `tty: true` for nicer output in terminal from the PHP & webpack Docker containers --- docker-compose.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 189ab89..fa45725 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -27,6 +27,7 @@ services: expose: - "9000" init: true + tty: true volumes: &php-volumes - cpresources:/var/www/project/cms/web/cpresources:delegated - storage:/var/www/project/cms/storage:delegated @@ -48,6 +49,7 @@ services: expose: - "9000" init: true + tty: true volumes: *php-volumes # queue - runs queue jobs via php craft queue/listen @@ -60,6 +62,7 @@ services: env_file: *env init: true + tty: true volumes: *php-volumes # mariadb - database @@ -98,6 +101,7 @@ services: init: true ports: - "8080:8080" + tty: true volumes: - ./tsconfig.json:/var/www/project/tsconfig.json:cached - ./buildchain:/var/www/project/buildchain:cached From bd5f2e129b3d3c164b1b392d9351ed6041c9d369 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Sat, 20 Nov 2021 01:12:50 -0500 Subject: [PATCH 42/68] Version 2.4.49 --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d44634d..c4ec311 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # nystudio107/craft Change Log -## 2.4.49 - UNRELEASED +## 2.4.49 - 2021.11.20 +### Added +* Use `tty: true` for nicer output in terminal from the PHP & webpack Docker containers + ### Changed * Move Craft Autocomplete to `require-dev` * `poll` -> `usePolling` From 27815f751945b11ea852859d7c2e5d735ec473b7 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Tue, 7 Dec 2021 01:02:04 -0500 Subject: [PATCH 43/68] Use Node 16 for the webpack buildchain container --- buddy.yml | 2 +- docker-config/node-dev-webpack/Dockerfile | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/buddy.yml b/buddy.yml index 693dd91..688d77e 100644 --- a/buddy.yml +++ b/buddy.yml @@ -9,7 +9,7 @@ type: "BUILD" working_directory: "/buddy/${PROJECT_SHORTNAME}" docker_image_name: "nystudio107/node-dev-base" - docker_image_tag: "14-alpine" + docker_image_tag: "16-alpine" execute_commands: - "cd buildchain" - "npm install" diff --git a/docker-config/node-dev-webpack/Dockerfile b/docker-config/node-dev-webpack/Dockerfile index c79f1c8..2730215 100755 --- a/docker-config/node-dev-webpack/Dockerfile +++ b/docker-config/node-dev-webpack/Dockerfile @@ -1,4 +1,4 @@ -FROM nystudio107/node-dev-base:14-alpine +FROM nystudio107/node-dev-base:16-alpine WORKDIR /var/www/project/buildchain/ @@ -11,6 +11,6 @@ WORKDIR /var/www/project/buildchain/ # 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 npm install \ +CMD export CPPFLAGS="-DPNG_ARM_NEON_OPT=0" \ && \ npm run debug From edd44f4e8530b31869d3f2c1bbbbbd206ff54d41 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Tue, 7 Dec 2021 01:02:37 -0500 Subject: [PATCH 44/68] Updated the `Makefile` to accommodate _another_ change in Docker that switches back to using `_` instead of `-` in container names --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 59b3057..efda326 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ -CONTAINER?=$(shell basename $(CURDIR))-php-1 -BUILDCHAIN?=$(shell basename $(CURDIR))-webpack-1 +CONTAINER?=$(shell basename $(CURDIR))_php_1 +BUILDCHAIN?=$(shell basename $(CURDIR))_webpack_1 .PHONY: build clean composer dev npm pulldb restoredb up From fa822b65b62dd322fe14e5e9973471d512e99f14 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Tue, 7 Dec 2021 01:02:49 -0500 Subject: [PATCH 45/68] Update to latest deps --- buildchain/package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/buildchain/package.json b/buildchain/package.json index df96e06..0af211d 100644 --- a/buildchain/package.json +++ b/buildchain/package.json @@ -67,8 +67,8 @@ "compression-webpack-plugin": "^6.0.0", "copy-webpack-plugin": "^6.3.0", "create-symlink-webpack-plugin": "^1.0.0", - "critical": "^2.0.0", - "critical-css-webpack-plugin": "^2.0.0", + "critical": "^4.0.0", + "critical-css-webpack-plugin": "^3.0.0", "css-loader": "^5.0.0", "css-minimizer-webpack-plugin": "^1.1.5", "cssnano": "^4.1.0", @@ -112,7 +112,7 @@ "webpack-bundle-analyzer": "^4.3.0", "webpack-cli": "^4.3.0", "webpack-dev-server": "^4.0.0-rc.0", - "webpack-manifest-plugin": "^3.0.0", + "webpack-manifest-plugin": "^4.0.0", "webpack-merge": "^5.7.0", "workbox-webpack-plugin": "^6.0.0" }, From cf002b4c085c1df73b81deb3e7097e1138f4e57c Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Tue, 7 Dec 2021 01:04:31 -0500 Subject: [PATCH 46/68] Version 2.4.50 --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c4ec311..9ec9999 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # nystudio107/craft Change Log +## 2.4.50 - 2021.12.07 +### Changed +* Use Node 16 for the webpack buildchain container +* Updated deps for native ARM buildchain container +* Updated the `Makefile` to accommodate _another_ change in Docker that switches back to using `_` instead of `-` in container names + ## 2.4.49 - 2021.11.20 ### Added * Use `tty: true` for nicer output in terminal from the PHP & webpack Docker containers From d5bd0273d0f05b70529ab4a4aceb47fc928bfbca Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Wed, 22 Dec 2021 13:52:39 -0500 Subject: [PATCH 47/68] refactor: Updated to use a unified `bootstrap.php` --- cms/bootstrap.php | 20 ++++++++++++++++++++ cms/craft | 17 ++++------------- cms/web/index.php | 17 ++++------------- 3 files changed, 28 insertions(+), 26 deletions(-) create mode 100644 cms/bootstrap.php diff --git a/cms/bootstrap.php b/cms/bootstrap.php new file mode 100644 index 0000000..2502887 --- /dev/null +++ b/cms/bootstrap.php @@ -0,0 +1,20 @@ +safeLoad(); +} + +// Define additional PHP constants +// (see https://craftcms.com/docs/3.x/config/#php-constants) +define('CRAFT_ENVIRONMENT', getenv('ENVIRONMENT') ?: 'production'); diff --git a/cms/craft b/cms/craft index f7d775b..547e508 100755 --- a/cms/craft +++ b/cms/craft @@ -4,20 +4,11 @@ * Craft console bootstrap file */ -// Set path constants -define('CRAFT_BASE_PATH', __DIR__); -define('CRAFT_VENDOR_PATH', CRAFT_BASE_PATH.'/vendor'); - -// Load Composer's autoloader -require_once CRAFT_VENDOR_PATH.'/autoload.php'; - -// Load dotenv? -if (class_exists('Dotenv\Dotenv') && file_exists(CRAFT_BASE_PATH.'/.env')) { - Dotenv\Dotenv::create(CRAFT_BASE_PATH)->load(); -} +// Load shared bootstrap +require __DIR__ . '/bootstrap.php'; // Load and run Craft -define('CRAFT_ENVIRONMENT', getenv('ENVIRONMENT') ?: 'production'); -$app = require CRAFT_VENDOR_PATH.'/craftcms/cms/bootstrap/console.php'; +/** @var craft\console\Application $app */ +$app = require CRAFT_VENDOR_PATH . '/craftcms/cms/bootstrap/console.php'; $exitCode = $app->run(); exit($exitCode); diff --git a/cms/web/index.php b/cms/web/index.php index b310965..774c24f 100644 --- a/cms/web/index.php +++ b/cms/web/index.php @@ -3,19 +3,10 @@ * Craft web bootstrap file */ -// Set path constants -define('CRAFT_BASE_PATH', dirname(__DIR__)); -define('CRAFT_VENDOR_PATH', CRAFT_BASE_PATH.'/vendor'); - -// Load Composer's autoloader -require_once CRAFT_VENDOR_PATH.'/autoload.php'; - -// Load dotenv? -if (class_exists('Dotenv\Dotenv') && file_exists(CRAFT_BASE_PATH.'/.env')) { - Dotenv\Dotenv::create(CRAFT_BASE_PATH)->load(); -} +// Load shared bootstrap +require dirname(__DIR__) . '/bootstrap.php'; // Load and run Craft -define('CRAFT_ENVIRONMENT', getenv('ENVIRONMENT') ?: 'production'); -$app = require CRAFT_VENDOR_PATH.'/craftcms/cms/bootstrap/web.php'; +/** @var craft\web\Application $app */ +$app = require CRAFT_VENDOR_PATH . '/craftcms/cms/bootstrap/web.php'; $app->run(); From 601e4b29ead21a6a05422e3476babe5fc58a8753 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Wed, 22 Dec 2021 13:52:50 -0500 Subject: [PATCH 48/68] refactor: Updated to use `vlucas/phpdotenv` `^5.4.0` --- cms/composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cms/composer.json b/cms/composer.json index 118dfca..30b5c62 100644 --- a/cms/composer.json +++ b/cms/composer.json @@ -1,7 +1,7 @@ { "require": { "craftcms/cms": "^3.6.9", - "vlucas/phpdotenv": "^3.4.0", + "vlucas/phpdotenv": "^5.4.0", "yiisoft/yii2-redis": "^2.0.6", "nystudio107/craft-imageoptimize": "^1.0.0", "nystudio107/craft-fastcgicachebust": "^1.0.0", From d16f381aee69b1ca7bd2b1311bbb8f31e1bd4797 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Wed, 22 Dec 2021 13:53:01 -0500 Subject: [PATCH 49/68] chore: Version 2.4.50 --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ec9999..4343b86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # nystudio107/craft Change Log +## 2.4.50 - 2021.12.22 +### Changed +* Updated to use a unified `bootstrap.php` +* Updated to use `vlucas/phpdotenv` `^5.4.0` + ## 2.4.50 - 2021.12.07 ### Changed * Use Node 16 for the webpack buildchain container From 19afc875cae92dd8cf562fa5e9389c16a296396a Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Wed, 22 Dec 2021 14:08:18 -0500 Subject: [PATCH 50/68] feat: Updated to Tailwind CSS `^3.0.0` --- buildchain/package.json | 2 +- buildchain/tailwind.config.js | 25 ++++--------------- .../webpack-configs/postcss-loader.config.js | 4 +-- 3 files changed, 8 insertions(+), 23 deletions(-) diff --git a/buildchain/package.json b/buildchain/package.json index 0af211d..8c1b698 100644 --- a/buildchain/package.json +++ b/buildchain/package.json @@ -38,7 +38,6 @@ "core-js": "^3.0.0", "lazysizes": "^5.2.2", "regenerator-runtime": "^0.13.2", - "tailwindcss": "^2.1.0", "vue": "^3.0.0", "vue-confetti": "^2.0.8" }, @@ -102,6 +101,7 @@ "stylelint": "^13.7.0", "stylelint-config-recommended": "^3.0.0", "symlink-webpack-plugin": "^0.0.4", + "tailwindcss": "^3.0.0", "terser-webpack-plugin": "^5.0.0", "ts-loader": "^8.0.0", "tsconfig-paths-webpack-plugin": "^3.3.0", diff --git a/buildchain/tailwind.config.js b/buildchain/tailwind.config.js index 219a3dc..0269fee 100644 --- a/buildchain/tailwind.config.js +++ b/buildchain/tailwind.config.js @@ -1,26 +1,11 @@ // module exports module.exports = { - mode: 'jit', - purge: { - content: [ - '../cms/templates/**/*.{twig,html}', - '../src/vue/**/*.{vue,html}', - ], - layers: [ - 'base', - 'components', - 'utilities', - ], - mode: 'layers', - options: { - } - }, + content: [ + '../cms/templates/**/*.{twig,html}', + '../src/vue/**/*.{vue,html}', + '../src/css/components/**/*.css', + ], theme: { - // Extend the default Tailwind config here - extend: { - }, - // Replace the default Tailwind config here }, - corePlugins: {}, plugins: [], }; diff --git a/buildchain/webpack-configs/postcss-loader.config.js b/buildchain/webpack-configs/postcss-loader.config.js index debf85f..3056865 100644 --- a/buildchain/webpack-configs/postcss-loader.config.js +++ b/buildchain/webpack-configs/postcss-loader.config.js @@ -37,11 +37,11 @@ module.exports = (type = 'modern', settings) => { ['postcss-import', { path: ['./node_modules'], }], + ['tailwindcss/nesting', { + }], TailwindCss('./tailwind.config.js'), ['postcss-mixins', { }], - ['postcss-nested', { - }], ['postcss-hexrgba', { }], ...postCssPlugins, From 1a24b0966164d1fc24cd7c8c073800d7a35b4ce5 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Wed, 22 Dec 2021 14:09:13 -0500 Subject: [PATCH 51/68] chore: Version 2.4.51 --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4343b86..f7b1a61 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,10 @@ # nystudio107/craft Change Log -## 2.4.50 - 2021.12.22 +## 2.4.51 - 2021.12.22 ### Changed * Updated to use a unified `bootstrap.php` * Updated to use `vlucas/phpdotenv` `^5.4.0` +* Updated to Tailwind CSS `^3.0.0` ## 2.4.50 - 2021.12.07 ### Changed From a662bd79783ae898b6709342a0f358ffa756af34 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Sat, 25 Dec 2021 14:29:54 -0500 Subject: [PATCH 52/68] fix: Fix Composer 2.2.0 error by adding `allow-plugins` --- cms/composer.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cms/composer.json b/cms/composer.json index 30b5c62..9e71244 100644 --- a/cms/composer.json +++ b/cms/composer.json @@ -23,6 +23,10 @@ } }, "config": { + "allow-plugins": { + "craftcms/plugin-installer": true, + "yiisoft/yii2-composer": true + }, "optimize-autoloader": true, "sort-packages": true, "platform": { From 94d1fa4421632e3e8881b3688d666c8a66dd0e15 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Sat, 25 Dec 2021 14:32:18 -0500 Subject: [PATCH 53/68] chore: Version 2.4.52 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f7b1a61..a6277e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # nystudio107/craft Change Log +## 2.4.52 - 2021.12.25 +### Fixed +* Fix Composer [2.2.0 error](https://getcomposer.org/doc/06-config.md#allow-plugins) by adding `allow-plugins` + ## 2.4.51 - 2021.12.22 ### Changed * Updated to use a unified `bootstrap.php` From bad5f5fcd24aaa520ecee3f1c99abe658fd47e1c Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Sat, 25 Dec 2021 15:25:19 -0500 Subject: [PATCH 54/68] fix: Fix node-dev-webpack/Dockerfile so npm install is run --- docker-config/node-dev-webpack/Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker-config/node-dev-webpack/Dockerfile b/docker-config/node-dev-webpack/Dockerfile index 2730215..cac42ae 100755 --- a/docker-config/node-dev-webpack/Dockerfile +++ b/docker-config/node-dev-webpack/Dockerfile @@ -12,5 +12,7 @@ WORKDIR /var/www/project/buildchain/ # but saves far more time in not having to deal with out of sync versions # when working with teams or multiple environments CMD export CPPFLAGS="-DPNG_ARM_NEON_OPT=0" \ + && \ + npm install \ && \ npm run debug From da0cfeccf753b7ad5b782ef1ca764f9fa3a34dd0 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Sat, 25 Dec 2021 15:26:30 -0500 Subject: [PATCH 55/68] chore: Version 2.4.53 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a6277e9..4fb5cd4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # nystudio107/craft Change Log +## 2.4.53 - 2021.12.25 +### Fixed +* Fix `node-dev-webpack/Dockerfile` so `npm install` is run + ## 2.4.52 - 2021.12.25 ### Fixed * Fix Composer [2.2.0 error](https://getcomposer.org/doc/06-config.md#allow-plugins) by adding `allow-plugins` From 95122bee8657affa39b107269e47f58f80d43fd9 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Sat, 25 Dec 2021 16:01:26 -0500 Subject: [PATCH 56/68] fix: Fixed an issue with Critical CSS not generating properly out of the box --- buildchain/webpack-configs/critical.config.js | 1 - buildchain/webpack-settings/app.settings.js | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/buildchain/webpack-configs/critical.config.js b/buildchain/webpack-configs/critical.config.js index f6b00a2..159fe2f 100644 --- a/buildchain/webpack-configs/critical.config.js +++ b/buildchain/webpack-configs/critical.config.js @@ -16,7 +16,6 @@ module.exports = (type = 'modern', settings) => { target: criticalDest, extract: false, inline: false, - minify: true, width: settings.critical.criticalWidth, height: settings.critical.criticalHeight, }) diff --git a/buildchain/webpack-settings/app.settings.js b/buildchain/webpack-settings/app.settings.js index f90668f..c19b548 100644 --- a/buildchain/webpack-settings/app.settings.js +++ b/buildchain/webpack-settings/app.settings.js @@ -25,7 +25,7 @@ module.exports = { dist: path.resolve('../cms/web/dist/'), }, urls: { - criticalCss: 'http://example.test/', + criticalCss: 'http://webpack:8080/', publicPath: () => process.env.PUBLIC_PATH || '/dist/', }, }; From 9ceceb73c0b1c44819b25758ab21d20df7a0250a Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Sat, 25 Dec 2021 16:01:33 -0500 Subject: [PATCH 57/68] chore: Version 2.4.54 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4fb5cd4..8de153b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # nystudio107/craft Change Log +## 2.4.54 - 2021.12.25 +### Fixed +* Fixed an issue with Critical CSS not generating properly out of the box + ## 2.4.53 - 2021.12.25 ### Fixed * Fix `node-dev-webpack/Dockerfile` so `npm install` is run From 19697cf68a19b65365faba136db3cd4bd1525d51 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Fri, 7 Jan 2022 22:37:03 -0500 Subject: [PATCH 58/68] chore: Version 2.4.55 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8de153b..b1e7f00 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # nystudio107/craft Change Log +## 2.4.55 - 2022.01.07 +### Fixed +* fix: Use `su-exec www-data` in the Makefile so `craft` and `composer` commands are not run as root + ## 2.4.54 - 2021.12.25 ### Fixed * Fixed an issue with Critical CSS not generating properly out of the box From edbd2eb1012b3b34b2e07294dbdff0818f89ffc8 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Fri, 7 Jan 2022 22:37:10 -0500 Subject: [PATCH 59/68] fix: Use `su-exec www-data` in the Makefile so `craft` and `composer` commands are not run as root --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index efda326..128ba9f 100644 --- a/Makefile +++ b/Makefile @@ -9,10 +9,10 @@ clean: docker-compose down -v docker-compose up --build composer: up - docker exec -it ${CONTAINER} composer \ + docker exec -it ${CONTAINER} su-exec www-data composer \ $(filter-out $@,$(MAKECMDGOALS)) craft: up - docker exec -it ${CONTAINER} php craft \ + docker exec -it ${CONTAINER} su-exec www-data php craft \ $(filter-out $@,$(MAKECMDGOALS)) dev: up npm: up From 630a6647a3a26be5ae3d9b0a81242d8847af859d Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Thu, 20 Jan 2022 22:39:27 -0500 Subject: [PATCH 60/68] refactor: Run as "node" --- docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.yml b/docker-compose.yml index fa45725..d114208 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -102,6 +102,7 @@ services: ports: - "8080:8080" tty: true + user: "node" volumes: - ./tsconfig.json:/var/www/project/tsconfig.json:cached - ./buildchain:/var/www/project/buildchain:cached From 117a2e8bf1b305d8e9fb7c0593e480db274b032f Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Thu, 20 Jan 2022 23:36:28 -0500 Subject: [PATCH 61/68] fix: Fix USER node --- docker-compose.yml | 1 - docker-config/node-dev-webpack/Dockerfile | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index d114208..fa45725 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -102,7 +102,6 @@ services: ports: - "8080:8080" tty: true - user: "node" volumes: - ./tsconfig.json:/var/www/project/tsconfig.json:cached - ./buildchain:/var/www/project/buildchain:cached diff --git a/docker-config/node-dev-webpack/Dockerfile b/docker-config/node-dev-webpack/Dockerfile index cac42ae..81d39d1 100755 --- a/docker-config/node-dev-webpack/Dockerfile +++ b/docker-config/node-dev-webpack/Dockerfile @@ -1,5 +1,7 @@ FROM nystudio107/node-dev-base:16-alpine +USER node + WORKDIR /var/www/project/buildchain/ # Run our webpack build in debug mode From 325d71078938c7b81bbdf3a00c01f459c0d85fa8 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Sat, 19 Mar 2022 17:29:34 -0400 Subject: [PATCH 62/68] chore: Version 2.5.0 --- CHANGELOG.md | 292 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 281 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b1e7f00..8061fb3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,151 +1,230 @@ # nystudio107/craft Change Log +## 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 +* Significantly increased startup times via a `npm_install.sh` script that only runs `npm install` at container startup time if `package-lock.json` or `node_modules/` is missing + +### Changed +* Run migrations / project config changes via the `run_queue.sh` script, only after the db container responds +* refactor: Remove `tty: true` which causes console output to not appear in Docker Composer API 2.3.0. ref: https://github.com/docker/compose/issues/9288 + ## 2.4.55 - 2022.01.07 + ### Fixed + * fix: Use `su-exec www-data` in the Makefile so `craft` and `composer` commands are not run as root ## 2.4.54 - 2021.12.25 + ### Fixed + * Fixed an issue with Critical CSS not generating properly out of the box ## 2.4.53 - 2021.12.25 + ### Fixed + * Fix `node-dev-webpack/Dockerfile` so `npm install` is run ## 2.4.52 - 2021.12.25 + ### Fixed + * Fix Composer [2.2.0 error](https://getcomposer.org/doc/06-config.md#allow-plugins) by adding `allow-plugins` ## 2.4.51 - 2021.12.22 + ### Changed + * Updated to use a unified `bootstrap.php` * Updated to use `vlucas/phpdotenv` `^5.4.0` * Updated to Tailwind CSS `^3.0.0` ## 2.4.50 - 2021.12.07 + ### Changed + * Use Node 16 for the webpack buildchain container * Updated deps for native ARM buildchain container -* Updated the `Makefile` to accommodate _another_ change in Docker that switches back to using `_` instead of `-` in container names +* Updated the `Makefile` to accommodate _another_ change in Docker that switches back to using `_` instead of `-` in + container names ## 2.4.49 - 2021.11.20 + ### Added + * Use `tty: true` for nicer output in terminal from the PHP & webpack Docker containers ### Changed + * Move Craft Autocomplete to `require-dev` * `poll` -> `usePolling` ## 2.4.48 - 2021.10.20 + ### Changed + * Updated the `Makefile` to accommodate the change in Docker to using `-` instead of `_` in container names ## 2.4.47 - 2021.08.07 + ### Added + * Handle both `XDEBUG_SESSION` and `XDEBUG_PROFILE` cookies * Added `compiled_templates` as a bind mount in `docker-compose.yaml` for IDE autocompletion * Added `nystudio107/craft-autocomplete` for autocomplete of variables in Twig templates ## 2.4.46 - 2021.07.29 + ### Added + * Added `putyourlightson/craft-autocomplete` for the Twig + Symfony plugin auto-complete, removed FauxTwigExtension.php ## 2.4.45 - 2021.07.20 + ### Fixed + * Add `publicPath` back in, and fix `allowedHosts` location in the config ## 2.4.44 - 2021.07.20 + ### Fixed + * Fix breaking changes due to `webpack-dev-server` `^4.0.0-rc.0` ## 2.4.43 - 2021.07.19 + ### Changed + * Remove `storage/` dir ## 2.4.42 - 2021.06.22 + ### Changed -* Continue running the `php-fpm` containers as root (since `php-fpm` uses worker pools with the proper user/group), but switch to `su-exec` to ensure any craft CLI commands are run as `www-data` + +* Continue running the `php-fpm` containers as root (since `php-fpm` uses worker pools with the proper user/group), but + switch to `su-exec` to ensure any craft CLI commands are run as `www-data` ## 2.4.41 - 2021.06.15 + ### Fixed + * Fixed typo in Dockerfile that would cause the PHP container to not build ## 2.4.40 - 2021.06.15 + ### Changed + * Removed `USER` directive in the PHP containers, since the pool runs as `www-data` already * Fix permissions regression ## 2.4.39 - 2021.06.11 + ### Changed + * Removed whitelist settings in `tailwind.conf.js` * Cleaned up the `php-dev-craft` & `php-prod-craft` Dockerfile file permissions ## 2.4.38 - 2021.05.23 + ### Changed + * Run php container as the `www-data` user to avoid permissions issues ## 2.4.37 - 2021.05.14 + ### Changed + * Added `logs` and `compiled_templates` dirs back in, so they appear on the client side ## 2.4.36 - 2020.05.09 + ### Changed + * Silence errors from the root `post-create-project-cmd` script ### Fixed + * Fixed a breaking change of `dev` to `devMiddleware` in `webpack-dev-server` `^4.0.0-beta.3` ## 2.4.35 - 2021.04.27 + ### Changed + * Delegate all of `storage` & `cpresources` volumes, let the container own it ## 2.4.34 - 2021.04.10 + ### Added + * Added `make craft` to the Makefile commands ## 2.4.33 - 2021.04.06 + ### Changed + * Use `rm -f` to ensure no errors if the file doesn’t exist ## 2.4.32 - 2021.04.05 + ### Changed + * Use Tailwind CSS `^2.1.0` with JIT ## 2.4.31 - 2021.04.05 + ### Added + * Added `make update` to update Composer & NPM packages * Added `make update-clean` to completely remove `vendor/` and `node_modules/`, then update Composer & NPM packages ## 2.4.30 - 2021.04.05 + ### Fixed + * Fixed `make up` command by removing an errant `$` * Add `storage/config-deltas/` to prevent permissions issues ## 2.4.29 - 2021.03.25 + ### Added + * Added `make clean` to the Makefile * Added **Makefile Project Commands** to `README.md` * Added `make composer xxx` & `make npm xxx` commands ### Changed + * Remove deprecated `scripts/docker_prod_build.sh` in favor of `make build` ## 2.4.28 - 2021.03.24 + ### Fixed -* Fixed an issue with the `webpack-dev-server` version `^4.0.0-beta.1` by moving the `overlay` config setting to `client` (https://github.com/nystudio107/craft/issues/54) + +* Fixed an issue with the `webpack-dev-server` version `^4.0.0-beta.1` by moving the `overlay` config setting + to `client` (https://github.com/nystudio107/craft/issues/54) ## 2.4.27 - 2021.03.22 + ### Added + * Added `make` command aliases ### Changed + * Use `@tailwindcss/jit` for the CSS generation ### Fixed + * Fix webpack buildchain pipeline ## 2.4.26 - 2021.03.07 + ### Changed + * Use aliases for import paths * Remove version, require, autoload, and config from the project `composer.json` * Use Tailwind CSS `^2.0.3` @@ -154,458 +233,647 @@ * Updated db-seed & Project Config to match `craftcms/cms` version `^3.6.7` ## 2.4.25 - 2021.02.09 + ### Added + * Use PHP 8.0 Alpine images for the prod & dev containers ### Changed + * Ensure that the `cms/config` directory has the right permissions ### Fixed + * Updated `buddy.yaml` to match with Alpine update ## 2.4.24 - 2021.02.03 + ### Fixed + * Fixed an issue with favicon generation caused by changes in `favicons-webpack-plugin` ## 2.4.23 - 2021.02.02 + ### Changed + * Use `get-webpack-config` package ## 2.4.22 - 2021.02.02 + ### Fixed + * Fix setting that’d cause HMR to fail to work unless a production build existed ## 2.4.21 - 2021.02.02 + ### Changed + * Changed `return 0` to `exit 0` in the `composer.json` scripts ### Fixed + * Fixed an issue where the default ImageOptimize transform was set to ServerlessSharp, causing mayhem and confusion ## 2.4.20 - 2021.01.27 + ### Changed + * Changed `--interactive 0` to `--interactive=0` just for consistency (either works) ## 2.4.19 - 2021.01.27 + ### Added + * Added Docker bind mount for `compiled_templates` so XDebug can be used with Twig templates ### Changed + * Remove vestigial `HotModuleReplacementPlugin` * Set `--interactive=0` on console commands in the `composer.json` to force non-interactivity for CI commands ## 2.4.18 - 2021.01.21 + ### Changed + * Set the minimum platform reqs to PHP `7.2.5` ## 2.4.17 - 2021.01.14 + ### Changed + * Clean up AMP CSS approach * Change AMP CSS URL to a path, so we can include it server-side * Strip `!important` rules from AMP CSS * Clean up critical CSS config ## 2.4.16 - 2021.01.12 + ### Changed + * `gzip` the seed database * Update to deps required for `favicons-webpack-plugin` `^5.0.0-alpha.4` ## 2.4.15 - 2021.01.09 + ### Changed + * Update to Axios `^0.21.1` * Tabs -> Spaces in the Dockerfiles ## 2.4.14 - 2021.01.04 + ### Changed + * Use slimmed down Alpine images for Docker * Added `--no-install-recommends` to all `apt-get install` commands * Put complete output in each config * Remove `imagemin-gifsicle` due to build issues (and also we rarely use `.gif` files) ## 2.4.13 - 2020.12.21 + ### Changed + * Refactored `output.path` to `app.config.js` * Remove unused base Docker configs * Use PHP 7.4 ## 2.4.12 - 2020.12.17 + ### Added + * Added some useful PostCSS plugins ### Changed + * Don't try to remove `vendor/` after project install * Use named `chunkIds` * Allow HMR through Craft CMS error pages by including the now-separate `runtime.js` ## 2.4.11 - 2020.12.06 + ### Changed + * Ensure poll is always an integer * Updated seed db ## 2.4.10 - 2020.12.05 + ### Changed + * Updated to latest buildchain semver deps ## 2.4.9 - 2020.12.05 + ### Changed + * config/redactor/Standard.json β†’ Default.json * Unlicense β†’ BSD Zero Clause License ### Fixed + * Fixed import WebpackManifestPlugin from webpack-manifest-plugin 3.x * Fixed craftcms/redactor#278 ## 2.4.8 - 2020.11.30 + ### Added + * Added `nodemon` so `webpack-dev-server` will automatically restart if we change any of the webpack configs ### Changed + * Use `webpack-dev-server` version `^4.0.0-beta.0` for additional speed & better webpack 5 support ## 2.4.7 - 2020.11.26 + ### Changed + * Remove `postcss-preset-env`, add `autoprefixer` & `postcss-nested` ## 2.4.6 - 2020.11.25 + ### Changed + * Change `mysql-client` to `mariadb-client` ## 2.4.5 - 2020.11.25 + ### Added + * Add `mysql-client` in the `php-dev-craft` & `php-prod-craft` MariaDB containers so we get `mysqldump` * Added image optimization tools to the `php-dev-craft` & `php-prod-craft` MariaDB containers ## 2.4.4 - 2020.11.21 + ### Changed + * Ignore `/admin` routes in the Service Worker ## 2.4.3 - 2020.11.17 + ### Fixed -* Removed `xdebug.remote_connect_back` from the `php-dev-base` container's `xdebug.ini` file to allow xdebug to connect properly + +* Removed `xdebug.remote_connect_back` from the `php-dev-base` container's `xdebug.ini` file to allow xdebug to connect + properly ## 2.4.2 - 2020.11.11 + ### Fixed + * Removed unused `path` attribute passed to `MiniCssExtractPlugin` in the `production.config.js` ## 2.4.1 - 2020.11.11 + ### Changed + * Sync Craft version ## 2.4.0 - 2020.11.10 + ### Added + * Updated buildchain to a modular webpack config system, using webpack 5 & PostCSS 8 * Added `yiisoft/yii2-shell` to `require-dev` * Add `--no-dev --no-progress` to the composer install command ### Changed + * Ignore Nginx requests for `favicon.ico` * Removed deprecated `links` from `docker-compose.yaml` * Use Composer 2.x ## 2.3.14 - 2020.10.25 + ### Added + * Added `/cms/web/dist/*` to root `.gitignore` -* Use a separate `php_xdebug` container only when the `XDEBUG_SESSION` cookie is set, so regular requests are more performant +* Use a separate `php_xdebug` container only when the `XDEBUG_SESSION` cookie is set, so regular requests are more + performant ## 2.3.13 - 2020.09.25 + ### Added + * Add `run_queue.sh` keep alive script ## 2.3.12 - 2020.09.25 + ### Added + * Added a `db-seed` directory, and moved the `seed_db.sql` there * Added `--set-gtid-purged=OFF` to the `common_mysql.sh` to avoid permissions issues with some database dumps * Explicitly set the `user` that the PHP & queue containers run as to `www-data` + ### Changed + * Removed unneeded `composer dump-autoload` from the project `composer.json` ## 2.3.11 - 2020.09.15 + ### Changed + * Explicitly set `id` from APP_ID and use `keyPrefix` for cache component * Add docker_prod_build script ## 2.3.10 - 2020.09.10 + ### Changed + * Sessions should use `REDIS_DEFAULT_DB` ## 2.3.9 - 2020.09.09 + ### Changed + * Better nginx config for local dev, based on `nystudio107/nginx` ## 2.3.8 - 2020.09.09 + ### Added + * Added a `queue` docker container to run queue jobs via `./craft queue/listen` ### Changed + * Removed `dotenvy` * Removed https://repo.repman.io from `repositories` ## 2.3.7 - 2020.09.07 + ### Changed + * Remove the use of `craft on` and `craft off` because they create pointless `dateUpdated` changes to `project.yaml` ## 2.3.6 - 2020.09.05 + ### Added + * Added image optimizers to the `php-dev-craft` Docker image * Added the default `DB_PORT` of `3306` to `example.env` and `example.env.sh` ### Changed + * Updated the `css-loader` config to ignore embedded URLs ## 2.3.5 - 2020.09.02 + ### Changed + * Changed `project-config/sync` -> `project-config/apply` * Updated the `buddy.yaml` with the latest Prep Craft script ## 2.3.4 - 2020.09.02 + ### Added + * Added a `queue` component with a longer `ttr` ### Changed + * Refactor composer scripts to handle Craft not being installed, leveraging craft `install/check` * Boilerplate now requires `craftcms/cms` `^3.5.8` ## 2.3.3 - 2020.08.13 + ### Fixed -* Modern config only for local dev, [fixing multi-compiler issues](https://github.com/webpack/webpack-dev-server/issues/2355) with HRM + +* Modern config only for local + dev, [fixing multi-compiler issues](https://github.com/webpack/webpack-dev-server/issues/2355) with HRM ## 2.3.2 - 2020.08.12 + ### Changed -* Remove `[hash]` from dev config to eliminate potential [memory errors](https://github.com/webpack/webpack-dev-server/issues/438) -* Use `[contenthash]` in production instead of [hash or chunkhash](https://github.com/webpack/webpack.js.org/issues/2096) + +* Remove `[hash]` from dev config to eliminate + potential [memory errors](https://github.com/webpack/webpack-dev-server/issues/438) +* Use `[contenthash]` in production instead + of [hash or chunkhash](https://github.com/webpack/webpack.js.org/issues/2096) ## 2.3.1 - 2020.08.10 + ### Added + * Added `init` to the `docker-compose.yml` to processes are sent signals * Added `--no-tablespaces` to the mysqldump command options to work around changes in MySQL ### Fixed + * Fix redis session config to use `App::sessionConfig()` ## 2.3.0 - 2020.08.02 + ### Added + * Add native image lazy loading * Slim Docker containers after build ### Fixed + * Refactored Docker config to use more sane contexts during builds, speeding up build time immensely 🎩 Patrick * Change `throwExceptions` deprecator config to use `App::env('DEV_MODE')` ## 2.2.13 - 2020.07.18 + ### Changed + * Disable the ForkTS plugins for now ## 2.2.12 - 2020.07.18 + ### Added + * Added TypeScript support * Use Vue.js 3.0 * Added `buddy.yml` for atomic deployments ### Changed + * Replaced moment with vanilla JavaScript * Replaced `getenv()` with `App::env()` * No longer use DSN for db connections * Switch from TSLint to ESLint ### Fixed + * Fixed config path in the module `helpers/Config.php` ## 2.2.11 - 2020.05.26 + ### Changed + * Use DSN for database connections ## 2.2.10 - 2020.05.20 + ### Added + * Added baked-in support for xdebug ### Changed + * Always do a `composer install` & `npm install` when starting up via `docker-compose up` ### Fixed + * Fixed tab handler not adding the class to the `` ## 2.2.9 - 2020.04.14 + ### Added -* Added support for repo.repman.io Packagist proxy global CDN + +* Added support for repo.repman.io Packagist proxy global CDN ### Changed + * Use the CSS hash for Critical CSS cookie value ### Fixed + * Fixed Asset Bundle namespace casing ## 2.2.8 - 2020.03.30 + ### Changed + * Remove project `composer.lock` file * Use separate app config files for web/console requests ## 2.2.7 - 2020.03.27 + ### Changed + * Removed `SITE_NAME` from the `.env` vars; it's not a secret, and it doesn't change per environment ## 2.2.6 - 2020.03.27 + ### Changed + * Remove Craft & Plugin Licenses from .env β€” not necessary except for public repos ## 2.2.5 - 2020.03.27 + ### Changed + * Synced up the `project.yaml` with the `seed_db.sql` so it can properly propagate * Added a default `SECURITY_KEY` in `example.env` ## 2.2.4 - 2020.03.27 + ### Changed + * Skip a superfluous copy operation in the Nginx container ## 2.2.3 - 2020.03.21 + ### Changed + * Added `SERVERLESS_SHARP_CLOUDFRONT_URL` to the `example.env` * Added plugin licenses environment variables to `project.yaml` * Added `SERVERLESS_SHARP_CLOUDFRONT_URL` to the ImageOptimized default settings in `project.yaml` ## 2.2.2 - 2020.03.18 + ### Added + * Added `seed_db.sql` to seed the initial database ### Changed + * Numerous setup changes/tweaks ## 2.2.1 - 2020.03.17 + ### Changed + * Switch base config setup to MariaDB instead of Postgres ## 2.2.0 - 2020.03.16 + ### Changed + * Switch to Docker for local dev ## 2.1.1 - 2020.02.28 + ### Changed + * Remove `craft.twigpack.includeCssRelPreloadPolyfill()` * Use a regular function for our ServiceWorker registration JS, because IE11 * Remove the `include` setting from `configureBabelLoader()` * Add `sourceType: 'unambiguous'` to better handle different types of modules ## 2.1.0 - 2020.02.24 + ### Changed + * Set `'defaultTokenDuration' => 'P2W'` in `config/general.php` for longer preview tokens ## 2.0.4 - 2020.02.05 + ### Added + * Added `settings.babelLoaderConfig.include` ### Changed -* Removed entirely the concept of a "modern" and "legacy" build from the `webpack.dev.js`; we don't need legacy builds with `webpack-dev-server` + +* Removed entirely the concept of a "modern" and "legacy" build from the `webpack.dev.js`; we don't need legacy builds + with `webpack-dev-server` ### Fixed + * Changed deprecated use of `cacheFirst` to `CacheFirst` in the Workbox config ## 2.0.3 - 2019.08.29 + ### Added + * Added a default `config/project.yaml` for base setup ### Changed + * Updated `.gitignore` and `.env.example` * Ignore CP and `.php` for Service Worker runtime caching * Remove `siteUrl`, since it is now set via Project Config ## 2.0.2 - 2019.08.17 + ### Changed + * Added `maxUploadFileSize` to `general.php` * Added `/web/dist/*` to `.gitignore` * Refactored the error pages out to a single channel * Added generic login image background ## 2.0.1 - 2019.08.15 + ### Changed + * Numerous template changes to get the base build working ## 2.0.0 - 2019.08.14 + ### Changed + * Updated to use modern webpack config * Updated to use Craft 3.2 as the baseline ## 1.0.16 - 2018.05.24 + ### Changed + * Removed references to the Craft RC in the `composer.json` * Added SEOmatic to the list of base plugins * Change the Critical CSS loader to `onload="this.onload=null;this.rel='stylesheet'"` for IE 11 compatibility ## 1.0.15 - 2018.02.19 + ### Changed + * Updated `composer.json` to reflect the updated dependencies * Fixed the site module's controller namespacing * Added `sort-packages` to the `composer.json` * Added `async-queue` plugin ## 1.0.14 - 2018.02.01 + ### Changed + * Fixed composer dependencies to reflect the `nystudio107/craft-` renaming ## 1.0.13 - 2018.01.26 + ### Changed + * Tell Composer to install PHP 7.0-compatible dependencies * Fixed `sitemodule` namespacing ## 1.0.12 - 2018.01.25 + ### Changed + * Switched from `craft.app.config.general.custom.baseUrl` to `alias('@baseUrl')` ## 1.0.11 - 2018.01.23 + ### Added + * Added `post-install-cmd` to `composer.json` ## 1.0.10 - 2018.01.18 + ### Changed + * Synced the `modules/site` with `site-module` and pluginfactory.io generated modules ## 1.0.9 - 2018.01.06 + ### Added + * Added a static asset filename-based cache busting `LocalValetDriver.php` for Laravel Valet ## 1.0.8 - 2018.01.01 + ### Added + * Added a better PurgeCSS pipeline * Added a `purgecssWhitelist` to `package.json` * Execute JavaScript when doing Critical CSS * Added a `criticalWhitelist` to `package.json` * Added SiteModule framework to nystudio107/craft -* Added a `post-update-cmd` to `composer.json` to recreate any symlinks that may have been removed after a `composer update` or `composer install` +* Added a `post-update-cmd` to `composer.json` to recreate any symlinks that may have been removed after + a `composer update` or `composer install` ## 1.0.7 - 2017.12.16 + ### Added + * Added `purgecss` to production builds * Added automatic incrementing of `staticAssetsVersion` for production builds ## 1.0.6 - 2017.12.16 + ### Changed + * Updated to use the latest `critical` package, adjusted `gulpfile.js` base path ## 1.0.5 - 2017.12.13 + ### Changed + * Slurp whitespace with the minify tags * Fix favicon URLs/meta * Fix manifest ## 1.0.4 - 2017.12.06 + ### Changed + * Fixed asset versioning in `sw.js` * Run all inline JavaScript through `js-babel` for ES6 goodness ### Added + * Added base VueJS and Axios support ## 1.0.3 - 2017.12.05 + ### Changed + * Updated for Craft CMS 3 RC1 release ## 1.0.2 - 2017.12.04 + ### Changed + * Fixed deprecation errors * Cleaned up the default ServiceWorker in `sw.js` * Added Fontello CSS to the `package.json` * Added PhpStorm Craft app API type hinting ## 1.0.1 - 2017.12.01 + ### Added + * Added accessible tabhandler.js * Added Tailwind CSS * Added support for Redis via `app.php` @@ -614,7 +882,9 @@ * Added `src/conf/` for Nginx or other configuration files ## 1.0.0 - 2017.11.26 + ### Added + * Initial release Brought to you by [nystudio107](https://nystudio107.com/) From 16c388a2aa021a68ed4bc224bce47b33e5f68b7d Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Sat, 19 Mar 2022 17:30:50 -0400 Subject: [PATCH 63/68] refactor: refactor: Remove `spaceless` from the root template for easier debugging --- cms/templates/_layouts/global-variables.twig | 42 ++++++++++---------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/cms/templates/_layouts/global-variables.twig b/cms/templates/_layouts/global-variables.twig index 7f7785e..e1eb315 100644 --- a/cms/templates/_layouts/global-variables.twig +++ b/cms/templates/_layouts/global-variables.twig @@ -1,25 +1,23 @@ -{# -- Root global variables that all templates inherit from -- #} -{# -- This allows for defining site-wide Twig variables as needed -- #} -{# - β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” - β”‚ β”‚ - β”‚ β”‚ - β”‚ β”‚ - β”‚ htmlPage β”‚ - β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ -#} -{% spaceless %} +{% spaceless %}{# -- Root global variables that all templates inherit from -- #} + {# -- This allows for defining site-wide Twig variables as needed -- #} + {# + β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” + β”‚ β”‚ + β”‚ β”‚ + β”‚ β”‚ + β”‚ htmlPage β”‚ + β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ + #} -{# -- Prefetch & preconnect headers and links -- #} -{% set prefetchUrls = [ - alias("@assetsUrl"), -] %} -{# -- General global variables -- #} -{% set baseUrl = alias('@assetsUrl') ~ '/' %} -{% set gaTrackingId = getenv('GA_TRACKING_ID') %} -{# -- Twig output from the render; this must be in a block -- #} -{% block htmlPage %} -{% endblock %} + {# -- Prefetch & preconnect headers and links -- #} + {% set prefetchUrls = [ + alias("@assetsUrl"), + ] %} + {# -- General global variables -- #} + {% set baseUrl = alias('@assetsUrl') ~ '/' %} + {% set gaTrackingId = getenv('GA_TRACKING_ID') %} -{% endspaceless %} + {# -- Twig output from the render; this must be in a block -- #} +{% endspaceless %}{% block htmlPage %} +{% endblock %} From 61b8532dce2a3eb96d6b70ae50b5f66859416076 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Sat, 19 Mar 2022 17:31:18 -0400 Subject: [PATCH 64/68] refactor: Remove `tty: true` which causes console output to not appear in Docker Composer API 2.3.0 ref: https://github.com/docker/compose/issues/9288 --- docker-compose.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 2e9cfe8..4771fe7 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -27,7 +27,6 @@ services: expose: - "9000" init: true - tty: true volumes: &php-volumes - cpresources:/var/www/project/cms/web/cpresources:delegated - storage:/var/www/project/cms/storage:delegated @@ -49,7 +48,6 @@ services: expose: - "9000" init: true - tty: true volumes: *php-volumes # queue - runs queue jobs via php craft queue/listen @@ -62,7 +60,6 @@ services: env_file: *env init: true - tty: true volumes: *php-volumes # mariadb - database @@ -101,7 +98,6 @@ services: init: true ports: - "3000:3000" - tty: true volumes: - ./buildchain:/var/www/project/buildchain:cached - ./buildchain/node_modules:/var/www/project/buildchain/node_modules:delegated From db5926e13da01b5a2b217eb903b172b3f2d4ffcc Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Sat, 19 Mar 2022 17:32:35 -0400 Subject: [PATCH 65/68] feat: Significantly increased startup times via a `npm_install.sh` script that only runs `npm install` at container startup time if `package-lock.json` or `node_modules/` is missing --- docker-config/node-dev-vite/Dockerfile | 9 ++++++--- docker-config/node-dev-vite/npm_install.sh | 16 ++++++++++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) create mode 100755 docker-config/node-dev-vite/npm_install.sh diff --git a/docker-config/node-dev-vite/Dockerfile b/docker-config/node-dev-vite/Dockerfile index 537e98c..6d8ab2e 100755 --- a/docker-config/node-dev-vite/Dockerfile +++ b/docker-config/node-dev-vite/Dockerfile @@ -1,8 +1,9 @@ FROM nystudio107/node-dev-base:16-alpine -USER node +WORKDIR /var/www/project/ -WORKDIR /var/www/project/buildchain/ +COPY ./npm_install.sh . +RUN chmod a+x npm_install.sh # Run our webpack build in debug mode @@ -15,6 +16,8 @@ WORKDIR /var/www/project/buildchain/ # when working with teams or multiple environments CMD export CPPFLAGS="-DPNG_ARM_NEON_OPT=0" \ && \ - npm install \ + ./npm_install.sh \ + && \ + cd /var/www/project/buildchain/ \ && \ npm run dev diff --git a/docker-config/node-dev-vite/npm_install.sh b/docker-config/node-dev-vite/npm_install.sh new file mode 100755 index 0000000..16d62f3 --- /dev/null +++ b/docker-config/node-dev-vite/npm_install.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# NPM Install shell script +# +# This shell script runs `npm install` if either the `package-lock.json` file or +# the `node_modules/` directory is not present` +# +# @author nystudio107 +# @copyright Copyright (c) 2022 nystudio107 +# @link https://nystudio107.com/ +# @license MIT + +cd /var/www/project/buildchain +if [ ! -f "package-lock.json" ] || [ ! -d "node_modules" ]; then + npm install +fi From b31a1c0113aacfb1327b5a47e597cdc9649a77f0 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Sat, 19 Mar 2022 17:32:50 -0400 Subject: [PATCH 66/68] feat: 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 --- docker-config/php-prod-craft/Dockerfile | 8 +++--- .../php-prod-craft/composer_install.sh | 16 ++++++++++++ docker-config/php-prod-craft/run_queue.sh | 25 +++++++++++++------ 3 files changed, 36 insertions(+), 13 deletions(-) create mode 100755 docker-config/php-prod-craft/composer_install.sh diff --git a/docker-config/php-prod-craft/Dockerfile b/docker-config/php-prod-craft/Dockerfile index 69462fc..16f4280 100755 --- a/docker-config/php-prod-craft/Dockerfile +++ b/docker-config/php-prod-craft/Dockerfile @@ -54,8 +54,8 @@ RUN chmod a+x run_queue.sh \ mkdir -p /var/www/project/cms/web/cpresources \ && \ chown -R www-data:www-data /var/www/project - -WORKDIR /var/www/project/cms +COPY ./composer_install.sh . +RUN chmod a+x composer_install.sh # Force permissions, update Craft, and start php-fpm @@ -68,8 +68,6 @@ WORKDIR /var/www/project/cms # when working with teams or multiple environments CMD chown -R www-data:www-data /var/www/project \ && \ - su-exec www-data composer install --verbose --no-progress --no-scripts --optimize-autoloader --no-interaction \ - && \ - su-exec www-data composer craft-update \ + ./composer_install.sh \ && \ php-fpm diff --git a/docker-config/php-prod-craft/composer_install.sh b/docker-config/php-prod-craft/composer_install.sh new file mode 100755 index 0000000..584f4cf --- /dev/null +++ b/docker-config/php-prod-craft/composer_install.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# Composer Install shell script +# +# This shell script runs `composer install` if either the `composer.lock` file or +# the `vendor/` directory is not present` +# +# @author nystudio107 +# @copyright Copyright (c) 2022 nystudio107 +# @link https://nystudio107.com/ +# @license MIT + +cd /var/www/project/cms +if [ ! -f "composer.lock" ] || [ ! -d "vendor" ]; then + su-exec www-data composer install --verbose --no-progress --no-scripts --optimize-autoloader --no-interaction +fi diff --git a/docker-config/php-prod-craft/run_queue.sh b/docker-config/php-prod-craft/run_queue.sh index 05b4b25..f8ef5c7 100755 --- a/docker-config/php-prod-craft/run_queue.sh +++ b/docker-config/php-prod-craft/run_queue.sh @@ -3,18 +3,27 @@ # Run Queue shell script # # This shell script runs the Craft CMS queue via `php craft queue/listen` -# It's wrapped in a "keep alive" infinite loop that restarts the command -# (after a 60 second sleep) should it exit unexpectedly for any reason +# It waits until the database container responds, then runs any pending +# migrations / project config changes via the `craft-update` Composer script, +# then runs the queue listener that listens for and runs pending queue jobs # # @author nystudio107 -# @copyright Copyright (c) 2020 nystudio107 +# @copyright Copyright (c) 2022 nystudio107 # @link https://nystudio107.com/ # @license MIT -while true +cd /var/www/project/cms +# Wait until the Postgres db container responds +until eval "PGPASSWORD=$DB_PASSWORD psql -h postgres -U $DB_USER $DB_DATABASE -c 'select 1' > /dev/null 2>&1" do - cd /var/www/project/cms - su-exec www-data php craft queue/listen 10 - echo "-> craft queue/listen will retry in 60 seconds" - sleep 60 + sleep 1 done +# Wait until the `composer install` is done by looking for the `vendor/autoload.php` file +while [ ! -f vendor/autoload.php ] +do + sleep 1 +done +# Run any pending migrations/project config changes +su-exec www-data composer craft-update +# Run a queue listener +su-exec www-data php craft queue/listen 10 From 501262c9ab6f2ca0c3f461adcb6df92a8b0484e7 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Sat, 19 Mar 2022 17:33:40 -0400 Subject: [PATCH 67/68] refactor: Clean up Makefile commands --- Makefile | 32 ++++++++++++++------------------ README.md | 22 +++++++--------------- 2 files changed, 21 insertions(+), 33 deletions(-) diff --git a/Makefile b/Makefile index 751e802..6808f97 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,15 @@ -CONTAINER?=$(shell basename $(CURDIR))_php_1 -BUILDCHAIN?=$(shell basename $(CURDIR))_vite_1 +CONTAINER?=$(shell basename $(CURDIR))-php-1 +BUILDCHAIN?=$(shell basename $(CURDIR))-vite-1 -.PHONY: build clean composer dev npm pulldb restoredb up +.PHONY: build clean composer craft dev npm pulldb restoredb nuke ssh up build: up docker exec -it ${BUILDCHAIN} npm run build clean: - docker-compose down -v - docker-compose up --build + rm -f cms/composer.lock + rm -rf cms/vendor/ + rm -f buildchain/package-lock.json + rm -rf buildchain/node_modules/ composer: up docker exec -it ${CONTAINER} su-exec www-data composer \ $(filter-out $@,$(MAKECMDGOALS)) @@ -23,21 +25,15 @@ pulldb: up restoredb: up cd scripts/ && ./docker_restore_db.sh \ $(filter-out $@,$(MAKECMDGOALS)) -update: - docker-compose down - rm -f cms/composer.lock - rm -f buildchain/package-lock.json - docker-compose up -update-clean: - docker-compose down - rm -f cms/composer.lock - rm -rf cms/vendor/ - rm -f buildchain/package-lock.json - rm -rf buildchain/node_modules/ - docker-compose up +nuke: clean + docker-compose down -v + docker-compose up --build --force-recreate +ssh: + docker exec -it ${CONTAINER} su-exec www-data /bin/sh up: if [ ! "$$(docker ps -q -f name=${CONTAINER})" ]; then \ - docker-compose up; \ + cp -n cms/example.env cms/.env; \ + docker-compose up; \ fi %: @: diff --git a/README.md b/README.md index 2c56b10..5035c02 100644 --- a/README.md +++ b/README.md @@ -50,11 +50,11 @@ You can read more about it in the [Setting up a New Craft 3 CMS Project](https:/ This project package works exactly the way Pixel & Tonic's [craftcms/craft](https://github.com/craftcms/craft) package works; you create a new project by first creating & installing the project: - composer create-project nystudio107/craft:dev-craft-vite PATH --no-install + composer create-project nystudio107/craft PATH --no-install Make sure that `PATH` is the path to your project, including the name you want for the project, e.g.: - composer create-project nystudio107/craft:dev-craft-vite vitecraft --no-install --remove-vcs + composer create-project nystudio107/craft craft3 --no-install We use `--no-install` so that the composer packages for the root project are not installed. @@ -103,26 +103,18 @@ To make using it easier, we're using a Makefile and the built-in `make` utility - `make dev` - starts up the local dev server listening on `http://localhost:8000/` - `make build` - builds the static assets via the Vite buildchain -- `make clean` - shuts down the Docker containers, removes any mounted volumes (including the database), and then rebuilds the containers from scratch -- `make update` - causes the project to update to the latest Composer and NPM dependencies -- `make update-clean` - completely removes `node_modules/` & `vendor/`, then causes the project to update to the latest Composer and NPM dependencies +- `make clean` - removes the `cms/composer.lock` & the entire `cms/vendor/` directory as well as the `buildchain/package-lock.json` & the entire `buildchain/node_modules/` directory - `make composer xxx` - runs the `composer` command passed in, e.g. `make composer install` - `make craft xxx` - runs the `craft` [console command](https://craftcms.com/docs/3.x/console-commands.html) passed in, e.g. `make craft project-config/apply` in the php container - `make npm xxx` - runs the `npm` command passed in, e.g. `make npm install` +- `make nuke` - restarts the project from scratch by running `make clean` (above), then shuts down the Docker containers, removes any mounted volumes (including the database), and then rebuilds the containers from scratch - `make pulldb` - runs the `scripts/docker_pull_db.sh` script to pull a remote database into the database container; the `scripts/.env.sh` must be set up first - `make restoredb xxx` - runs the `scripts/docker_restore_db.sh` script to restore a local database dump into the database container; the `scripts/.env.sh` must be set up first +- `make ssh` - opens up a Unix shell inside the PHP container for the project -### Other notes - -To update to the latest Composer packages (as constrained by the `cms/composer.json` semvers) and latest npm packages (as constrained by the `buildchain/package.json` semvers), do: -``` -make update -``` +**Tip:** If you try a command like `make craft project-config/apply --force` you’ll see an error, because the shell thinks the `--force` flag should be applied to the `make` command. To side-step this, use the `--` (double-dash) to disable further option processing, like this: `make -- craft project-config/apply --force` -To start from scratch by removing `buildchain/node_modules/` & `cms/vendor/`, then update to the latest Composer packages (as constrained by the `cms/composer.json` semvers) and latest npm packages (as constrained by the `buildchain/package.json` semvers), do: -``` -make update-clean -``` +### Other notes To use Xdebug with VSCode install the [PHP Debug extension](https://marketplace.visualstudio.com/items?itemName=felixfbecker.php-debug ) and use the following configuration in your `.vscode/launch.json`: ```json From 3cc086c9f4e7cf78372235d395898dfc6c8bd4e1 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Sat, 19 Mar 2022 17:38:40 -0400 Subject: [PATCH 68/68] docs: Updated README.md --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5035c02..679b964 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,11 @@ We use `--no-install` so that the composer packages for the root project are not ## Setting Up Local Dev -You'll need Docker desktop for your platform installed to run the project in local development +You'll need [Docker desktop](https://www.docker.com/products/docker-desktop) for your platform installed to run devMode in local development + +Ensure you're using the [Docker Compose API v2](https://stackoverflow.com/questions/69464001/docker-compose-container-name-use-dash-instead-of-underscore/70295720#70295720) for the `make` commands to all work properly. + +Ensure no other local development environments are running that might have port conflicts, then: * Start up the site by typing `make dev` in terminal in the project's root directory (the first build will be somewhat lengthy) * Navigate to `http://localhost:8000` to use the site; the `vite-dev-server` runs off of `http://localhost:3000`