diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b36fca..416326a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # nystudio107/craft Change Log +## 2.3.11 - 2020.09.15 +### Changed +* Explicitly set `id` from APP_ID and use `keyPrefix` for cache component +* + +## 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` diff --git a/cms/config/app.php b/cms/config/app.php index b113cbc..06633b6 100644 --- a/cms/config/app.php +++ b/cms/config/app.php @@ -20,6 +20,7 @@ use craft\helpers\App; return [ + 'id' => App::env('APP_ID') ?: 'CraftCMS', 'modules' => [ 'site-module' => [ 'class' => \modules\sitemodule\SiteModule::class, @@ -29,6 +30,7 @@ 'components' => [ 'cache' => [ 'class' => yii\redis\Cache::class, + 'keyPrefix' => App::env('APP_ID') ?: 'CraftCMS', 'redis' => [ 'hostname' => App::env('REDIS_HOSTNAME'), 'port' => App::env('REDIS_PORT'), diff --git a/cms/config/app.web.php b/cms/config/app.web.php index bf1f73b..bce148b 100644 --- a/cms/config/app.web.php +++ b/cms/config/app.web.php @@ -21,17 +21,17 @@ 'components' => [ 'session' => static function() { // Get the default component config - $config = craft\helpers\App::sessionConfig(); + $config = App::sessionConfig(); // Override the class to use Redis' session class and our config settings $config['class'] = yii\redis\Session::class; + $config['keyPrefix'] = App::env('APP_ID') ?: 'CraftCMS'; $config['redis'] = [ 'hostname' => App::env('REDIS_HOSTNAME'), 'port' => App::env('REDIS_PORT'), - 'database' => App::env('REDIS_CRAFT_DB'), + 'database' => App::env('REDIS_DEFAULT_DB'), ]; // Instantiate and return it return Craft::createObject($config); }, - ], ]; diff --git a/composer.json b/composer.json index 888827b..78bd6a0 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "craftcms/craft", "description": "nystudio107 Craft 3.4 CMS scaffolding project", - "version": "2.3.9", + "version": "2.3.11", "keywords": [ "craft", "cms", @@ -25,7 +25,7 @@ }, "autoload": { "psr-4": { - "modules\\": "modules/" + "modules\\sitemodule\\": "modules/sitemodule/src/" } }, "config": { @@ -41,7 +41,8 @@ "@php -r \"unlink('composer.json');\"", "@php -r \"unlink('composer.lock');\"", "@php -r \"unlink('LICENSE.md');\"", - "@php -r \"unlink('README.md');\"" + "@php -r \"unlink('README.md');\"", + "@composer dump-autoload -o" ] } } diff --git a/scripts/docker_prod_build.sh b/scripts/docker_prod_build.sh new file mode 100755 index 0000000..a4d3dad --- /dev/null +++ b/scripts/docker_prod_build.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +# Build production assets +# +# Build the production assets inside of the buildchain Docker container +# +# @author nystudio107 +# @copyright Copyright (c) 2020 nystudio107 +# @link https://nystudio107.com/ +# @package craft-scripts +# @since 1.2.2 +# @license MIT + +# Get the directory of the currently executing script +DIR="$(dirname "${BASH_SOURCE[0]}")" + +# Include files +INCLUDE_FILES=( + "common/defaults.sh" + ".env.sh" + ) +for INCLUDE_FILE in "${INCLUDE_FILES[@]}" +do + if [[ ! -f "${DIR}/${INCLUDE_FILE}" ]] ; then + echo "File ${DIR}/${INCLUDE_FILE} is missing, aborting." + exit 1 + fi + source "${DIR}/${INCLUDE_FILE}" +done + +# Temporary db dump path (remote & local) +if [[ -z "${LOCAL_BUILDCHAIN_CONTAINER}" ]]; then + echo "Variable LOCAL_BUILDCHAIN_CONTAINER is missing from .env.sh, aborting." +else + docker exec -it ${LOCAL_BUILDCHAIN_CONTAINER} npm run build +fi + +# Normal exit +exit 0 diff --git a/scripts/example.env.sh b/scripts/example.env.sh index 23a5178..70d093a 100644 --- a/scripts/example.env.sh +++ b/scripts/example.env.sh @@ -18,6 +18,7 @@ GLOBAL_DB_DRIVER="mysql" # -- LOCAL settings -- LOCAL_DB_CONTAINER="REPLACE_ME" +LOCAL_BUILDCHAIN_CONTAINER="REPLACE_ME" # -- REMOTE settings --