Skip to content

Commit c1b83f4

Browse files
committed
Merge branch 'release/2.2.12' into craft-webpack
2 parents 2e4c9ab + f9b4537 commit c1b83f4

27 files changed

+401
-74
lines changed

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
# nystudio107/craft Change Log
22

3+
## 2.2.12 - 2020.07.18
4+
### Added
5+
* Added TypeScript support
6+
* Use Vue.js 3.0
7+
* Added `buddy.yml` for atomic deployments
8+
9+
### Changed
10+
* Replaced moment with vanilla JavaScript
11+
* Replaced `getenv()` with `App::env()`
12+
* No longer use DSN for db connections
13+
* Switch from TSLint to ESLint
14+
15+
### Fixed
16+
* Fixed config path in the module `helpers/Config.php`
17+
318
## 2.2.11 - 2020.05.26
419
### Changed
520
* Use DSN for database connections

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ The project is based on [Craft CMS](https://CraftCMS.com) using a unique `templa
99
* [Docker](https://www.docker.com/) Docker is used for local development; see **Setting Up Local Dev** below for details
1010
* A base Twig templating setup as described in [An Effective Twig Base Templating Setup](https://nystudio107.com/blog/an-effective-twig-base-templating-setup)
1111
* [webpack](https://webpack.js.org/) is used for the build system as per [An Annotated webpack 4 Config for Frontend Web Development](https://nystudio107.com/blog/an-annotated-webpack-4-config-for-frontend-web-development)
12-
* [VueJS](https://vuejs.org/) is used for some of the interactive bits on the website as per
12+
* [TypeScript](https://www.typescriptlang.org/) for strictly typed JavaScript code
13+
* [Vue.js 3.0](https://vuejs.org/) is used for some of the interactive bits on the website, and Vue.js 3.x allows us to leverage the [Composition API](https://composition-api.vuejs.org/)
1314
* [Tailwind CSS](https://tailwindcss.com/) for the site-wide CSS
1415
* JSON-LD structured data as per [Annotated JSON-LD Structured Data Examples](https://nystudio107.com/blog/annotated-json-ld-structured-data-examples)
1516
* [Google AMP](https://developers.google.com/amp/) versions of the podcast episode and other pages
@@ -21,7 +22,7 @@ The project is based on [Craft CMS](https://CraftCMS.com) using a unique `templa
2122
* A custom site module as per [Enhancing a Craft CMS 3 Website with a Custom Module](https://nystudio107.com/blog/enhancing-a-craft-cms-3-website-with-a-custom-module)
2223
* CLI-based queue as per [Robust queue job handling in Craft CMS](https://nystudio107.com/blog/robust-queue-job-handling-in-craft-cms)
2324
* FastCGI Static Cache as per [Static Page Caching with Craft CMS](https://nystudio107.com/blog/static-caching-with-craft-cms)
24-
* [Craft-Scripts](https://github.com/nystudio107/craft-scripts) as described in the [Database & Asset Syncing Between Environments in Craft CMS](https://nystudio107.com/blog/database-asset-syncing-between-environments-in-craft-cms), [Mitigating Disaster via Website Backups](https://nystudio107.com/blog/mitigating-disaster-via-website-backups) & [Hardening Craft CMS Permissions](https://nystudio107.com/blog/hardening-craft-cms-permissions) articles
25+
* [buddy.works](http://buddy.works/) atomic deployments
2526

2627
...and probably a bunch of other stuff too.
2728

buddy.yml

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
- pipeline: "Build & Deploy to Production"
2+
trigger_mode: "ON_EVERY_PUSH"
3+
ref_name: "master"
4+
ref_type: "BRANCH"
5+
target_site_url: "https://CHANGEME.com/"
6+
trigger_condition: "ALWAYS"
7+
actions:
8+
- action: "Execute: webpack build"
9+
type: "BUILD"
10+
working_directory: "/buddy/$PROJECT_SHORTNAME"
11+
docker_image_name: "nystudio107/webpack-dev-base"
12+
docker_image_tag: "latest"
13+
execute_commands:
14+
- "cd docker-config/webpack-dev-craft"
15+
- "npm ci"
16+
- "npm run build"
17+
volume_mappings:
18+
- "/:/buddy/$PROJECT_SHORTNAME"
19+
trigger_condition: "ALWAYS"
20+
shell: "BASH"
21+
- action: "Execute: composer install"
22+
type: "BUILD"
23+
working_directory: "/buddy/$PROJECT_SHORTNAME"
24+
docker_image_name: "nystudio107/php-dev-base"
25+
docker_image_tag: "latest"
26+
execute_commands:
27+
- "cd cms"
28+
- "composer install --no-scripts --no-interaction --prefer-dist --optimize-autoloader --ignore-platform-reqs"
29+
setup_commands:
30+
- "echo \"memory_limit=-1\" >> /usr/local/etc/php/conf.d/buddy.ini"
31+
- "apt-get update && apt-get install -y git zip"
32+
- "curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer"
33+
- "# php ext pdo_mysql"
34+
- "docker-php-ext-install pdo_pgsql pgsql"
35+
volume_mappings:
36+
- "/:/buddy/$PROJECT_SHORTNAME"
37+
trigger_condition: "ALWAYS"
38+
shell: "BASH"
39+
- action: "Rsync files to production"
40+
type: "RSYNC"
41+
local_path: "cms/"
42+
remote_path: "$REMOTE_PROJECT_ROOT/deploy-cache"
43+
login: "$REMOTE_SSH_USER"
44+
host: "$REMOTE_SSH_HOST"
45+
port: "22"
46+
authentication_mode: "WORKSPACE_KEY"
47+
archive: true
48+
delete_extra_files: true
49+
recursive: true
50+
compress: true
51+
deployment_excludes:
52+
- "/.git/"
53+
trigger_condition: "ALWAYS"
54+
- action: "Atomic deploy"
55+
type: "SSH_COMMAND"
56+
working_directory: "$REMOTE_PROJECT_ROOT"
57+
login: "$REMOTE_SSH_USER"
58+
host: "$REMOTE_SSH_HOST"
59+
port: "22"
60+
authentication_mode: "WORKSPACE_KEY"
61+
commands:
62+
- "if [ -d \"releases/$BUDDY_EXECUTION_REVISION\" ] && [ \"$BUDDY_EXECUTION_REFRESH\" = \"true\" ];"
63+
- "then"
64+
- " echo \"Removing: releases/$BUDDY_EXECUTION_REVISION\""
65+
- " rm -rf releases/$BUDDY_EXECUTION_REVISION;"
66+
- "fi"
67+
- "if [ ! -d \"releases/$BUDDY_EXECUTION_REVISION\" ];"
68+
- "then"
69+
- " echo \"Creating: releases/$BUDDY_EXECUTION_REVISION\""
70+
- " cp -dR deploy-cache releases/$BUDDY_EXECUTION_REVISION;"
71+
- "fi"
72+
- "echo \"Creating: persistent directories\""
73+
- "mkdir -p storage"
74+
- "echo \"Symlinking: persistent files & directories\""
75+
- "ln -nfs $REMOTE_PROJECT_ROOT/.env $REMOTE_PROJECT_ROOT/releases/$BUDDY_EXECUTION_REVISION"
76+
- "ln -nfs $REMOTE_PROJECT_ROOT/storage $REMOTE_PROJECT_ROOT/releases/$BUDDY_EXECUTION_REVISION"
77+
- "ln -nfs $REMOTE_PROJECT_ROOT/transcoder $REMOTE_PROJECT_ROOT/releases/$BUDDY_EXECUTION_REVISION/web"
78+
- "echo \"Linking current to revision: $BUDDY_EXECUTION_REVISION\""
79+
- "rm -f current"
80+
- "ln -s releases/$BUDDY_EXECUTION_REVISION current"
81+
- "echo \"Removing old releases\""
82+
- "cd releases && ls -t | tail -n +11 | xargs rm -rf"
83+
trigger_condition: "ALWAYS"
84+
run_as_script: true
85+
shell: "BASH"
86+
- action: "Prep Craft CMS"
87+
type: "SSH_COMMAND"
88+
working_directory: "$REMOTE_PROJECT_ROOT/current"
89+
login: "$REMOTE_SSH_USER"
90+
host: "$REMOTE_SSH_HOST"
91+
port: "22"
92+
authentication_mode: "WORKSPACE_KEY"
93+
commands:
94+
- "# Ensure the craft script is executable"
95+
- "chmod a+x craft"
96+
- "# Restart our long running queue listener process"
97+
- "echo \"\" | sudo -S supervisorctl restart all"
98+
- "# Backup the database just in case any migrations or Project Config changes have issues"
99+
- "./craft backup/db"
100+
- "# Run pending migrations, sync project config, and clear caches"
101+
- "./craft migrate/all"
102+
- "./craft project-config/sync"
103+
- "./craft clear-caches/all"
104+
trigger_condition: "ALWAYS"
105+
run_as_script: true
106+
shell: "BASH"
107+
- action: "Send notification to nystudio107 channel"
108+
type: "SLACK"
109+
content: "[#$BUDDY_EXECUTION_ID] $BUDDY_EXECUTION_REVISION_SUBJECT - $BUDDY_EXECUTION_REVISION_COMMITTER_NAME"
110+
blocks: "[{\"type\":\"section\",\"fields\":[{\"type\":\"mrkdwn\",\"text\":\"*Successful execution:* <$BUDDY_EXECUTION_URL|Execution #$BUDDY_EXECUTION_ID $BUDDY_EXECUTION_COMMENT>\"},{\"type\":\"mrkdwn\",\"text\":\"*Pipeline:* <$BUDDY_PIPELINE_URL|$BUDDY_PIPELINE_NAME>\"},{\"type\":\"mrkdwn\",\"text\":\"*Branch:* $BUDDY_EXECUTION_BRANCH\"},{\"type\":\"mrkdwn\",\"text\":\"*Project:* <$BUDDY_PROJECT_URL|$BUDDY_PROJECT_NAME>\"}]}]"
111+
channel: "G6AKRT78V"
112+
channel_name: "nystudio107"
113+
trigger_condition: "ALWAYS"
114+
integration_hash: "5ef0d26820cfeb531cb10738"
115+
- action: "Send notification to nystudio107 channel"
116+
type: "SLACK"
117+
trigger_time: "ON_FAILURE"
118+
content: "[#$BUDDY_EXECUTION_ID] $BUDDY_EXECUTION_REVISION_SUBJECT - $BUDDY_EXECUTION_REVISION_COMMITTER_NAME"
119+
blocks: "[{\"type\":\"section\",\"fields\":[{\"type\":\"mrkdwn\",\"text\":\"*Failed execution:* <$BUDDY_EXECUTION_URL|Execution #$BUDDY_EXECUTION_ID $BUDDY_EXECUTION_COMMENT>\"},{\"type\":\"mrkdwn\",\"text\":\"*Pipeline:* <$BUDDY_PIPELINE_URL|$BUDDY_PIPELINE_NAME>\"},{\"type\":\"mrkdwn\",\"text\":\"*Branch:* $BUDDY_EXECUTION_BRANCH\"},{\"type\":\"mrkdwn\",\"text\":\"*Project:* <$BUDDY_PROJECT_URL|$BUDDY_PROJECT_NAME>\"}]}]"
120+
channel: "G6AKRT78V"
121+
channel_name: "nystudio107"
122+
trigger_condition: "ALWAYS"
123+
integration_hash: "5ef0d26820cfeb531cb10738"
124+
variables:
125+
- key: "PROJECT_SHORTNAME"
126+
value: "CHANGEME"
127+
- key: "PROJECT_URL"
128+
value: "https://CHANGEME.com"
129+
- key: "REMOTE_PROJECT_ROOT"
130+
value: "/home/forge/CHANGEME"
131+
- key: "REMOTE_SSH_HOST"
132+
value: "CHANGEME.com"
133+
- key: "REMOTE_SSH_USER"
134+
value: "forge"

cms/config/app.console.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,7 @@
1515
* This application config is applied only for *only* console requests
1616
*/
1717

18+
use craft\helpers\App;
19+
1820
return [
1921
];

cms/config/app.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
* your config/ folder, alongside this one.
1818
*/
1919

20+
use craft\helpers\App;
21+
2022
return [
2123
'modules' => [
2224
'site-module' => [

cms/config/app.web.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
* This application config is applied only for *only* web requests
1616
*/
1717

18+
use craft\helpers\App;
19+
1820
return [
1921
'components' => [
2022
'session' => [

cms/config/db.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@
1111
use craft\helpers\App;
1212

1313
return [
14-
'dsn' => App::env('DB_DSN'),
14+
'driver' => App::env('DB_DRIVER'),
15+
'server' => App::env('DB_SERVER'),
1516
'user' => App::env('DB_USER'),
1617
'password' => App::env('DB_PASSWORD'),
18+
'database' => App::env('DB_DATABASE'),
1719
'schema' => App::env('DB_SCHEMA'),
1820
'tablePrefix' => App::env('DB_TABLE_PREFIX'),
21+
'port' => App::env('DB_PORT'),
1922
];

cms/config/fastcgi-cache-bust.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
* @copyright Copyright (c) 2017 nystudio107
99
*/
1010

11+
use craft\helpers\App;
12+
1113
/**
1214
* FastCGI Cache Bust config.php
1315
*

cms/config/general.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
* @see \craft\config\GeneralConfig
99
*/
1010

11+
use craft\helpers\App;
12+
1113
return [
1214
// Craft config settings from .env variables
1315
'aliases' => [

cms/config/twigpack.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
* @copyright Copyright (c) 2018 nystudio107
1010
*/
1111

12+
use craft\helpers\App;
13+
1214
/**
1315
* Twigpack config.php
1416
*

0 commit comments

Comments
 (0)