@fishawack/lab-env 5.1.0 → 5.2.0-beta.2

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.
Files changed (46) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/_Test/key.js +7 -2
  3. package/_Test/provision.js +9 -19
  4. package/_Test/s3.js +10 -6
  5. package/adonis/0/docker-compose.yml +2 -0
  6. package/adonis/0/nginx/CHANGELOG.md +3 -0
  7. package/adonis/0/nginx/nginx.conf +5 -1
  8. package/adonis/0/nginx/package.json +2 -2
  9. package/bitbucket-pipelines.yml +1 -1
  10. package/cli.js +1 -1
  11. package/commands/content.js +36 -25
  12. package/commands/create/cmds/deprovision.js +10 -2
  13. package/commands/create/cmds/provision.js +13 -2
  14. package/commands/create/libs/prompts.js +9 -0
  15. package/commands/create/libs/vars.js +67 -35
  16. package/commands/create/services/aws/cloudfront.js +17 -20
  17. package/commands/create/services/aws/ec2.js +2 -3
  18. package/commands/create/services/aws/elasticbeanstalk.js +11 -14
  19. package/commands/create/services/aws/iam.js +123 -65
  20. package/commands/create/services/aws/index.js +35 -35
  21. package/commands/create/services/aws/misc.js +6 -7
  22. package/commands/create/services/aws/s3.js +16 -16
  23. package/commands/create/templates/elasticbeanstalk/.ebextensions/misc/asg-self-healing.config +6 -0
  24. package/commands/create/templates/elasticbeanstalk/.ebextensions/misc/health-ignore-4xx.config +4 -0
  25. package/commands/test.js +11 -11
  26. package/core/0/package.json +1 -1
  27. package/craftcms/3/apache/package.json +1 -1
  28. package/craftcms/3/php/package.json +1 -1
  29. package/drupal/9/apache/package.json +1 -1
  30. package/drupal/9/php/package.json +1 -1
  31. package/globals.js +15 -0
  32. package/laravel/10/docker-compose.yml +2 -0
  33. package/laravel/8/docker-compose.yml +2 -0
  34. package/laravel/8/nginx/CHANGELOG.md +3 -0
  35. package/laravel/8/nginx/nginx.conf +5 -1
  36. package/laravel/8/nginx/package.json +2 -2
  37. package/laravel/8/php/package.json +1 -1
  38. package/laravel/9/docker-compose.yml +2 -0
  39. package/package.json +1 -1
  40. package/php/8.2/package.json +1 -1
  41. package/python/0/Dockerfile +8 -0
  42. package/python/0/docker-compose.yml +4 -1
  43. package/python/0/package.json +11 -0
  44. package/wordpress/0/package.json +1 -1
  45. package/wordpress/1/apache/package.json +1 -1
  46. package/wordpress/1/php/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,48 @@
1
1
  ## Changelog
2
2
 
3
+ ### 5.2.0-beta.2 (2026-01-17)
4
+
5
+ #### Bug Fixes
6
+
7
+ * make nginx depend on web server to stop race condition errors ([16f6b11](https://bitbucket.org/fishawackdigital/lab-env/commits/16f6b11592107bcbdd1d2dc5e32cc4312b1e2909))
8
+ * nginx now resolves on request rather than start time to avoid race conditions ([7cb6356](https://bitbucket.org/fishawackdigital/lab-env/commits/7cb6356b5628534aa6487178e1cc988e645b0771))
9
+ * python now has access to webDev commands like install and runs npm test ([44c2cf3](https://bitbucket.org/fishawackdigital/lab-env/commits/44c2cf3d7287ad1c34e87917334a95d565793ab4))
10
+
11
+ #### Build Updates
12
+
13
+ * bumped fishawack/lab-env-adonis-0-nginx to 1.0.1 ([337f993](https://bitbucket.org/fishawackdigital/lab-env/commits/337f993c4eac2d1a253c38c87f20d50577d66959))
14
+ * bumped fishawack/lab-env-laravel-8-nginx to 0.1.3 ([5aa1a0e](https://bitbucket.org/fishawackdigital/lab-env/commits/5aa1a0e032319ba1f68117734bbb3ea6a6920148))
15
+ * login to docker before tests ([ee005ff](https://bitbucket.org/fishawackdigital/lab-env/commits/ee005ff06a146ef1060dc8a24ace80e2b94691f5))
16
+
17
+ ### 5.2.0-beta.1 (2026-01-14)
18
+
19
+ #### Features
20
+
21
+ * added ignore 4xx and self healing configs to default high avail provision ([d8d2748](https://bitbucket.org/fishawackdigital/lab-env/commits/d8d27484973779e7954a23618f1af98fcb698a7b))
22
+ * can now set region for prov and deprov commands ([2a2d06e](https://bitbucket.org/fishawackdigital/lab-env/commits/2a2d06e8a3bb1fff4b25cea41f1027aa0d6949f7))
23
+ * database now only added if asked for via prompt ([dc890bb](https://bitbucket.org/fishawackdigital/lab-env/commits/dc890bb52bf44cc529a0ec47e621fa0b0eea2d51))
24
+ * flatten environment settings so nested objects can be set together that share conditions ([5bbcc30](https://bitbucket.org/fishawackdigital/lab-env/commits/5bbcc301e93789c6e0bad05e321ff66f80f973cb))
25
+ * objects in environemnt settings now takes a method to allow customization ([d1a2456](https://bitbucket.org/fishawackdigital/lab-env/commits/d1a24567c45ef98840766555debde9932b90ad6c))
26
+ * python now has a self authored based image allowing overriding ([3a3827c](https://bitbucket.org/fishawackdigital/lab-env/commits/3a3827c6b26a14fb204888f86c74494141bf6880))
27
+ * region is now a list rather than free text ([d1eceea](https://bitbucket.org/fishawackdigital/lab-env/commits/d1eceeaad271686b18cb8d8ef786c2b9c9aac070))
28
+ * setup custom managed elasticbeanstalk profile on new prov commands ([75559af](https://bitbucket.org/fishawackdigital/lab-env/commits/75559afbace897eebf380fe66df6d6ab22758fbb))
29
+ * switch subnets and vpc when switching between eu and us python services ([817d60a](https://bitbucket.org/fishawackdigital/lab-env/commits/817d60ade606716184074342c6e1d19a54115140))
30
+ * utilize python self authored image and allow overriding ([a63ae30](https://bitbucket.org/fishawackdigital/lab-env/commits/a63ae30213a7101d9030efe7b2240e8dc1b73053))
31
+
32
+ #### Bug Fixes
33
+
34
+ * added missing list tags permission ([bcff194](https://bitbucket.org/fishawackdigital/lab-env/commits/bcff19487d1b26ec2529309925cfb625733e4ed2))
35
+ * deprov no longer prompts for region ([2b3a627](https://bitbucket.org/fishawackdigital/lab-env/commits/2b3a62749463f6280ab52e1e6ed8d24e8d5a8f4a))
36
+ * handle errors on content command ([25e32bb](https://bitbucket.org/fishawackdigital/lab-env/commits/25e32bb78ded523ef25eee2b467dc4be7c05ca5f))
37
+ * only prompt for region on fullstack as cloudfront only supports us-east-1 ([53d8ef7](https://bitbucket.org/fishawackdigital/lab-env/commits/53d8ef7eb85d175ee5e684f34509f83f74a24f48))
38
+ * remove client from method params ([29b8423](https://bitbucket.org/fishawackdigital/lab-env/commits/29b84238c32742044dba867a90616506918a4d3e))
39
+ * use same role for service and managed updates ([4a69f4d](https://bitbucket.org/fishawackdigital/lab-env/commits/4a69f4d20c2231f8cffb95c4790f0e557ba59d57))
40
+
41
+ #### Build Updates
42
+
43
+ * bumped fishawack/lab-env-python-0 to 1.0.0 ([21d7da1](https://bitbucket.org/fishawackdigital/lab-env/commits/21d7da1bbdcf932fe74351882282577710bfb81d))
44
+ * updated auto bumped commands to pass linting ([437d2e8](https://bitbucket.org/fishawackdigital/lab-env/commits/437d2e8c9e9d183f955c17a8edb7186dc61f2e0f))
45
+
3
46
  ### 5.1.0 (2025-12-23)
4
47
 
5
48
  #### Features
package/_Test/key.js CHANGED
@@ -2,12 +2,17 @@
2
2
 
3
3
  const expect = require("chai").expect;
4
4
  const aws = require("../commands/create/services/aws/index.js");
5
+ const {
6
+ setAWSClientDefaults,
7
+ } = require("../commands/create/services/aws/misc.js");
5
8
 
6
9
  describe("key", async () => {
7
10
  let account = "fishawack";
8
11
 
9
12
  before(async () => {
10
- let res = await aws.iam.createFWIAMUser("fw-test-user", account);
13
+ setAWSClientDefaults(account);
14
+
15
+ let res = await aws.iam.createFWIAMUser("fw-test-user");
11
16
 
12
17
  // Wait for key as AWS doesn't provide a way to wait for it to becom eactive
13
18
  await new Promise((resolve) => setTimeout(() => resolve(), 10000));
@@ -32,6 +37,6 @@ describe("key", async () => {
32
37
  delete process.env.AWS_ACCESS_KEY_ID;
33
38
  delete process.env.AWS_SECRET_ACCESS_KEY;
34
39
 
35
- await aws.iam.removeIAMUser("fw-test-user", account);
40
+ await aws.iam.removeIAMUser("fw-test-user");
36
41
  });
37
42
  });
@@ -3,6 +3,9 @@
3
3
  const expect = require("chai").expect;
4
4
  const execSync = require("child_process").execSync;
5
5
  const aws = require("../commands/create/services/aws/index.js");
6
+ const {
7
+ setAWSClientDefaults,
8
+ } = require("../commands/create/services/aws/misc.js");
6
9
  var fetch;
7
10
 
8
11
  describe("provision", () => {
@@ -14,20 +17,14 @@ describe("provision", () => {
14
17
 
15
18
  describe("static", () => {
16
19
  before(async () => {
20
+ setAWSClientDefaults(account);
21
+
17
22
  fetch = (await import("node-fetch")).default;
18
23
 
19
- config = await aws.static(
20
- name,
21
- account,
22
- undefined,
23
- undefined,
24
- repo,
25
- branch,
26
- );
24
+ config = await aws.static(name, undefined, undefined, repo, branch);
27
25
 
28
26
  await aws.s3.addFileToS3Bucket(
29
27
  name,
30
- account,
31
28
  "index.html",
32
29
  new TextEncoder().encode("test"),
33
30
  );
@@ -38,15 +35,9 @@ describe("provision", () => {
38
35
  });
39
36
 
40
37
  after(async () => {
41
- await aws.s3.removeFileToS3Bucket(name, account, "index.html");
38
+ await aws.s3.removeFileToS3Bucket(name, "index.html");
42
39
 
43
- await aws.staticTerminate(
44
- name,
45
- account,
46
- repo,
47
- branch,
48
- config.cloudfront,
49
- );
40
+ await aws.staticTerminate(name, repo, branch, config.cloudfront);
50
41
  });
51
42
  });
52
43
 
@@ -58,7 +49,6 @@ describe("provision", () => {
58
49
 
59
50
  config = await aws.fullstack(
60
51
  repo,
61
- account,
62
52
  [],
63
53
  [],
64
54
  repo,
@@ -74,7 +64,7 @@ describe("provision", () => {
74
64
  });
75
65
 
76
66
  after(async () => {
77
- await aws.fullstackTerminate(repo, account, repo, branch);
67
+ await aws.fullstackTerminate(repo, repo, branch);
78
68
 
79
69
  execSync(`rm -rf .elasticbeanstalk`, {
80
70
  encoding: "utf8",
package/_Test/s3.js CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  const expect = require("chai").expect;
4
4
  const s3 = require("../commands/create/services/aws/s3.js");
5
+ const {
6
+ setAWSClientDefaults,
7
+ } = require("../commands/create/services/aws/misc.js");
5
8
 
6
9
  describe("s3", () => {
7
10
  let repo = "lab-env-test-suite";
@@ -9,11 +12,12 @@ describe("s3", () => {
9
12
 
10
13
  describe("terminate", () => {
11
14
  before(async () => {
12
- await s3.createS3Bucket(repo, account);
15
+ setAWSClientDefaults(account);
16
+
17
+ await s3.createS3Bucket(repo);
13
18
 
14
19
  await s3.addFileToS3Bucket(
15
20
  repo,
16
- account,
17
21
  "index.html",
18
22
  new TextEncoder().encode("test"),
19
23
  );
@@ -22,10 +26,10 @@ describe("s3", () => {
22
26
  it("Should remove all files from bucket during terminate process", async () => {
23
27
  let err;
24
28
 
25
- await s3.emptyS3Bucket(repo, account);
29
+ await s3.emptyS3Bucket(repo);
26
30
 
27
31
  try {
28
- await s3.removeS3Bucket(repo, account);
32
+ await s3.removeS3Bucket(repo);
29
33
  } catch (e) {
30
34
  err = e;
31
35
  }
@@ -35,9 +39,9 @@ describe("s3", () => {
35
39
 
36
40
  after(async () => {
37
41
  try {
38
- await s3.removeFileToS3Bucket(repo, account, "index.html");
42
+ await s3.removeFileToS3Bucket(repo, "index.html");
39
43
 
40
- await s3.removeS3Bucket(repo, account);
44
+ await s3.removeS3Bucket(repo);
41
45
  } catch {
42
46
  /* empty */
43
47
  }
@@ -23,6 +23,8 @@ services:
23
23
  - $CWD/:/app
24
24
  ports:
25
25
  - "${PORT_WEB:-8000}:80"
26
+ depends_on:
27
+ - node
26
28
  node:
27
29
  build:
28
30
  context: $FW_ADONIS_0_NODE_CONTEXT
@@ -1,4 +1,7 @@
1
1
  ## Changelog
2
2
 
3
+ ### 0.1.3 (2025-01-17)
4
+ * [fix] nginx now resolves on request rather than start time to avoid race conditions
5
+
3
6
  ### 1.0.0 (2024-06-04)
4
7
  * [misc] initial release
@@ -2,8 +2,12 @@ server {
2
2
  listen 80;
3
3
  listen [::]:80;
4
4
 
5
+ # Docker embedded DNS
6
+ resolver 127.0.0.11 ipv6=off valid=10s;
7
+
5
8
  location / {
6
- proxy_pass http://node:3333;
9
+ set $upstream node:3333;
10
+ proxy_pass http://$upstream;
7
11
  proxy_http_version 1.1;
8
12
  proxy_set_header Upgrade $http_upgrade;
9
13
  proxy_set_header Connection 'upgrade';
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "nginx",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "lab-env docker config for the nginx module",
5
5
  "scripts": {
6
6
  "preversion": "docker login",
7
- "postversion": "docker buildx build --target development --platform linux/amd64,linux/arm64 -t fishawack/lab-env-adonis-0-nginx:$npm_package_version -t fishawack/lab-env-adonis-0-nginx:latest --push . && git add . && git commit -m \"build: Bumped fishawack/lab-env-adonis-0-nginx to $npm_package_version\""
7
+ "postversion": "docker buildx build --target development --platform linux/amd64,linux/arm64 -t fishawack/lab-env-adonis-0-nginx:$npm_package_version -t fishawack/lab-env-adonis-0-nginx:latest --push . && git add . && git commit -m \"build: bumped fishawack/lab-env-adonis-0-nginx to $npm_package_version\""
8
8
  },
9
9
  "author": "Mike Mellor",
10
10
  "license": "ISC"
@@ -41,7 +41,7 @@ pipelines:
41
41
  # Install
42
42
  - su aws-runner -c 'npm run setup'
43
43
  # Test
44
- - su aws-runner -c 'npm test'
44
+ - su aws-runner -c 'docker login $DOCKER_CREDENTIALS && npm test'
45
45
  services:
46
46
  - docker
47
47
  branches:
package/cli.js CHANGED
@@ -95,7 +95,7 @@ const args = hideBin(process.argv);
95
95
  adonis: ["base", "webDev"],
96
96
  php: ["base", "webDev"],
97
97
  core: ["base", "webDev"],
98
- python: ["base"], // Python only gets base commands, no webDev
98
+ python: ["base", "webDev"], // Python only gets base commands, no webDev
99
99
  };
100
100
 
101
101
  // Config-based command additions
@@ -37,36 +37,47 @@ module.exports = [
37
37
  } else {
38
38
  _.command("core", `npm run content`);
39
39
 
40
- if (process.env.HUB_URL) {
41
- console.log(`Syncing branch configurations from Hub...`);
42
- // TODO: Fetch specific values and map to core config vlaues
43
- // TODO: Add migration step of test ui to docs
44
- const repository = await findRepository(_.remote);
45
- const configurations = await getConfigurations(repository?.id);
40
+ try {
41
+ if (process.env.HUB_URL) {
42
+ console.log(`Syncing branch configurations from Hub...`);
43
+ // TODO: Fetch specific values and map to core config vlaues
44
+ // TODO: Add migration step of test ui to docs
45
+ const repository = await findRepository(_.remote);
46
+ const configurations = await getConfigurations(
47
+ repository?.id,
48
+ );
46
49
 
47
- // Remove existing hub configuration files
48
- glob.sync("hub.*.*.json").forEach((file) =>
49
- fs.removeSync(file),
50
- );
50
+ // Remove existing hub configuration files
51
+ glob.sync("hub.*.*.json").forEach((file) =>
52
+ fs.removeSync(file),
53
+ );
51
54
 
52
- configurations?.forEach(({ config, id, branch }) => {
53
- const filePath = `hub.${branch}.${id}.json`;
55
+ configurations?.forEach(({ config, id, branch }) => {
56
+ const filePath = `hub.${branch}.${id}.json`;
54
57
 
55
- fs.writeFileSync(
56
- filePath,
57
- JSON.stringify(
58
- {
59
- attributes: {
60
- targets: {
61
- [branch]: config,
58
+ fs.writeFileSync(
59
+ filePath,
60
+ JSON.stringify(
61
+ {
62
+ attributes: {
63
+ targets: {
64
+ [branch]: config,
65
+ },
62
66
  },
63
67
  },
64
- },
65
- null,
66
- 4,
67
- ),
68
- );
69
- });
68
+ null,
69
+ 4,
70
+ ),
71
+ );
72
+ });
73
+ }
74
+ } catch (error) {
75
+ console.log(
76
+ utilities.colorize(
77
+ `\nUnable to sync configurations from Hub: ${error.message}\n`,
78
+ "error",
79
+ ),
80
+ );
70
81
  }
71
82
  }
72
83
  },
@@ -1,8 +1,9 @@
1
1
  const _ = require("../../../globals.js");
2
2
  const inquirer = require("inquirer");
3
3
  const aws = require("../services/aws/index.js");
4
+ const { setAWSClientDefaults } = require("../services/aws/misc.js");
4
5
  const utilities = require("../libs/utilities");
5
- const { stack, client } = require("../libs/prompts.js");
6
+ const { stack, client, region } = require("../libs/prompts.js");
6
7
 
7
8
  module.exports = [
8
9
  ["deprovision", "deprov"],
@@ -47,6 +48,11 @@ module.exports = [
47
48
  },
48
49
  ])),
49
50
  };
51
+ } else {
52
+ answers = {
53
+ ...answers,
54
+ ...(await inquirer.prompt([region])),
55
+ };
50
56
  }
51
57
 
52
58
  const slug = aws.slug(
@@ -69,9 +75,11 @@ module.exports = [
69
75
  process.exit(1);
70
76
  }
71
77
 
78
+ // Set AWS client defaults before any AWS operations
79
+ setAWSClientDefaults(answers.client, answers.region);
80
+
72
81
  await aws[`${answers.stack}Terminate`](
73
82
  slug,
74
- answers.client,
75
83
  _.repoSafe,
76
84
  branch,
77
85
  answers.id,
@@ -3,8 +3,9 @@ const utilities = require("../libs/utilities");
3
3
  const execSync = require("child_process").execSync;
4
4
  const inquirer = require("inquirer");
5
5
  const aws = require("../services/aws/index.js");
6
+ const { setAWSClientDefaults } = require("../services/aws/misc.js");
6
7
  const generator = require("generate-password");
7
- const { stack, client } = require("../libs/prompts.js");
8
+ const { stack, client, region } = require("../libs/prompts.js");
8
9
  const { frameworks } = require("../libs/vars");
9
10
 
10
11
  module.exports = [
@@ -56,6 +57,13 @@ module.exports = [
56
57
  message: "What availability is required?",
57
58
  choices: ["low", "high"],
58
59
  },
60
+ {
61
+ type: "confirm",
62
+ name: "database",
63
+ message: "Does this site need a database?",
64
+ default: true,
65
+ },
66
+ region,
59
67
  ])),
60
68
  };
61
69
  }
@@ -123,10 +131,12 @@ module.exports = [
123
131
  answers.stack === "static" ? "s3" : "eb",
124
132
  );
125
133
 
134
+ // Set AWS client defaults before any AWS operations
135
+ setAWSClientDefaults(answers.client, answers.region);
136
+
126
137
  try {
127
138
  infastructure = await aws[answers.stack](
128
139
  slug,
129
- answers.client,
130
140
  [
131
141
  { Key: "repository", Value: _.repo },
132
142
  { Key: "environment", Value: branch },
@@ -137,6 +147,7 @@ module.exports = [
137
147
  branch,
138
148
  answers.framework,
139
149
  answers.availability,
150
+ answers.database,
140
151
  );
141
152
  } catch (e) {
142
153
  console.log(e.message);
@@ -81,3 +81,12 @@ module.exports.client = {
81
81
  default: 0,
82
82
  loop: false,
83
83
  };
84
+
85
+ module.exports.region = {
86
+ type: "list",
87
+ name: "region",
88
+ message: "Which AWS region should be used?",
89
+ choices: ["us-east-1", "eu-west-1"],
90
+ default: 0,
91
+ validate: (input) => !!input.length,
92
+ };
@@ -209,20 +209,37 @@ module.exports.eb = {
209
209
  Value: "internal",
210
210
  Namespace: "aws:ec2:vpc",
211
211
  },
212
- {
213
- OptionName: "VPCId",
214
- Value: "vpc-d30bcca8",
215
- Namespace: "aws:ec2:vpc",
216
- },
217
- {
218
- OptionName: "Subnets",
219
- Value: "subnet-00bf5eda896fdd5c5,subnet-0aa7e40d4701683ae",
220
- Namespace: "aws:ec2:vpc",
221
- },
222
- {
223
- OptionName: "ELBSubnets",
224
- Value: "subnet-00bf5eda896fdd5c5,subnet-0aa7e40d4701683ae",
225
- Namespace: "aws:ec2:vpc",
212
+ () => {
213
+ const regions = {
214
+ "us-east-1": {
215
+ VPCId: "vpc-d30bcca8",
216
+ Subnets:
217
+ "subnet-00bf5eda896fdd5c5,subnet-0aa7e40d4701683ae",
218
+ },
219
+ "eu-west-1": {
220
+ VPCId: "vpc-cc0d9aa9",
221
+ Subnets:
222
+ "subnet-0e357f06e047e1c10,subnet-0956ffb043535455d",
223
+ },
224
+ };
225
+
226
+ return [
227
+ {
228
+ OptionName: "VPCId",
229
+ Value: regions[process.env.AWS_REGION].VPCId,
230
+ Namespace: "aws:ec2:vpc",
231
+ },
232
+ {
233
+ OptionName: "Subnets",
234
+ Value: regions[process.env.AWS_REGION].Subnets,
235
+ Namespace: "aws:ec2:vpc",
236
+ },
237
+ {
238
+ OptionName: "ELBSubnets",
239
+ Value: regions[process.env.AWS_REGION].Subnets,
240
+ Namespace: "aws:ec2:vpc",
241
+ },
242
+ ];
226
243
  },
227
244
  {
228
245
  OptionName: "AssociatePublicIpAddress",
@@ -499,26 +516,37 @@ module.exports.eb = {
499
516
  high: [],
500
517
  },
501
518
  shared: [
519
+ {
520
+ OptionName: "ServiceRole",
521
+ Value: "lab-env-aws-elasticbeanstalk-service-role",
522
+ Namespace: "aws:elasticbeanstalk:environment",
523
+ },
502
524
  {
503
525
  OptionName: "IamInstanceProfile",
504
526
  Value: "aws-elasticbeanstalk-ec2-role",
505
527
  Namespace: "aws:autoscaling:launchconfiguration",
506
528
  },
507
- {
508
- OptionName: "HasCoupledDatabase",
509
- Value: "true",
510
- Namespace: "aws:rds:dbinstance",
511
- },
512
- {
513
- OptionName: "DBEngineVersion",
514
- Value: "8.0.43",
515
- Namespace: "aws:rds:dbinstance",
516
- },
517
- {
518
- OptionName: "DBPassword",
519
- Value: generator.generate({ length: 10, numbers: true }),
520
- Namespace: "aws:rds:dbinstance",
521
- },
529
+ ({ database }) =>
530
+ database && [
531
+ {
532
+ OptionName: "HasCoupledDatabase",
533
+ Value: "true",
534
+ Namespace: "aws:rds:dbinstance",
535
+ },
536
+ {
537
+ OptionName: "DBEngineVersion",
538
+ Value: "8.0.43",
539
+ Namespace: "aws:rds:dbinstance",
540
+ },
541
+ {
542
+ OptionName: "DBPassword",
543
+ Value: generator.generate({
544
+ length: 10,
545
+ numbers: true,
546
+ }),
547
+ Namespace: "aws:rds:dbinstance",
548
+ },
549
+ ],
522
550
  ],
523
551
  low: [
524
552
  {
@@ -545,7 +573,7 @@ module.exports.eb = {
545
573
  },
546
574
  {
547
575
  OptionName: "ServiceRoleForManagedUpdates",
548
- Value: "AWSServiceRoleForElasticBeanstalkManagedUpdates",
576
+ Value: "lab-env-aws-elasticbeanstalk-service-role",
549
577
  Namespace: "aws:elasticbeanstalk:managedactions",
550
578
  },
551
579
  {
@@ -681,13 +709,13 @@ module.exports.eb = {
681
709
  high: [
682
710
  ".ebextensions/misc/alb-http-to-https-redirection.config",
683
711
  ".ebextensions/misc/enable-https-lb.config",
712
+ ".ebextensions/misc/asg-self-healing.config",
713
+ ".ebextensions/misc/health-ignore-4xx.config",
684
714
  ],
685
715
  },
686
- merge(
687
- type,
688
- { framework, availability = "low", platform, language },
689
- data = {},
690
- ) {
716
+ merge(type, config, data = {}) {
717
+ const { framework, availability = "low", platform, language } = config;
718
+
691
719
  return JSON.parse(
692
720
  template(
693
721
  JSON.stringify(
@@ -702,6 +730,10 @@ module.exports.eb = {
702
730
  this[type][framework]?.shared,
703
731
  this[type][framework]?.[availability],
704
732
  )
733
+ .map((d) =>
734
+ typeof d === "function" ? d(config, data) : d,
735
+ )
736
+ .flat()
705
737
  .filter(Boolean),
706
738
  ),
707
739
  )({ ...process.env, ...data }),