@fishawack/lab-env 5.10.1-beta.1 → 5.11.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.prettierignore +1 -0
- package/CHANGELOG.md +14 -0
- package/README.md +100 -0
- package/commands/create/libs/vars.js +1 -1
- package/commands/create/templates/elasticbeanstalk/.ebextensions/wordpress/cron.config +10 -3
- package/commands/create/templates/elasticbeanstalk/.ebextensions/wordpress/post-deploy.config +4 -0
- package/commands/create/templates/elasticbeanstalk/.platform/confighooks/prebuild/setvars.sh +6 -1
- package/commands/create/templates/elasticbeanstalk/.platform/hooks/prebuild/setvars.sh +6 -1
- package/commands/create/templates/elasticbeanstalk/.platform/hooks/predeploy/deactivate-plugins.sh +6 -2
- package/eslint.config.js +1 -0
- package/package.json +1 -1
- package/stylelint.config.js +1 -0
- /package/commands/create/templates/elasticbeanstalk/.ebextensions/{laravel → misc}/rds-ssl.config +0 -0
package/.prettierignore
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
## Changelog
|
|
2
2
|
|
|
3
|
+
### 5.11.0-beta.1 (2026-11-23)
|
|
4
|
+
|
|
5
|
+
#### Features
|
|
6
|
+
|
|
7
|
+
* wordpress now automatically syncs acf ([69c549a](https://bitbucket.org/fishawackdigital/lab-env/commits/69c549a1589a61b3a330a19678378ddc5e50c412))
|
|
8
|
+
|
|
9
|
+
#### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* ignore wordpress files in linting now that they no longer sit in volume ([e83a98e](https://bitbucket.org/fishawackdigital/lab-env/commits/e83a98e2ba37b12659c24882b5ac935868bd0b79))
|
|
12
|
+
* moved rds-ssl to shared misc config ([26e31c2](https://bitbucket.org/fishawackdigital/lab-env/commits/26e31c2cadb252ea9f771bc96aac3b6100b31c9f))
|
|
13
|
+
* setvars now also populates plain text secrets if present ([5a08e6a](https://bitbucket.org/fishawackdigital/lab-env/commits/5a08e6a8a09a915aef0d4bb654886417766ae87c))
|
|
14
|
+
* updated deactivate plugins for aws linux 2023 ([43fa437](https://bitbucket.org/fishawackdigital/lab-env/commits/43fa4371601899d1b39d1e44661ad8abe2f2e6f3))
|
|
15
|
+
* updated wordpress cron for linux 2023 ([ff4623c](https://bitbucket.org/fishawackdigital/lab-env/commits/ff4623c72f4ae7f94ce9b15893ff16f1908d06cf))
|
|
16
|
+
|
|
3
17
|
### 5.10.1-beta.1 (2026-11-19)
|
|
4
18
|
|
|
5
19
|
#### Bug Fixes
|
package/README.md
CHANGED
|
@@ -141,6 +141,106 @@ The AWS profile needs `elasticbeanstalk:DescribeEnvironments`,
|
|
|
141
141
|
`elasticbeanstalk:ApplyEnvironmentManagedAction` permissions. This command does
|
|
142
142
|
not enable managed updates or schedule new ones.
|
|
143
143
|
|
|
144
|
+
### Provisioning Elastic Beanstalk Environments
|
|
145
|
+
|
|
146
|
+
`fw provision` (alias `fw prov`) creates the AWS infrastructure for a branch.
|
|
147
|
+
Static sites get an S3 bucket and CloudFront distribution. Fullstack sites get
|
|
148
|
+
an Elastic Beanstalk environment plus the optional services selected at the
|
|
149
|
+
prompts (RDS, S3, and for Laravel OpenSearch, cache and SES mail). When a
|
|
150
|
+
database is requested you are offered the choice of restoring it from one of
|
|
151
|
+
the account's manual RDS snapshots instead of creating an empty one. The
|
|
152
|
+
resulting `deploy` config is printed and copied to the clipboard.
|
|
153
|
+
`fw deprovision` (alias `fw deprov`) tears it back down.
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
fw prov
|
|
157
|
+
fw prov --branch production
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
#### Green/blue clones (`--green-blue`)
|
|
161
|
+
|
|
162
|
+
`fw prov --green-blue <source-branch>` (alias `-g`) creates a second Elastic
|
|
163
|
+
Beanstalk environment that is a copy of an existing one, so a new release can
|
|
164
|
+
be stood up and checked alongside the live site before traffic is moved over.
|
|
165
|
+
It is a completely separate path from a normal provision: none of the stack,
|
|
166
|
+
framework, database, storage or domain prompts are shown, because everything is
|
|
167
|
+
read from the source environment.
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
# Clone the environment that was provisioned for the `production` branch into
|
|
171
|
+
# a new environment for the `production-green` branch
|
|
172
|
+
fw prov --green-blue production --branch production-green
|
|
173
|
+
|
|
174
|
+
# Tear the clone down again once it is no longer needed
|
|
175
|
+
fw deprov --green-blue production --branch production-green
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
- `--green-blue` (`-g`) takes the **branch name of the source environment**. It
|
|
179
|
+
is used to work out the names of the source's RDS, OpenSearch and cache
|
|
180
|
+
security groups, so it must match the branch the source was provisioned with.
|
|
181
|
+
- `--branch` (`-b`) is the branch for the **new** environment and defaults to
|
|
182
|
+
the current git branch. If it resolves to the same environment name as the
|
|
183
|
+
source you are prompted for a different one (defaulting to `<branch>-green`).
|
|
184
|
+
|
|
185
|
+
**What the command does**
|
|
186
|
+
|
|
187
|
+
1. Prompts for the AWS account and region, then lists every Elastic Beanstalk
|
|
188
|
+
environment across all applications in that account/region so you can pick
|
|
189
|
+
the one to clone. It refuses to continue if the clone's name is already in
|
|
190
|
+
use by a non-terminated environment.
|
|
191
|
+
2. Reads the source's configuration and copies these settings across: plain and
|
|
192
|
+
secret environment variables, instance type and auto scaling, VPC and
|
|
193
|
+
subnets, the load balancer's default and `443` listeners (including the ACM
|
|
194
|
+
certificate), the default process and health check settings, health
|
|
195
|
+
reporting, managed updates and CloudWatch log streaming. The environment name
|
|
196
|
+
is not copied and empty values are skipped. `HealthCheckGracePeriod` is
|
|
197
|
+
raised to `600` seconds (when the source has it set) to give the first deploy
|
|
198
|
+
time to finish.
|
|
199
|
+
3. Sets `SECRET_MIRROR_ENV` to the source environment's name. The `setvars.sh`
|
|
200
|
+
prebuild hook uses it to read the source's Secrets Manager secrets
|
|
201
|
+
(`<source-env>-app`, `-database`, ...) instead of looking for ones named
|
|
202
|
+
after the clone. No secrets are created for the clone.
|
|
203
|
+
4. Creates the environment in the same Elastic Beanstalk application, deploying
|
|
204
|
+
the **application version the source is currently running**, and waits for
|
|
205
|
+
it to reach `Ready`. It is tagged with `repository`, `environment`
|
|
206
|
+
(inherited from the source, otherwise guessed from the branch name),
|
|
207
|
+
`branch`, `automated` and `cloned-from` (the source environment's name), and
|
|
208
|
+
gets its own `fw-auto-*.elasticbeanstalk.com` URL.
|
|
209
|
+
5. Adds the clone's security group to the source's RDS security group, and to
|
|
210
|
+
its OpenSearch and cache security groups when the source uses them.
|
|
211
|
+
6. Writes the `_IaC/<branch>/` config files and prints the `deploy` config,
|
|
212
|
+
which includes a `cloned-from` entry, for you to add to your pipeline config.
|
|
213
|
+
|
|
214
|
+
**What it does not do**
|
|
215
|
+
|
|
216
|
+
- It does not create a database, bucket, cache or OpenSearch domain. The clone
|
|
217
|
+
shares the source's, so both environments read and write the **same data**,
|
|
218
|
+
and a deploy to the clone that runs migrations migrates the live database.
|
|
219
|
+
- It does not move any traffic or touch DNS. The clone is only reachable on its
|
|
220
|
+
own `fw-auto-*` URL until you point your domain at it yourself. Because the
|
|
221
|
+
`443` listener and certificate are copied, HTTPS works as soon as DNS does.
|
|
222
|
+
- It does not copy data or take a snapshot.
|
|
223
|
+
|
|
224
|
+
**Tearing a clone down**
|
|
225
|
+
|
|
226
|
+
`fw deprov --green-blue <source-branch> --branch <clone-branch>` removes the
|
|
227
|
+
clone's access to the source's RDS, OpenSearch and cache security groups and
|
|
228
|
+
terminates the clone's environment. It never deletes any of the shared
|
|
229
|
+
resources and, unlike a normal deprovision, does not ask which ones to remove.
|
|
230
|
+
Pass the same `--branch` that was used when cloning.
|
|
231
|
+
|
|
232
|
+
**Known limitations**
|
|
233
|
+
|
|
234
|
+
- The clone is always created on the `PHP 8.2` Elastic Beanstalk platform,
|
|
235
|
+
regardless of the platform the source runs on.
|
|
236
|
+
- The framework is only detected for Laravel, Adonis and Python sources, and
|
|
237
|
+
anything else is treated as Laravel. A WordPress or Drupal clone therefore
|
|
238
|
+
has its `_IaC/<branch>/` folder populated with the Laravel files, and the
|
|
239
|
+
Apache proxy setting is not carried across.
|
|
240
|
+
- A wrong `--green-blue` branch name does not stop the clone from being
|
|
241
|
+
created. The security group lookup fails quietly and the clone starts without
|
|
242
|
+
access to the source's database.
|
|
243
|
+
|
|
144
244
|
### Install
|
|
145
245
|
|
|
146
246
|
```bash
|
|
@@ -581,7 +581,6 @@ module.exports.eb = {
|
|
|
581
581
|
".ebextensions/laravel/cron.config",
|
|
582
582
|
".ebextensions/laravel/post-deploy.config",
|
|
583
583
|
".ebextensions/laravel/queue-worker.config",
|
|
584
|
-
".ebextensions/laravel/rds-ssl.config",
|
|
585
584
|
".ebextensions/laravel/software.config",
|
|
586
585
|
".platform/hooks/postdeploy/restart_queue.sh",
|
|
587
586
|
".platform/confighooks/postdeploy/restart_queue.sh",
|
|
@@ -611,6 +610,7 @@ module.exports.eb = {
|
|
|
611
610
|
".ebextensions/misc/asg-self-healing.config",
|
|
612
611
|
".ebextensions/misc/alb-http-to-https-redirection.config",
|
|
613
612
|
".ebextensions/misc/enable-https-lb.config",
|
|
613
|
+
".ebextensions/misc/rds-ssl.config",
|
|
614
614
|
],
|
|
615
615
|
},
|
|
616
616
|
merge(type, config, data = {}) {
|
|
@@ -5,8 +5,12 @@ files:
|
|
|
5
5
|
group: root
|
|
6
6
|
content: |
|
|
7
7
|
#!/bin/bash
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
# Get IMDSv2 token for metadata requests (required for Amazon Linux 2023)
|
|
9
|
+
TOKEN=`curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600" 2>/dev/null`
|
|
10
|
+
|
|
11
|
+
# Get instance metadata using IMDSv2
|
|
12
|
+
INSTANCE_ID=`curl -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/instance-id 2>/dev/null`
|
|
13
|
+
REGION=`curl -H "X-aws-ec2-metadata-token: $TOKEN" -s http://169.254.169.254/latest/dynamic/instance-identity/document 2>/dev/null | jq -r .region`
|
|
10
14
|
|
|
11
15
|
# Find the Auto Scaling Group name from the Elastic Beanstalk environment
|
|
12
16
|
ASG=`aws ec2 describe-tags --filters "Name=resource-id,Values=$INSTANCE_ID" \
|
|
@@ -26,7 +30,10 @@ files:
|
|
|
26
30
|
group: root
|
|
27
31
|
content: |
|
|
28
32
|
#!/bin/bash
|
|
29
|
-
/usr/local/bin/is_first_instance.sh
|
|
33
|
+
if ! /usr/local/bin/is_first_instance.sh; then
|
|
34
|
+
echo "$(date -u) Not the first instance - skipping cron run"
|
|
35
|
+
exit 0
|
|
36
|
+
fi
|
|
30
37
|
cd /var/www/html && echo $(date -u) $(wp cron event run --due-now)
|
|
31
38
|
|
|
32
39
|
"/etc/cron.d/wordpress_cron":
|
package/commands/create/templates/elasticbeanstalk/.ebextensions/wordpress/post-deploy.config
CHANGED
|
@@ -12,6 +12,10 @@ container_commands:
|
|
|
12
12
|
command: "bash _Scripts/import-cpt.sh"
|
|
13
13
|
leader_only: true
|
|
14
14
|
ignoreErrors: true
|
|
15
|
+
45-import-acf:
|
|
16
|
+
command: "wp acf json sync"
|
|
17
|
+
leader_only: true
|
|
18
|
+
ignoreErrors: true
|
|
15
19
|
50-clear-cache:
|
|
16
20
|
command: "wp cli cache clear"
|
|
17
21
|
ignoreErrors: true
|
package/commands/create/templates/elasticbeanstalk/.platform/confighooks/prebuild/setvars.sh
CHANGED
|
@@ -7,7 +7,12 @@ REGION=$(TOKEN=$(curl -s -X PUT "http://169.254.169.254/latest/api/token" -H "X-
|
|
|
7
7
|
> /etc/profile.d/sh.local
|
|
8
8
|
> /etc/sysconfig/env
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
# Static (non-secret) EB option_settings, e.g. WP_CLI_ALLOW_ROOT, PATH
|
|
11
|
+
ENV_JSON=$(/opt/elasticbeanstalk/bin/get-config environment)
|
|
12
|
+
echo "$ENV_JSON" | jq -r 'to_entries | .[] | "export \(.key)='"'"'\(.value)'"'"'"' >> /etc/profile.d/sh.local
|
|
13
|
+
echo "$ENV_JSON" | jq -r 'to_entries | .[] | "\(.key)=\"\(.value)\""' >> /etc/sysconfig/env
|
|
14
|
+
|
|
15
|
+
for GROUP in app storage database opensearch cache mail; do
|
|
11
16
|
SECRET_JSON=$(aws secretsmanager get-secret-value \
|
|
12
17
|
--secret-id "${SECRET_ENV}-${GROUP}" \
|
|
13
18
|
--region "$REGION" \
|
|
@@ -7,7 +7,12 @@ REGION=$(TOKEN=$(curl -s -X PUT "http://169.254.169.254/latest/api/token" -H "X-
|
|
|
7
7
|
> /etc/profile.d/sh.local
|
|
8
8
|
> /etc/sysconfig/env
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
# Static (non-secret) EB option_settings, e.g. WP_CLI_ALLOW_ROOT, PATH
|
|
11
|
+
ENV_JSON=$(/opt/elasticbeanstalk/bin/get-config environment)
|
|
12
|
+
echo "$ENV_JSON" | jq -r 'to_entries | .[] | "export \(.key)='"'"'\(.value)'"'"'"' >> /etc/profile.d/sh.local
|
|
13
|
+
echo "$ENV_JSON" | jq -r 'to_entries | .[] | "\(.key)=\"\(.value)\""' >> /etc/sysconfig/env
|
|
14
|
+
|
|
15
|
+
for GROUP in app storage database opensearch cache mail; do
|
|
11
16
|
SECRET_JSON=$(aws secretsmanager get-secret-value \
|
|
12
17
|
--secret-id "${SECRET_ENV}-${GROUP}" \
|
|
13
18
|
--region "$REGION" \
|
package/commands/create/templates/elasticbeanstalk/.platform/hooks/predeploy/deactivate-plugins.sh
CHANGED
|
@@ -8,8 +8,12 @@ if [ ! -d "/var/app/current/" ]; then
|
|
|
8
8
|
exit 0;
|
|
9
9
|
fi
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
# Get IMDSv2 token for metadata requests (required for Amazon Linux 2023)
|
|
12
|
+
TOKEN=`curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600" 2>/dev/null`
|
|
13
|
+
|
|
14
|
+
# Get instance metadata using IMDSv2
|
|
15
|
+
INSTANCE_ID=`curl -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/instance-id 2>/dev/null`
|
|
16
|
+
REGION=`curl -H "X-aws-ec2-metadata-token: $TOKEN" -s http://169.254.169.254/latest/dynamic/instance-identity/document 2>/dev/null | jq -r .region`
|
|
13
17
|
AWSARG="--region $REGION --output json"
|
|
14
18
|
|
|
15
19
|
# Get elastic beanstalk environment name
|
package/eslint.config.js
CHANGED
package/package.json
CHANGED
package/stylelint.config.js
CHANGED
/package/commands/create/templates/elasticbeanstalk/.ebextensions/{laravel → misc}/rds-ssl.config
RENAMED
|
File without changes
|