-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuddy.yaml.example
138 lines (138 loc) · 4.78 KB
/
buddy.yaml.example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
- pipeline: 'Build and Deploy To Staging (AWS)'
variables:
- key: 'URL'
value: 'https://example.steadfa.st'
type: 'VAR'
- key: 'APP_NAME'
value: 'example.steadfa.st'
type: 'VAR'
- key: 'SERVER_IP'
value: '111.11.111.111'
events:
- type: 'PUSH'
refs:
- 'refs/heads/dev'
target_site_url: '$URL'
fetch_all_refs: true
actions:
- action: 'Install composer dependencies'
type: 'BUILD'
working_directory: '/buddy/app'
docker_image_name: 'library/php'
docker_image_tag: '8.3'
execute_commands:
- 'composer install --no-scripts --no-interaction --prefer-dist --optimize-autoloader --ignore-platform-reqs'
setup_commands:
- 'apt-get update && apt-get install -y git zip'
- 'curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer'
- '# php ext gd'
- 'apt-get install -y libfreetype6-dev'
- 'apt-get install -y libjpeg62-turbo-dev'
- 'apt-get install -y libpng-dev'
- 'docker-php-ext-configure gd --with-freetype --with-jpeg'
- 'docker-php-ext-install gd'
- '# php ext zip'
- 'apt-get install -y zip'
- 'apt-get install -y unzip'
- 'apt-get install -y zlib1g-dev'
- 'apt-get install -y libzip-dev'
- 'docker-php-ext-install zip'
- '# php ext pdo_mysql'
- 'docker-php-ext-configure pdo_mysql --with-pdo-mysql'
- 'docker-php-ext-install pdo_mysql'
shell: 'BASH'
volume_mappings:
- '/:/buddy/app'
cache_base_image: false
- action: 'Run Vite build'
type: 'BUILD'
working_directory: '/buddy/app'
docker_image_name: 'node'
docker_image_tag: '22.5.1-alpine3.20'
execute_commands:
- 'npm install'
- 'npm run build'
setup_commands:
- 'npm install -g @esbuild/linux-x64'
volume_mappings:
- '/:/buddy/app'
cache_base_image: false
- action: 'Deploy to deploy cache'
type: 'SFTP'
input_type: 'BUILD_ARTIFACTS'
local_path: '/'
remote_path: '/home/forge/$APP_NAME/deploy-cache'
login: 'forge'
host: '$SERVER_IP'
port: '22'
env_key: 'secure!neSiPiqgzT5xpflRL3C1dw==.0Tuqda3u2+2RGeNv3X1pcg=='
authentication_mode: 'ENV_KEY'
deployment_excludes:
- '/.git/'
- '/web/cpresources/*'
- '/storage/*'
- '/.ddev/*'
- '/node_modules/*'
- '/.editorconfig'
- '/.env.local'
- '/.gitignore'
- '/.prettierignore'
- '/.prettierrc.cjs'
- '/buddy.yml'
- '/carbon-setup.md'
- '/composer.json'
- '/composer.lock'
- '/package-lock.json'
- '/package.json'
- '/README.md'
- '/seed.sql'
- '/swiff.config.js'
- '/yarn.lock'
- action: 'Post-deployment action'
type: 'SSH_COMMAND'
working_directory: '/home/forge/$APP_NAME'
login: 'forge'
host: '$SERVER_IP'
env_key: 'secure!neSiPiqgzT5xpflRL3C1dw==.0Tuqda3u2+2RGeNv3X1pcg=='
authentication_mode: 'ENV_KEY'
commands:
- 'if [ -d "releases/$BUDDY_EXECUTION_REVISION" ] && [ "$BUDDY_EXECUTION_REFRESH" = "true" ];'
- 'then'
- ' echo "Removing: releases/$BUDDY_EXECUTION_REVISION"'
- ' rm -rf releases/$BUDDY_EXECUTION_REVISION;'
- 'fi'
- ''
- 'if [ ! -d "releases/$BUDDY_EXECUTION_REVISION" ];'
- 'then'
- ' echo "Creating: releases/$BUDDY_EXECUTION_REVISION"'
- ' cp -dR deploy-cache releases/$BUDDY_EXECUTION_REVISION;'
- 'fi'
- ''
- 'echo "Creating: persistent directories"'
- 'mkdir -p storage'
- 'mkdir -p cpresources'
- ''
- 'echo "Symlinking: persistent files & directories"'
- 'ln -nfs "$(pwd)/.env" releases/$BUDDY_EXECUTION_REVISION'
- 'ln -nfs "$(pwd)/storage" releases/$BUDDY_EXECUTION_REVISION'
- 'ln -nfs "$(pwd)/cpresources" releases/$BUDDY_EXECUTION_REVISION/web'
- ''
- 'echo "Linking current to revision: $BUDDY_EXECUTION_REVISION"'
- 'rm -f current'
- 'ln -s releases/$BUDDY_EXECUTION_REVISION current'
- ''
- 'echo "Removing old releases"'
- 'cd releases && ls -t | tail -n +11 | xargs rm -rf'
run_as_script: true
- action: 'Migrate Craft and clear caches'
type: 'SSH_COMMAND'
working_directory: '/home/forge/$APP_NAME/current'
login: 'forge'
host: '$SERVER_IP'
env_key: 'secure!neSiPiqgzT5xpflRL3C1dw==.0Tuqda3u2+2RGeNv3X1pcg=='
authentication_mode: 'ENV_KEY'
commands:
- 'chmod a+x craft'
- 'php8.3 craft migrate/all'
- 'php8.3 craft project-config/apply --force'
- 'php8.3 craft clear-caches/all'