├── .docker-config ├── mysql │ └── Dockerfile ├── nginx │ ├── Dockerfile │ └── default.conf ├── php-dev-craft │ ├── v3 │ │ └── Dockerfile │ ├── v4 │ │ └── Dockerfile │ └── v5 │ │ └── Dockerfile ├── php-prod-craft │ ├── v3 │ │ ├── Dockerfile │ │ ├── composer_install.sh │ │ └── run_queue.sh │ ├── v4 │ │ ├── Dockerfile │ │ ├── composer_install.sh │ │ └── run_queue.sh │ └── v5 │ │ ├── Dockerfile │ │ ├── composer_install.sh │ │ └── run_queue.sh ├── postgres │ └── Dockerfile └── redis │ └── Dockerfile ├── .gitignore ├── CHANGELOG.md ├── LICENSE.md ├── Makefile ├── README.md ├── cms_v3 ├── Makefile ├── bootstrap.php ├── buildchain │ ├── .gitignore │ ├── Dockerfile │ ├── Makefile │ ├── README.md │ ├── eslint.config.js │ ├── package.json │ ├── src │ │ ├── css │ │ │ ├── app.css │ │ │ ├── components │ │ │ │ ├── global.css │ │ │ │ ├── typography.css │ │ │ │ └── webfonts.css │ │ │ ├── pages │ │ │ │ ├── settings.css │ │ │ │ └── welcome.css │ │ │ ├── tailwind-config.css │ │ │ └── vendor.css │ │ ├── js │ │ │ ├── @types │ │ │ │ └── shims.d.ts │ │ │ ├── Confetti.ts │ │ │ ├── app.ts │ │ │ └── welcome.ts │ │ └── vue │ │ │ ├── @types │ │ │ ├── confetti.d.ts │ │ │ └── shims-vue.d.ts │ │ │ ├── App.vue │ │ │ └── ConfettiParty.vue │ ├── stylelint.config.js │ ├── tailwind.config.js │ ├── tsconfig.json │ └── vite.config.ts ├── composer.json ├── config │ ├── _configs │ │ ├── mysql │ │ │ ├── db.php │ │ │ └── general.php │ │ └── postgres │ │ │ ├── db.php │ │ │ └── general.php │ ├── app.console.php │ ├── app.php │ ├── app.web.php │ ├── db.php │ ├── fastcgi-cache-bust.php │ ├── general.php │ ├── htmlpurifier │ │ └── Default.json │ ├── redactor │ │ ├── Default.json │ │ └── Simple.json │ ├── routes.php │ ├── seomatic-config │ │ └── globalmeta │ │ │ └── Creator.php │ ├── twigpack.php │ └── vite.php ├── craft ├── craft.bat ├── ecs.php ├── example.env ├── modules │ └── sitemodule │ │ ├── .craftplugin │ │ ├── .gitignore │ │ ├── CHANGELOG.md │ │ ├── LICENSE.md │ │ ├── README.md │ │ └── src │ │ ├── SiteModule.php │ │ ├── assetbundles │ │ └── sitemodule │ │ │ ├── SiteModuleAsset.php │ │ │ └── dist │ │ │ ├── css │ │ │ └── SiteModule.css │ │ │ ├── img │ │ │ └── SiteModule-icon.svg │ │ │ └── js │ │ │ └── SiteModule.js │ │ ├── config.php │ │ ├── helpers │ │ └── Config.php │ │ ├── services │ │ └── Helper.php │ │ ├── translations │ │ └── en │ │ │ └── site-module.php │ │ └── variables │ │ └── SiteVariable.php ├── phpstan.neon ├── rector.php ├── templates │ ├── .gitkeep │ ├── blog │ │ ├── _entry.twig │ │ └── index.twig │ └── index.twig └── web │ ├── .htaccess │ ├── assets │ └── .gitignore │ ├── cpresources │ └── .gitignore │ ├── img │ └── site │ │ ├── login-background-image.png │ │ └── nys-logo.svg │ ├── index.php │ ├── offline.svg │ └── web.config ├── cms_v4 ├── Makefile ├── bootstrap.php ├── buildchain │ ├── .gitignore │ ├── Dockerfile │ ├── Makefile │ ├── README.md │ ├── eslint.config.js │ ├── package.json │ ├── src │ │ ├── css │ │ │ ├── app.css │ │ │ ├── components │ │ │ │ ├── global.css │ │ │ │ ├── typography.css │ │ │ │ └── webfonts.css │ │ │ ├── pages │ │ │ │ ├── settings.css │ │ │ │ └── welcome.css │ │ │ ├── tailwind-config.css │ │ │ └── vendor.css │ │ ├── js │ │ │ ├── @types │ │ │ │ └── shims.d.ts │ │ │ ├── Confetti.ts │ │ │ ├── app.ts │ │ │ └── welcome.ts │ │ └── vue │ │ │ ├── @types │ │ │ ├── confetti.d.ts │ │ │ └── shims-vue.d.ts │ │ │ ├── App.vue │ │ │ └── ConfettiParty.vue │ ├── stylelint.config.js │ ├── tailwind.config.js │ ├── tsconfig.json │ └── vite.config.ts ├── composer.json ├── config │ ├── _configs │ │ ├── mysql │ │ │ ├── db.php │ │ │ └── general.php │ │ └── postgres │ │ │ ├── db.php │ │ │ └── general.php │ ├── app.console.php │ ├── app.php │ ├── app.web.php │ ├── custom.php │ ├── db.php │ ├── fastcgi-cache-bust.php │ ├── general.php │ ├── htmlpurifier │ │ └── Default.json │ ├── redactor │ │ ├── Default.json │ │ └── Simple.json │ ├── routes.php │ ├── seomatic-config │ │ └── globalmeta │ │ │ └── Creator.php │ ├── twigpack.php │ └── vite.php ├── craft ├── craft.bat ├── ecs.php ├── example.env ├── modules │ └── sitemodule │ │ ├── .craftplugin │ │ ├── .gitignore │ │ ├── CHANGELOG.md │ │ ├── LICENSE.md │ │ ├── README.md │ │ └── src │ │ ├── SiteModule.php │ │ ├── assetbundles │ │ └── sitemodule │ │ │ ├── SiteModuleAsset.php │ │ │ └── dist │ │ │ ├── css │ │ │ └── SiteModule.css │ │ │ ├── img │ │ │ └── SiteModule-icon.svg │ │ │ └── js │ │ │ └── SiteModule.js │ │ ├── config.php │ │ ├── helpers │ │ └── Config.php │ │ ├── services │ │ └── Helper.php │ │ ├── translations │ │ └── en │ │ │ └── site-module.php │ │ └── variables │ │ └── SiteVariable.php ├── phpstan.neon ├── rector.php ├── templates │ ├── .gitkeep │ ├── blog │ │ ├── _entry.twig │ │ └── index.twig │ └── index.twig └── web │ ├── .htaccess │ ├── assets │ └── .gitignore │ ├── cpresources │ └── .gitignore │ ├── img │ └── site │ │ ├── login-background-image.png │ │ └── nys-logo.svg │ ├── index.php │ ├── offline.svg │ └── web.config ├── cms_v5 ├── Makefile ├── bootstrap.php ├── buildchain │ ├── .gitignore │ ├── Dockerfile │ ├── Makefile │ ├── README.md │ ├── eslint.config.js │ ├── package.json │ ├── src │ │ ├── css │ │ │ ├── app.css │ │ │ ├── components │ │ │ │ ├── global.css │ │ │ │ ├── typography.css │ │ │ │ └── webfonts.css │ │ │ ├── pages │ │ │ │ ├── settings.css │ │ │ │ └── welcome.css │ │ │ ├── tailwind-config.css │ │ │ └── vendor.css │ │ ├── js │ │ │ ├── @types │ │ │ │ └── shims.d.ts │ │ │ ├── Confetti.ts │ │ │ ├── app.ts │ │ │ └── welcome.ts │ │ └── vue │ │ │ ├── @types │ │ │ ├── confetti.d.ts │ │ │ └── shims-vue.d.ts │ │ │ ├── App.vue │ │ │ └── ConfettiParty.vue │ ├── stylelint.config.js │ ├── tailwind.config.js │ ├── tsconfig.json │ └── vite.config.ts ├── composer.json ├── config │ ├── _configs │ │ ├── mysql │ │ │ ├── db.php │ │ │ └── general.php │ │ └── postgres │ │ │ ├── db.php │ │ │ └── general.php │ ├── app.console.php │ ├── app.php │ ├── app.web.php │ ├── custom.php │ ├── db.php │ ├── fastcgi-cache-bust.php │ ├── general.php │ ├── htmlpurifier │ │ └── Default.json │ ├── redactor │ │ ├── Default.json │ │ └── Simple.json │ ├── routes.php │ ├── seomatic-config │ │ └── globalmeta │ │ │ └── Creator.php │ ├── twigpack.php │ └── vite.php ├── craft ├── craft.bat ├── ecs.php ├── example.env ├── modules │ └── sitemodule │ │ ├── .craftplugin │ │ ├── .gitignore │ │ ├── CHANGELOG.md │ │ ├── LICENSE.md │ │ ├── README.md │ │ └── src │ │ ├── SiteModule.php │ │ ├── assetbundles │ │ └── sitemodule │ │ │ ├── SiteModuleAsset.php │ │ │ └── dist │ │ │ ├── css │ │ │ └── SiteModule.css │ │ │ ├── img │ │ │ └── SiteModule-icon.svg │ │ │ └── js │ │ │ └── SiteModule.js │ │ ├── config.php │ │ ├── helpers │ │ └── Config.php │ │ ├── services │ │ └── Helper.php │ │ ├── translations │ │ └── en │ │ │ └── site-module.php │ │ └── variables │ │ └── SiteVariable.php ├── phpstan.neon ├── rector.php ├── templates │ ├── .gitkeep │ ├── blog │ │ ├── _entry.twig │ │ └── index.twig │ └── index.twig └── web │ ├── .htaccess │ ├── assets │ └── .gitignore │ ├── cpresources │ └── .gitignore │ ├── img │ └── site │ │ ├── login-background-image.png │ │ └── nys-logo.svg │ ├── index.php │ ├── offline.svg │ └── web.config ├── composer.json ├── db-seed ├── mysql │ ├── db_init.sh │ └── dbs │ │ ├── project_v3.sql │ │ ├── project_v4.sql │ │ ├── project_v5.sql │ │ └── test.sql └── postgres │ ├── db_init.sh │ └── dbs │ ├── project_v3.sql │ ├── project_v4.sql │ ├── project_v5.sql │ └── test.sql ├── docker-compose.yml └── src └── templates /.docker-config/mysql/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mysql/mysql-server:latest 2 | -------------------------------------------------------------------------------- /.docker-config/nginx/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM nginx:1.19-alpine 2 | 3 | COPY ./default.conf /etc/nginx/conf.d/default.conf 4 | -------------------------------------------------------------------------------- /.docker-config/nginx/default.conf: -------------------------------------------------------------------------------- 1 | # default Docker DNS server 2 | resolver 127.0.0.11; 3 | 4 | # If a cookie doesn't exist, it evaluates to an empty string, so if neither cookie exists, it'll match : 5 | # (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 6 | map $cookie_XDEBUG_SESSION:$cookie_XDEBUG_PROFILE $container_name { 7 | default php_xdebug; 8 | ':' php; 9 | } 10 | 11 | map $server_port $craft_cms_version { 12 | 8003 v3; 13 | 8004 v4; 14 | 8005 v5; 15 | } 16 | 17 | server { 18 | listen 8003; 19 | listen [::]:8003; 20 | listen 8004; 21 | listen [::]:8004; 22 | listen 8005; 23 | listen [::]:8005; 24 | 25 | set $fast_cgi_pass "${container_name}_${craft_cms_version}"; 26 | set $craft_server_root "/var/www/project/cms_${craft_cms_version}/web"; 27 | 28 | server_name _; 29 | root $craft_server_root; 30 | index index.html index.htm index.php; 31 | charset utf-8; 32 | 33 | gzip_static on; 34 | 35 | ssi on; 36 | 37 | client_max_body_size 0; 38 | 39 | error_page 404 /index.php?$query_string; 40 | 41 | access_log off; 42 | error_log /dev/stdout info; 43 | 44 | location = /favicon.ico { access_log off; log_not_found off; } 45 | 46 | location / { 47 | try_files $uri/index.html $uri $uri/ /index.php?$query_string; 48 | } 49 | 50 | location ~ [^/]\.php(/|$) { 51 | try_files $uri $uri/ /index.php?$query_string; 52 | fastcgi_split_path_info ^(.+\.php)(/.+)$; 53 | fastcgi_pass $fast_cgi_pass:9000; 54 | fastcgi_index index.php; 55 | include fastcgi_params; 56 | fastcgi_param PATH_INFO $fastcgi_path_info; 57 | fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; 58 | fastcgi_param DOCUMENT_ROOT $realpath_root; 59 | fastcgi_param HTTP_PROXY ""; 60 | 61 | add_header Last-Modified $date_gmt; 62 | add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0"; 63 | if_modified_since off; 64 | expires off; 65 | etag off; 66 | 67 | fastcgi_intercept_errors off; 68 | fastcgi_buffer_size 16k; 69 | fastcgi_buffers 4 16k; 70 | fastcgi_connect_timeout 300; 71 | fastcgi_send_timeout 300; 72 | fastcgi_read_timeout 300; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /.docker-config/php-prod-craft/v3/composer_install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Composer Install shell script 4 | # 5 | # This shell script runs `composer install` if either the `composer.lock` file or 6 | # the `vendor/` directory is not present` 7 | # 8 | # @author nystudio107 9 | # @copyright Copyright (c) 2022 nystudio107 10 | # @link https://nystudio107.com/ 11 | # @license MIT 12 | 13 | # Ensure permissions on directories Craft needs to write to 14 | chown -R www-data:www-data $CMS_ROOT_PATH/storage 15 | chown -R www-data:www-data $CMS_ROOT_PATH/web/cpresources 16 | # Check for `composer.lock` & `vendor/autoload.php` 17 | cd $CMS_ROOT_PATH 18 | if [ ! -f "composer.lock" ] || [ ! -f "vendor/autoload.php" ]; then 19 | chown -R www-data:www-data /var/www/project 20 | su-exec www-data composer install --verbose --no-progress --no-scripts --optimize-autoloader --no-interaction 21 | # Wait until the MySQL db container responds 22 | echo "### Waiting for MySQL database" 23 | until eval "mysql -h mysql -u $DB_USER -p$DB_PASSWORD $DB_DATABASE -e 'select 1' > /dev/null 2>&1" 24 | do 25 | sleep 1 26 | done 27 | # Wait until the Postgres db container responds 28 | echo "### Waiting for Postgres database" 29 | until eval "PGPASSWORD=$DB_PASSWORD psql -h postgres -U $DB_USER $DB_DATABASE -c 'select 1' > /dev/null 2>&1" 30 | do 31 | sleep 1 32 | done 33 | # Run any pending migrations/project config changes 34 | su-exec www-data composer craft-update 35 | fi 36 | -------------------------------------------------------------------------------- /.docker-config/php-prod-craft/v3/run_queue.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Run Queue shell script 4 | # 5 | # This shell script runs the Craft CMS queue via `php craft queue/listen` 6 | # It waits until the database container responds, then runs any pending 7 | # migrations / project config changes via the `craft-update` Composer script, 8 | # then runs the queue listener that listens for and runs pending queue jobs 9 | # 10 | # @author nystudio107 11 | # @copyright Copyright (c) 2022 nystudio107 12 | # @link https://nystudio107.com/ 13 | # @license MIT 14 | 15 | cd $CMS_ROOT_PATH 16 | # Wait until the MySQL db container responds 17 | echo "### Waiting for MySQL database" 18 | until eval "mysql -h mysql -u $DB_USER -p$DB_PASSWORD $DB_DATABASE -e 'select 1' > /dev/null 2>&1" 19 | do 20 | sleep 1 21 | done 22 | # Wait until the Postgres db container responds 23 | echo "### Waiting for Postgres database" 24 | until eval "PGPASSWORD=$DB_PASSWORD psql -h postgres -U $DB_USER $DB_DATABASE -c 'select 1' > /dev/null 2>&1" 25 | do 26 | sleep 1 27 | done 28 | # Wait until the `composer install` is done by looking for the `vendor/autoload.php` and `composer.lock` files 29 | echo "### Waiting for vendor/autoload.php" 30 | while [ ! -f "vendor/autoload.php" ] || [ ! -f "composer.lock" ] 31 | do 32 | sleep 1 33 | done 34 | # Ensure permissions on directories Craft needs to write to 35 | chown -R www-data:www-data $CMS_ROOT_PATH/storage 36 | chown -R www-data:www-data $CMS_ROOT_PATH/web/cpresources 37 | # Run any pending migrations/project config changes 38 | su-exec www-data composer craft-update 39 | # Run a queue listener 40 | su-exec www-data php craft queue/listen 10 41 | -------------------------------------------------------------------------------- /.docker-config/php-prod-craft/v4/composer_install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Composer Install shell script 4 | # 5 | # This shell script runs `composer install` if either the `composer.lock` file or 6 | # the `vendor/` directory is not present` 7 | # 8 | # @author nystudio107 9 | # @copyright Copyright (c) 2022 nystudio107 10 | # @link https://nystudio107.com/ 11 | # @license MIT 12 | 13 | # Ensure permissions on directories Craft needs to write to 14 | chown -R www-data:www-data $CMS_ROOT_PATH/storage 15 | chown -R www-data:www-data $CMS_ROOT_PATH/web/cpresources 16 | # Check for `composer.lock` & `vendor/autoload.php` 17 | cd $CMS_ROOT_PATH 18 | if [ ! -f "composer.lock" ] || [ ! -f "vendor/autoload.php" ]; then 19 | chown -R www-data:www-data /var/www/project 20 | su-exec www-data composer install --verbose --no-progress --no-scripts --optimize-autoloader --no-interaction 21 | # Wait until the MySQL db container responds 22 | echo "### Waiting for MySQL database" 23 | until eval "mysql -h mysql -u $DB_USER -p$DB_PASSWORD $DB_DATABASE -e 'select 1' > /dev/null 2>&1" 24 | do 25 | sleep 1 26 | done 27 | # Wait until the Postgres db container responds 28 | echo "### Waiting for Postgres database" 29 | until eval "PGPASSWORD=$DB_PASSWORD psql -h postgres -U $DB_USER $DB_DATABASE -c 'select 1' > /dev/null 2>&1" 30 | do 31 | sleep 1 32 | done 33 | # Run any pending migrations/project config changes 34 | su-exec www-data composer craft-update 35 | fi 36 | -------------------------------------------------------------------------------- /.docker-config/php-prod-craft/v4/run_queue.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Run Queue shell script 4 | # 5 | # This shell script runs the Craft CMS queue via `php craft queue/listen` 6 | # It waits until the database container responds, then runs any pending 7 | # migrations / project config changes via the `craft-update` Composer script, 8 | # then runs the queue listener that listens for and runs pending queue jobs 9 | # 10 | # @author nystudio107 11 | # @copyright Copyright (c) 2022 nystudio107 12 | # @link https://nystudio107.com/ 13 | # @license MIT 14 | 15 | cd $CMS_ROOT_PATH 16 | # Wait until the MySQL db container responds 17 | echo "### Waiting for MySQL database" 18 | until eval "mysql -h mysql -u $DB_USER -p$DB_PASSWORD $DB_DATABASE -e 'select 1' > /dev/null 2>&1" 19 | do 20 | sleep 1 21 | done 22 | # Wait until the Postgres db container responds 23 | echo "### Waiting for Postgres database" 24 | until eval "PGPASSWORD=$DB_PASSWORD psql -h postgres -U $DB_USER $DB_DATABASE -c 'select 1' > /dev/null 2>&1" 25 | do 26 | sleep 1 27 | done 28 | # Wait until the `composer install` is done by looking for the `vendor/autoload.php` and `composer.lock` files 29 | echo "### Waiting for vendor/autoload.php" 30 | while [ ! -f "vendor/autoload.php" ] || [ ! -f "composer.lock" ] 31 | do 32 | sleep 1 33 | done 34 | # Ensure permissions on directories Craft needs to write to 35 | chown -R www-data:www-data $CMS_ROOT_PATH/storage 36 | chown -R www-data:www-data $CMS_ROOT_PATH/web/cpresources 37 | # Run any pending migrations/project config changes 38 | su-exec www-data composer craft-update 39 | # Run a queue listener 40 | su-exec www-data php craft queue/listen 10 41 | -------------------------------------------------------------------------------- /.docker-config/php-prod-craft/v5/composer_install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Composer Install shell script 4 | # 5 | # This shell script runs `composer install` if either the `composer.lock` file or 6 | # the `vendor/` directory is not present` 7 | # 8 | # @author nystudio107 9 | # @copyright Copyright (c) 2022 nystudio107 10 | # @link https://nystudio107.com/ 11 | # @license MIT 12 | 13 | # Ensure permissions on directories Craft needs to write to 14 | chown -R www-data:www-data $CMS_ROOT_PATH/storage 15 | chown -R www-data:www-data $CMS_ROOT_PATH/web/cpresources 16 | # Check for `composer.lock` & `vendor/autoload.php` 17 | cd $CMS_ROOT_PATH 18 | if [ ! -f "composer.lock" ] || [ ! -f "vendor/autoload.php" ]; then 19 | chown -R www-data:www-data /var/www/project 20 | su-exec www-data composer install --verbose --no-progress --no-scripts --optimize-autoloader --no-interaction 21 | # Wait until the MySQL db container responds 22 | echo "### Waiting for MySQL database" 23 | until eval "mysql -h mysql -u $DB_USER -p$DB_PASSWORD $DB_DATABASE -e 'select 1' > /dev/null 2>&1" 24 | do 25 | sleep 1 26 | done 27 | # Wait until the Postgres db container responds 28 | echo "### Waiting for Postgres database" 29 | until eval "PGPASSWORD=$DB_PASSWORD psql -h postgres -U $DB_USER $DB_DATABASE -c 'select 1' > /dev/null 2>&1" 30 | do 31 | sleep 1 32 | done 33 | # Run any pending migrations/project config changes 34 | su-exec www-data composer craft-update 35 | fi 36 | -------------------------------------------------------------------------------- /.docker-config/php-prod-craft/v5/run_queue.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Run Queue shell script 4 | # 5 | # This shell script runs the Craft CMS queue via `php craft queue/listen` 6 | # It waits until the database container responds, then runs any pending 7 | # migrations / project config changes via the `craft-update` Composer script, 8 | # then runs the queue listener that listens for and runs pending queue jobs 9 | # 10 | # @author nystudio107 11 | # @copyright Copyright (c) 2022 nystudio107 12 | # @link https://nystudio107.com/ 13 | # @license MIT 14 | 15 | cd $CMS_ROOT_PATH 16 | # Wait until the MySQL db container responds 17 | echo "### Waiting for MySQL database" 18 | until eval "mysql -h mysql -u $DB_USER -p$DB_PASSWORD $DB_DATABASE -e 'select 1' > /dev/null 2>&1" 19 | do 20 | sleep 1 21 | done 22 | # Wait until the Postgres db container responds 23 | echo "### Waiting for Postgres database" 24 | until eval "PGPASSWORD=$DB_PASSWORD psql -h postgres -U $DB_USER $DB_DATABASE -c 'select 1' > /dev/null 2>&1" 25 | do 26 | sleep 1 27 | done 28 | # Wait until the `composer install` is done by looking for the `vendor/autoload.php` and `composer.lock` files 29 | echo "### Waiting for vendor/autoload.php" 30 | while [ ! -f "vendor/autoload.php" ] || [ ! -f "composer.lock" ] 31 | do 32 | sleep 1 33 | done 34 | # Ensure permissions on directories Craft needs to write to 35 | chown -R www-data:www-data $CMS_ROOT_PATH/storage 36 | chown -R www-data:www-data $CMS_ROOT_PATH/web/cpresources 37 | # Run any pending migrations/project config changes 38 | su-exec www-data composer craft-update 39 | # Run a queue listener 40 | su-exec www-data php craft queue/listen 10 41 | -------------------------------------------------------------------------------- /.docker-config/postgres/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM postgres:13-alpine 2 | -------------------------------------------------------------------------------- /.docker-config/redis/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM redis:5-alpine 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Craft .gitignore 2 | # 3 | # Example .gitignore file for Craft CMS projects 4 | # 5 | # @author nystudio107 6 | # @copyright Copyright (c) 2017 nystudio107 7 | # @link https://nystudio107.com/ 8 | # @package nystudio107/craft 9 | # @since 1.0.0 10 | # @license MIT 11 | 12 | # This file should be placed in your Craft CMS project root directory 13 | 14 | # CRAFT ENVIRONMENT 15 | .env* 16 | license.key* 17 | 18 | # COMPOSER 19 | */vendor/* 20 | 21 | # CRAFT STORAGE 22 | */storage/* 23 | !*/storage/.gitkeep 24 | 25 | # ASSETS 26 | /cms_v3/web/assets/* 27 | /cms_v3/web/cpresources/* 28 | /cms_v3/web/dist/* 29 | /cms_v4/web/assets/* 30 | /cms_v4/web/cpresources/* 31 | /cms_v4/web/dist/* 32 | 33 | # BUILD FILES 34 | node_modules 35 | yarn-error.log 36 | npm-debug.log 37 | 38 | # MISC FILES 39 | .cache 40 | .DS_Store 41 | .idea 42 | .project 43 | .settings 44 | *.esproj 45 | *.sublime-workspace 46 | *.sublime-project 47 | *.tmproj 48 | *.tmproject 49 | .vscode/* 50 | !.vscode/settings.json 51 | !.vscode/tasks.json 52 | !.vscode/launch.json 53 | !.vscode/extensions.json 54 | config.codekit3 55 | prepros-6.config 56 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) Pixel & Tonic, Inc. 2 | 3 | Permission to use, copy, modify, and/or distribute this software for any 4 | purpose with or without fee is hereby granted. 5 | 6 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 7 | REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 8 | AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 9 | INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 10 | LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 11 | OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 12 | PERFORMANCE OF THIS SOFTWARE. 13 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | SEPARATOR:=- 2 | PROJECT_NAME?=$(shell basename $(CURDIR)) 3 | SERVICE_NAME?=php 4 | CMS_ROOT_NAME?=cms_ 5 | CMS_VERSIONS:=v3 v4 v5 6 | 7 | .PHONY: dev clean nuke up 8 | 9 | dev: up 10 | clean: 11 | for v in $(CMS_VERSIONS) ; do \ 12 | rm -f $(CMS_ROOT_NAME)$$v/composer.lock ; \ 13 | rm -rf $(CMS_ROOT_NAME)$$v/vendor/ ; \ 14 | done 15 | nuke: clean 16 | docker-compose down -v 17 | docker-compose up --build --force-recreate 18 | up: CONTAINER=$(PROJECT_NAME)$(SEPARATOR)$(SERVICE_NAME)_$(word 1,$(CMS_VERSIONS))$(SEPARATOR)1 19 | up: 20 | if [ ! "$$(docker ps -q -f name=$(CONTAINER))" ]; then \ 21 | for v in $(CMS_VERSIONS) ; do \ 22 | cp -fn $(CMS_ROOT_NAME)$$v/example.env $(CMS_ROOT_NAME)$$v/.env ; \ 23 | done ; \ 24 | docker-compose up ; \ 25 | fi 26 | down: 27 | docker-compose down 28 | %: 29 | @: 30 | # ref: https://stackoverflow.com/questions/6273608/how-to-pass-argument-to-makefile-from-command-line 31 | -------------------------------------------------------------------------------- /cms_v3/Makefile: -------------------------------------------------------------------------------- 1 | SEPARATOR:=- 2 | PROJECT_NAME?=$(shell basename $(dir $(CURDIR))) 3 | PROJECT_DIR?=/var/www/project/ 4 | SERVICE_NAME?=php 5 | QUEUE_SERVICE_NAME?=queue 6 | CMS_ROOT_NAME?=cms_ 7 | CMS_VERSION:=v3 8 | CONTAINER:=$(PROJECT_NAME)$(SEPARATOR)$(SERVICE_NAME)_$(CMS_VERSION)$(SEPARATOR)1 9 | QUEUE_CONTAINER:=$(PROJECT_NAME)$(SEPARATOR)$(QUEUE_SERVICE_NAME)_$(CMS_VERSION)$(SEPARATOR)1 10 | CMS_DIR:=$(CMS_ROOT_NAME)$(CMS_VERSION) 11 | 12 | .PHONY: codecept composer craft ecs mysql phpstan postgres rector ssh 13 | 14 | codecept: 15 | docker exec -it -w $(PROJECT_DIR)$(CMS_DIR) $(CONTAINER) su-exec www-data vendor/bin/codecept \ 16 | $(filter-out $@,$(MAKECMDGOALS)) $(MAKEFLAGS) 17 | composer: 18 | docker exec -it -w $(PROJECT_DIR)$(CMS_DIR) $(CONTAINER) su-exec www-data composer \ 19 | $(filter-out $@,$(MAKECMDGOALS)) $(MAKEFLAGS) 20 | craft: 21 | docker exec -it -w $(PROJECT_DIR)$(CMS_DIR) $(CONTAINER) su-exec www-data php craft \ 22 | $(filter-out $@,$(MAKECMDGOALS)) $(MAKEFLAGS) 23 | ecs: 24 | docker exec -it -w $(PROJECT_DIR)$(CMS_DIR) $(CONTAINER) su-exec www-data vendor/bin/ecs \ 25 | $(filter-out $@,$(MAKECMDGOALS)) $(MAKEFLAGS) 26 | mysql: 27 | cp config/_configs/mysql/db.php config/db.php 28 | cp config/_configs/mysql/general.php config/general.php 29 | docker restart $(QUEUE_CONTAINER) 30 | phpstan: 31 | docker exec -it -w $(PROJECT_DIR)$(CMS_DIR) $(CONTAINER) su-exec www-data vendor/bin/phpstan --memory-limit=1G \ 32 | $(filter-out $@,$(MAKECMDGOALS)) $(MAKEFLAGS) 33 | postgres: 34 | cp config/_configs/postgres/db.php config/db.php 35 | cp config/_configs/postgres/general.php config/general.php 36 | docker restart $(QUEUE_CONTAINER) 37 | rector: 38 | docker exec -it -w $(PROJECT_DIR)$(CMS_DIR) $(CONTAINER) su-exec www-data vendor/bin/rector \ 39 | $(filter-out $@,$(MAKECMDGOALS)) $(MAKEFLAGS) 40 | ssh: 41 | docker exec -it -w $(PROJECT_DIR)$(CMS_DIR) $(CONTAINER) su-exec www-data /bin/sh 42 | %: 43 | @: 44 | # ref: https://stackoverflow.com/questions/6273608/how-to-pass-argument-to-makefile-from-command-line 45 | -------------------------------------------------------------------------------- /cms_v3/bootstrap.php: -------------------------------------------------------------------------------- 1 | safeLoad(); 16 | } 17 | 18 | // Define additional PHP constants 19 | // (see https://craftcms.com/docs/3.x/config/#php-constants) 20 | define('CRAFT_ENVIRONMENT', getenv('ENVIRONMENT') ?: 'production'); 21 | -------------------------------------------------------------------------------- /cms_v3/buildchain/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | pnpm-debug.log* 8 | lerna-debug.log* 9 | 10 | node_modules 11 | dist 12 | dist-ssr 13 | *.local 14 | 15 | # Editor directories and files 16 | .vscode/* 17 | !.vscode/extensions.json 18 | .idea 19 | .DS_Store 20 | *.suo 21 | *.ntvs* 22 | *.njsproj 23 | *.sln 24 | *.sw? 25 | 26 | # Misc directories & files 27 | coverage/* 28 | .stylelintcache 29 | -------------------------------------------------------------------------------- /cms_v3/buildchain/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG TAG=22-alpine 2 | FROM node:$TAG 3 | 4 | RUN npm install -g npm@^11.0.0 5 | 6 | WORKDIR /app/buildchain 7 | 8 | CMD ["run build"] 9 | 10 | ENTRYPOINT ["npm"] 11 | -------------------------------------------------------------------------------- /cms_v3/buildchain/Makefile: -------------------------------------------------------------------------------- 1 | MAJOR_VERSION?=3 2 | TAG?=22-alpine 3 | CONTAINER?=$(shell basename $(dir $(CURDIR)))-v${MAJOR_VERSION}-buildchain 4 | DEV_PORT?=400${MAJOR_VERSION} 5 | IMAGE_INFO=$(shell docker image inspect $(CONTAINER):$(TAG)) 6 | IMAGE_NAME=${CONTAINER}:${TAG} 7 | DOCKER_RUN=docker container run --rm -it --network plugindev_default -l dev.orbstack.domains=vite_v${MAJOR_VERSION}.plugindev.local -v "${CURDIR}"/../:/app 8 | 9 | .PHONY: build clean dev image-build image-check npm ssh 10 | 11 | # Perform a dist build via npm run build 12 | build: image-check 13 | ${DOCKER_RUN} --name ${CONTAINER}-$@ ${IMAGE_NAME} run build 14 | # Remove node_modules/ & package-lock.json 15 | clean: 16 | rm -rf node_modules/ 17 | rm -f package-lock.json 18 | # Run the development server via npm run dev 19 | dev: image-check 20 | ${DOCKER_RUN} --name ${CONTAINER}-$@ -e DEV_PORT="${DEV_PORT}" -p ${DEV_PORT}:${DEV_PORT} ${IMAGE_NAME} run dev 21 | # Build the Docker image & run npm install 22 | image-build: 23 | docker build . -t ${IMAGE_NAME} --build-arg TAG=${TAG} --no-cache 24 | ${DOCKER_RUN} --name ${CONTAINER}-$@ ${IMAGE_NAME} install 25 | # Ensure the image has been created 26 | image-check: 27 | ifeq ($(IMAGE_INFO), []) 28 | image-check: image-build 29 | endif 30 | # Run the passed in npm command 31 | npm: image-check 32 | ${DOCKER_RUN} --name ${CONTAINER}-$@ ${IMAGE_NAME} $(filter-out $@,$(MAKECMDGOALS)) $(MAKEFLAGS) 33 | # Run the passed in npx command 34 | npx: image-check 35 | ${DOCKER_RUN} --name ${CONTAINER}-$@ -it --entrypoint=/usr/local/bin/npx ${IMAGE_NAME} $(filter-out $@,$(MAKECMDGOALS)) $(MAKEFLAGS) 36 | # Open a shell inside of the container 37 | ssh: image-check 38 | ${DOCKER_RUN} --name ${CONTAINER}-$@ --entrypoint=/bin/sh ${IMAGE_NAME} 39 | %: 40 | @: 41 | # ref: https://stackoverflow.com/questions/6273608/how-to-pass-argument-to-makefile-from-command-line 42 | -------------------------------------------------------------------------------- /cms_v3/buildchain/README.md: -------------------------------------------------------------------------------- 1 | # Vite buildchain 2 | 3 | The buildchain is a self-contained build system for a demo Vite `^6.0.0` setup. 4 | 5 | ## Overview 6 | 7 | The buildchain exists primarily as testbed Vite setup for testing the Craft Vite plugin, as well as a general playground for using Vite. 8 | 9 | It uses: 10 | 11 | * Vite `^6.0.0` 12 | * TailwindCSS `^4.0.0` 13 | * Vue `^3.0.0` 14 | * `eslint`, `stylelint`, & `vue-tsc` code linting tools 15 | * TypeScript (latest) 16 | 17 | ## Prerequisites 18 | 19 | To run the buildchain for development purposes: 20 | 21 | - You must have [Docker Desktop](https://www.docker.com/products/docker-desktop/) (or the equivalent) installed 22 | 23 | ## Commands 24 | 25 | This buildchain uses `make` as an interface to the buildchain. The following commands are available from the `buildchain/` directory: 26 | 27 | - `make build` - Do a distribution build of the static assets into `../web/dist/` 28 | - `make dev` - Start Vite HMR dev server for local development 29 | - `make clean` - Remove `node_modules/` and `package-lock.json` to start clean (need to run `make image-build` after doing this, see below) 30 | - `make npm XXX` - Run an `npm` command inside the container, e.g.: `make npm run lint` or `make npm install` 31 | - `make npx XXX` - Run an `npx` command inside the container, e.g.: `make npx @tailwindcss/upgrade@next` 32 | - `make ssh` - Open up a shell session into the buildchain Docker container 33 | - `make image-build` - Build the Docker image & run `npm install` 34 | 35 | ## File Structure 36 | 37 | Source files: 38 | 39 | `buildchain/src/` 40 | 41 | Built distribution files: 42 | 43 | `../web/dist/` 44 | 45 | ## Running 46 | 47 | To get the buildchain up and running, type the following into your terminal: 48 | 49 | ```bash 50 | make dev 51 | ``` 52 | 53 | This starts up the Vite dev server. 54 | 55 | The first time you do this, it may take some time to build the Docker container, and install all of the npm packages. Subsequent startup times will be much faster. 56 | 57 | ## Using 58 | 59 | The appropriate `config/vite.php` is already included in `plugindev`. The have the scripts load, just add this to your templates: 60 | 61 | ```twig 62 | {% block headScripts %} 63 | {{ craft.vite.script("src/js/app.ts") }} 64 | {{ craft.vite.script("src/js/welcome.ts") }} 65 | {% endblock headScripts %} 66 | ``` 67 | 68 | The `app.ts` just includes our CSS and an icon, while the `welcome.ts` mounts a Vue component that generates confetti. 69 | 70 | To get the confettit to appear, you just need to add the following to your template: 71 | 72 | ```twig 73 | {% block preContent %} 74 |
75 | {% endblock preContent %} 76 | ``` 77 | 78 | ...so that the Vue component has a root element to mount to. 79 | -------------------------------------------------------------------------------- /cms_v3/buildchain/eslint.config.js: -------------------------------------------------------------------------------- 1 | import globals from "globals"; 2 | import pluginJs from "@eslint/js"; 3 | import tseslint from "typescript-eslint"; 4 | import pluginVue from "eslint-plugin-vue"; 5 | 6 | 7 | /** @type {import('eslint').Linter.Config[]} */ 8 | export default [ 9 | {files: ["**/*.{js,mjs,cjs,ts,vue}"]}, 10 | {languageOptions: { globals: globals.browser }}, 11 | pluginJs.configs.recommended, 12 | ...tseslint.configs.recommended, 13 | ...pluginVue.configs["flat/essential"], 14 | {files: ["**/*.vue"], languageOptions: {parserOptions: {parser: tseslint.parser}}}, 15 | ]; -------------------------------------------------------------------------------- /cms_v3/buildchain/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "buildchain", 3 | "description": "A drop-in buildchain for using Vite in your Craft CMS plugins or modules", 4 | "type": "module", 5 | "author": { 6 | "email": "info@nystudio107.com", 7 | "name": "nystudio107", 8 | "url": "https://nystudio107.com" 9 | }, 10 | "dependencies": { 11 | "vue": "^3.2.0", 12 | "vue-confetti": "^2.0.8" 13 | }, 14 | "devDependencies": { 15 | "@eslint/js": "^9.19.0", 16 | "@types/node": "^22.0.0", 17 | "@tailwindcss/vite": "^4.0.0", 18 | "@vitejs/plugin-vue": "^5.0.0", 19 | "@vue/compiler-sfc": "^3.0.0", 20 | "eslint": "^9.19.0", 21 | "eslint-plugin-vue": "^9.0.0", 22 | "globals": "^15.0.0", 23 | "rollup-plugin-visualizer": "^5.0.0", 24 | "stylelint": "^16.0.0", 25 | "stylelint-config-recommended": "^15.0.0", 26 | "stylelint-config-recommended-vue": "^1.0.0", 27 | "stylelint-config-standard-scss": "^14.0.0", 28 | "tailwindcss": "^4.0.0", 29 | "typescript-eslint": "^8.0.0", 30 | "vite": "^6.0.0", 31 | "vite-plugin-checker": "^0.8.0", 32 | "vite-plugin-compression": "^0.5.0", 33 | "vite-plugin-manifest-sri": "^0.2.0", 34 | "vite-plugin-restart": "^0.4.0", 35 | "vue-tsc": "^2.0.0" 36 | }, 37 | "scripts": { 38 | "dev": "vite", 39 | "build": "vite build" 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /cms_v3/buildchain/src/css/app.css: -------------------------------------------------------------------------------- 1 | /** 2 | * app.css 3 | * 4 | * The entry point for the css. 5 | * 6 | */ 7 | 8 | @import "./tailwind-config.css"; 9 | 10 | @import "./components/webfonts.css"; 11 | @import "./components/typography.css"; 12 | @import "./components/global.css"; 13 | 14 | /** 15 | * Include styles for individual pages 16 | * 17 | */ 18 | @import "./pages/settings.css"; 19 | @import "./pages/welcome.css"; 20 | 21 | /** 22 | * Include vendor css. 23 | * 24 | */ 25 | @import "./vendor.css"; 26 | -------------------------------------------------------------------------------- /cms_v3/buildchain/src/css/components/global.css: -------------------------------------------------------------------------------- 1 | /** 2 | * components/global.css 3 | * 4 | * Project-wide styles 5 | * 6 | */ 7 | -------------------------------------------------------------------------------- /cms_v3/buildchain/src/css/components/typography.css: -------------------------------------------------------------------------------- 1 | /** 2 | * components/typography.css 3 | * 4 | * Typography rules. 5 | * 6 | */ 7 | -------------------------------------------------------------------------------- /cms_v3/buildchain/src/css/components/webfonts.css: -------------------------------------------------------------------------------- 1 | /** 2 | * components/webfonts.css 3 | * 4 | * Project webfonts. 5 | * 6 | */ 7 | -------------------------------------------------------------------------------- /cms_v3/buildchain/src/css/pages/settings.css: -------------------------------------------------------------------------------- 1 | /** 2 | * pages/settings.css 3 | * 4 | * Styles for the Settings page. 5 | * 6 | */ 7 | -------------------------------------------------------------------------------- /cms_v3/buildchain/src/css/pages/welcome.css: -------------------------------------------------------------------------------- 1 | /** 2 | * pages/settings.css 3 | * 4 | * Styles for the Welcome page. 5 | * 6 | */ 7 | -------------------------------------------------------------------------------- /cms_v3/buildchain/src/css/tailwind-config.css: -------------------------------------------------------------------------------- 1 | /** 2 | * tailwind-config.css 3 | * 4 | * CSS-based configuration for Tailwind CSS 5 | * ref: https://tailwindcss.com/docs/theme 6 | */ 7 | 8 | @import "tailwindcss"; 9 | 10 | @source "../../../src/templates"; 11 | -------------------------------------------------------------------------------- /cms_v3/buildchain/src/css/vendor.css: -------------------------------------------------------------------------------- 1 | /** 2 | * vendor.css 3 | * 4 | * All vendor CSS is imported here. 5 | * 6 | */ 7 | -------------------------------------------------------------------------------- /cms_v3/buildchain/src/js/@types/shims.d.ts: -------------------------------------------------------------------------------- 1 | declare module "app"; 2 | -------------------------------------------------------------------------------- /cms_v3/buildchain/src/js/Confetti.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nystudio107/plugindev/7a01d2cd87b5acb2e8159f4e0363e750f0f9101c/cms_v3/buildchain/src/js/Confetti.ts -------------------------------------------------------------------------------- /cms_v3/buildchain/src/js/app.ts: -------------------------------------------------------------------------------- 1 | // Import our CSS 2 | import '@/css/app.css'; 3 | -------------------------------------------------------------------------------- /cms_v3/buildchain/src/js/welcome.ts: -------------------------------------------------------------------------------- 1 | import App from '@/vue/App.vue'; 2 | import { createApp } from 'vue'; 3 | 4 | // App main 5 | const main = async () => { 6 | // Create our vue instance 7 | const app = createApp(App); 8 | // Mount the app 9 | const root = app.mount('#app-container'); 10 | 11 | return root; 12 | }; 13 | 14 | // Execute async function 15 | main().then( () => { 16 | console.log(); 17 | }); 18 | -------------------------------------------------------------------------------- /cms_v3/buildchain/src/vue/@types/confetti.d.ts: -------------------------------------------------------------------------------- 1 | declare module "vue-confetti/src/confetti.js"; 2 | 3 | interface ConfettiInterface { 4 | start(opts: Partial