@fishawack/lab-env 5.7.0-beta.1 → 5.7.0-beta.10
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/CHANGELOG.md +117 -0
- package/_Test/boilerplate-adonis.js +1 -1
- package/_Test/boilerplate-craftcms.js +1 -1
- package/_Test/boilerplate-drupal.js +1 -1
- package/_Test/boilerplate-laravel.js +1 -1
- package/_Test/boilerplate-python.js +1 -1
- package/_Test/boilerplate-wordpress.js +1 -1
- package/_Test/boilerplate.js +1 -1
- package/_Test/provision.js +4 -9
- package/_Test/prune.js +8 -5
- package/bitbucket-pipelines.yml +2 -2
- package/cli.js +1 -0
- package/commands/create/cmds/dekey.js +13 -9
- package/commands/create/cmds/deprovision.js +36 -0
- package/commands/create/cmds/diagnose.js +10 -0
- package/commands/create/cmds/key.js +74 -41
- package/commands/create/cmds/provision.js +573 -69
- package/commands/create/cmds/rekey.js +283 -0
- package/commands/create/cmds/sync-secrets.js +2 -1
- package/commands/create/libs/output-credentials.js +59 -0
- package/commands/create/libs/parallel-runner.js +296 -0
- package/commands/create/libs/resolve-operator.js +59 -0
- package/commands/create/libs/utilities.js +75 -8
- package/commands/create/libs/vars.js +124 -143
- package/commands/create/services/aws/acm.js +61 -0
- package/commands/create/services/aws/cloudfront.js +51 -45
- package/commands/create/services/aws/ec2.js +675 -48
- package/commands/create/services/aws/elasticache.js +159 -0
- package/commands/create/services/aws/elasticbeanstalk.js +155 -57
- package/commands/create/services/aws/iam.js +420 -86
- package/commands/create/services/aws/index.js +1401 -260
- package/commands/create/services/aws/opensearch.js +155 -0
- package/commands/create/services/aws/rds.js +57 -31
- package/commands/create/services/aws/s3.js +52 -31
- package/commands/create/services/aws/secretsmanager.js +21 -12
- package/commands/create/services/aws/ses.js +203 -0
- package/commands/create/templates/elasticbeanstalk/.ebextensions/laravel/cron.config +45 -0
- package/commands/create/templates/elasticbeanstalk/.ebextensions/laravel/queue-worker.config +29 -0
- package/commands/create/templates/elasticbeanstalk/.ebextensions/laravel/software.config +12 -0
- package/commands/create/templates/elasticbeanstalk/.ebextensions/misc/setvars.config +2 -16
- package/commands/create/templates/elasticbeanstalk/.platform/confighooks/postdeploy/restart_queue.sh +4 -0
- package/commands/create/templates/elasticbeanstalk/.platform/confighooks/postdeploy/rewrite-flush.sh +1 -1
- package/commands/create/templates/elasticbeanstalk/.platform/confighooks/prebuild/setvars.sh +19 -0
- package/commands/create/templates/elasticbeanstalk/.platform/hooks/postdeploy/restart_queue.sh +4 -0
- package/commands/create/templates/elasticbeanstalk/.platform/hooks/prebuild/setvars.sh +19 -0
- package/commands/scan.js +1 -1
- package/core/1/CHANGELOG.md +41 -0
- package/core/1/Dockerfile +3 -3
- package/core/1/bitbucket-pipelines.yml +5 -5
- package/core/1/package.json +1 -1
- package/globals.js +4 -0
- package/package.json +7 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,122 @@
|
|
|
1
1
|
## Changelog
|
|
2
2
|
|
|
3
|
+
### 5.7.0-beta.10 (2026-08-24)
|
|
4
|
+
|
|
5
|
+
#### Build Updates
|
|
6
|
+
|
|
7
|
+
* **core/1:** Bumped lab-env-core-1 ([594c541](https://bitbucket.org/fishawackdigital/lab-env/commits/594c541dbc4c7253ef74409f2289fc95724136ac))
|
|
8
|
+
|
|
9
|
+
### 5.7.0-beta.9 (2026-07-16)
|
|
10
|
+
|
|
11
|
+
#### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* add a new Argenx account ([0cafb05](https://bitbucket.org/fishawackdigital/lab-env/commits/0cafb057ca83afe081dce8511ed945008234b3fe))
|
|
14
|
+
|
|
15
|
+
### 5.7.0-beta.8 (2026-07-08)
|
|
16
|
+
|
|
17
|
+
#### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* added restart queue to config post deploy ([397a138](https://bitbucket.org/fishawackdigital/lab-env/commits/397a138c46d45e4e437820f0e14e574bda19ea74))
|
|
20
|
+
* fail deprov if env goes back to ready ([e3dc73f](https://bitbucket.org/fishawackdigital/lab-env/commits/e3dc73fb21cc0a9d5f356d0f9c1d88d08cfdf13b))
|
|
21
|
+
* handle double hypen name safe values to always enforce only a single ([4a18dde](https://bitbucket.org/fishawackdigital/lab-env/commits/4a18dde460d49e5034f5952977c5fa5727d02126))
|
|
22
|
+
* increase timeout on test suits before call ([a0a31c8](https://bitbucket.org/fishawackdigital/lab-env/commits/a0a31c89e7d548a13e0f0ecdf1c591a1e2463506))
|
|
23
|
+
* moved setvars config update to prebuild for consistency ([64483d0](https://bitbucket.org/fishawackdigital/lab-env/commits/64483d0473f2c3f449a55f0f6fe6ee1e565c12a9))
|
|
24
|
+
* simpler queue worker ([4ecc62d](https://bitbucket.org/fishawackdigital/lab-env/commits/4ecc62df734c9aabdbaec1db6ea87c80169128b3))
|
|
25
|
+
|
|
26
|
+
### 5.7.0-beta.7 (2026-07-03)
|
|
27
|
+
|
|
28
|
+
#### Bug Fixes
|
|
29
|
+
|
|
30
|
+
* added more places where rekey can bypass without project ([44e8ca4](https://bitbucket.org/fishawackdigital/lab-env/commits/44e8ca4ec2a1199d96e857338516628d51cb7e1d))
|
|
31
|
+
* remove boilerplate-vue as option now its deprecated ([e8c097a](https://bitbucket.org/fishawackdigital/lab-env/commits/e8c097af21260c127defb90bb85c0eed224f35c2))
|
|
32
|
+
* rotate email creds before operator iam permissions ([a4f510e](https://bitbucket.org/fishawackdigital/lab-env/commits/a4f510e916912dd199d03e4fde984c4abbb8d931))
|
|
33
|
+
|
|
34
|
+
### 5.7.0-beta.6 (2026-07-03)
|
|
35
|
+
|
|
36
|
+
#### Features
|
|
37
|
+
|
|
38
|
+
* **devops:** misc.json setup, SES rotation recovery, runner ordering ([3c6ec70](https://bitbucket.org/fishawackdigital/lab-env/commits/3c6ec70df5e54ad4683a9a5b4e8e3accb681121d))
|
|
39
|
+
|
|
40
|
+
#### Bug Fixes
|
|
41
|
+
|
|
42
|
+
* add timeout for aws key calls themselves ([389444c](https://bitbucket.org/fishawackdigital/lab-env/commits/389444cf7c0c61273b8dc7edf2d0d6695a1047a7))
|
|
43
|
+
* concurrency set back to 5 for more stable key commands ([a5e7382](https://bitbucket.org/fishawackdigital/lab-env/commits/a5e7382b9731ad2a5a60110a54e27ebe4af45391))
|
|
44
|
+
|
|
45
|
+
### 5.7.0-beta.5 (2026-07-03)
|
|
46
|
+
|
|
47
|
+
#### Bug Fixes
|
|
48
|
+
|
|
49
|
+
* allow rekey outside of projects ([94b511b](https://bitbucket.org/fishawackdigital/lab-env/commits/94b511b629fbf80b842a9ab5db9f3671f1f603f0))
|
|
50
|
+
* retry on rate limits and aws errors on key commands ([0244221](https://bitbucket.org/fishawackdigital/lab-env/commits/0244221b8a263256f015380280024c862213b885))
|
|
51
|
+
* safe check for misc bitbucket vars ([cee035c](https://bitbucket.org/fishawackdigital/lab-env/commits/cee035c25f927d1b5f55c00f10fa35f08733e4bf))
|
|
52
|
+
|
|
53
|
+
### 5.7.0-beta.4 (2026-07-03)
|
|
54
|
+
|
|
55
|
+
#### Bug Fixes
|
|
56
|
+
|
|
57
|
+
* added missing ses permission for fullstack roles ([9da2562](https://bitbucket.org/fishawackdigital/lab-env/commits/9da256264ef3ac923bcf4acf0b531e28c3aa154f))
|
|
58
|
+
* correctly tag iam ec2 role for eb with tags ([204aced](https://bitbucket.org/fishawackdigital/lab-env/commits/204acedd6f63af0b6c72875b12b6e97660dfa6a3))
|
|
59
|
+
* safe check the fail property on scans as sometimes the file doesnt exist ([e5b5e39](https://bitbucket.org/fishawackdigital/lab-env/commits/e5b5e39251e6c1c22ec7f9cf155ad5c86492e9cb))
|
|
60
|
+
* session domain now the domain given exactly ([8071c91](https://bitbucket.org/fishawackdigital/lab-env/commits/8071c911a54c869661469fe2fdcdcc3ffc10cb2b))
|
|
61
|
+
|
|
62
|
+
### 5.7.0-beta.3 (2026-07-01)
|
|
63
|
+
|
|
64
|
+
#### Features
|
|
65
|
+
|
|
66
|
+
* added a rekey that keeps an operator from accidentally removing their own keys ([a5887c8](https://bitbucket.org/fishawackdigital/lab-env/commits/a5887c809c76df27d7a3cd42ab309b4a3ffd852a))
|
|
67
|
+
* added cron and queue setup as default laravel files ([21a74c5](https://bitbucket.org/fishawackdigital/lab-env/commits/21a74c54e492e498985934ce2f5b507b42f79dd7))
|
|
68
|
+
* app now prompts for smtp creds and creates them for operators ([6fb1916](https://bitbucket.org/fishawackdigital/lab-env/commits/6fb1916b2685bfc0248ef5b27da86d7ad0ab9b69))
|
|
69
|
+
* environment prompt and setting in outputted json ([77eac4d](https://bitbucket.org/fishawackdigital/lab-env/commits/77eac4d392441c18c90bb22f9054d69f8e9393b9))
|
|
70
|
+
* export base64 encoded creds for runner users ([9b2d05e](https://bitbucket.org/fishawackdigital/lab-env/commits/9b2d05e7ebc1120c39ae8d1752e99fc23a2bd99f))
|
|
71
|
+
* ignore 400s and health checks on load balancer now baked in rather than configs ([8e56878](https://bitbucket.org/fishawackdigital/lab-env/commits/8e568788804508220093a3a6803d1185fda72a4f))
|
|
72
|
+
* populate session domain when app domain defined ([6df2fef](https://bitbucket.org/fishawackdigital/lab-env/commits/6df2fefe9ab94487864e16b00ce7d4a2ac98230e))
|
|
73
|
+
* prompt for instance size ([be6d133](https://bitbucket.org/fishawackdigital/lab-env/commits/be6d133e792fa1cd5b8c7f16225f3aa7ec0d1ca1))
|
|
74
|
+
* prompt users for eb files that have changed ([0572244](https://bitbucket.org/fishawackdigital/lab-env/commits/057224429aeeb267fd8207cb19f25f152294ba4d))
|
|
75
|
+
* run key commands in parallel with parallel logging ([17cba11](https://bitbucket.org/fishawackdigital/lab-env/commits/17cba11118ddabd9ee49a187923ce28044ce5654))
|
|
76
|
+
* support adding email creds with dedicated iam user ([451672a](https://bitbucket.org/fishawackdigital/lab-env/commits/451672a852b40b9d7ddb5b1ee8daaee5951f71e2))
|
|
77
|
+
* support cache option and parallelize prov and deprov ([7081109](https://bitbucket.org/fishawackdigital/lab-env/commits/7081109f4413d4b78a83d4531c96f28181151746))
|
|
78
|
+
* support creating elasticcache option ([71ea8c3](https://bitbucket.org/fishawackdigital/lab-env/commits/71ea8c3bead34f27d960b29115684bdf0ad4e717))
|
|
79
|
+
* support green blue flag to mirror env ([fdfb4ea](https://bitbucket.org/fishawackdigital/lab-env/commits/fdfb4ea0a68829950f2b7aee7429d0c7b026bfe8))
|
|
80
|
+
|
|
81
|
+
#### Bug Fixes
|
|
82
|
+
|
|
83
|
+
* added missing opensearch secret store into setvars ([d764a2a](https://bitbucket.org/fishawackdigital/lab-env/commits/d764a2abb8e02c31acec5230a0d6a74b5a5ed47f))
|
|
84
|
+
* added tags to resources that were missing them ([8347271](https://bitbucket.org/fishawackdigital/lab-env/commits/8347271cefa467ae70da62d71782509cf44c7f54))
|
|
85
|
+
* app name now defaults to sentence case from app title ([a799af1](https://bitbucket.org/fishawackdigital/lab-env/commits/a799af1bae31fc28ab18747415c7a74f96871507))
|
|
86
|
+
* aws region now part of app secrets ([6446778](https://bitbucket.org/fishawackdigital/lab-env/commits/6446778a9335a52d13b059590c1921f018d6d516))
|
|
87
|
+
* coerce tags to strings and keep checksums of files to detect local changes ([c44ed04](https://bitbucket.org/fishawackdigital/lab-env/commits/c44ed04905d1f3ef9077409d8da71be897dd980b))
|
|
88
|
+
* delete now runs in parallel ([52a9997](https://bitbucket.org/fishawackdigital/lab-env/commits/52a99974b5bd09427e7430d83321be0a1c28ebde))
|
|
89
|
+
* dont copy nginx healthcheck anymore now laravel provides ([eed3730](https://bitbucket.org/fishawackdigital/lab-env/commits/eed37305a93ce3cc5c2b91fbb8b94ce52e99a597))
|
|
90
|
+
* duplicate hooks to avoid permission issues and move setvars to prebuild: ([861e6e5](https://bitbucket.org/fishawackdigital/lab-env/commits/861e6e5579524ec757288781f99a30fe86b9127d))
|
|
91
|
+
* go back to config for healtcheck as needs to be done via resources ([f8c50fa](https://bitbucket.org/fishawackdigital/lab-env/commits/f8c50fa4c5ac110c846aa39af7f5fa785d631b30))
|
|
92
|
+
* iac code now placed in dedicated IaC dir and htpasswd on fullstack deprecated ([d41c17c](https://bitbucket.org/fishawackdigital/lab-env/commits/d41c17c026e525ef9f97a033d783ea1ccf8c1018))
|
|
93
|
+
* instance size now abstracted ([57c5996](https://bitbucket.org/fishawackdigital/lab-env/commits/57c59962b101ebb6d43debc639ae3deb04e5e660))
|
|
94
|
+
* instance size qusetions now comes after healhchecks ([fd22642](https://bitbucket.org/fishawackdigital/lab-env/commits/fd22642b8e23a6e0bb6f7d5f661d9647be98ce2f))
|
|
95
|
+
* moved setvars to hooks so it processes on config updates aswell as deploys ([1b88516](https://bitbucket.org/fishawackdigital/lab-env/commits/1b88516852ba56000bffce833a094437fa5ef865))
|
|
96
|
+
* remove laravel-vue as separate option ([cbfa13c](https://bitbucket.org/fishawackdigital/lab-env/commits/cbfa13c19019627b0aedc18781209f3dcf01c63f))
|
|
97
|
+
* renamed setvars to setvars-secure to be backwards compatible ([c0edccc](https://bitbucket.org/fishawackdigital/lab-env/commits/c0edcccea465f61b0273c5315c3b19d429555af8))
|
|
98
|
+
* wait for cloudfront dns before testing ([6f0c182](https://bitbucket.org/fishawackdigital/lab-env/commits/6f0c1825ebc6725fc1d92711e35b5e92939abb68))
|
|
99
|
+
|
|
100
|
+
#### Build Updates
|
|
101
|
+
|
|
102
|
+
* bumped to latest pipelines ([cff06a5](https://bitbucket.org/fishawackdigital/lab-env/commits/cff06a53321382533a9f30cecedb6afbb2e2832e))
|
|
103
|
+
|
|
104
|
+
### 5.7.0-beta.2 (2026-06-11)
|
|
105
|
+
|
|
106
|
+
#### Features
|
|
107
|
+
|
|
108
|
+
* ability to add opensearch to laravel fullstack provisions ([6218c78](https://bitbucket.org/fishawackdigital/lab-env/commits/6218c7835124941fd63ef8056c462a8775f6d7ae))
|
|
109
|
+
* added ssm permission to ec2 role ([7b0195b](https://bitbucket.org/fishawackdigital/lab-env/commits/7b0195b98c59dd4fdcc8ca6848847dddda9ffb61))
|
|
110
|
+
* auto configuration of the acm cert and port 443 listener if cert found ([878ce17](https://bitbucket.org/fishawackdigital/lab-env/commits/878ce175b6031a7ee6cd9f84420c8ace4d858093))
|
|
111
|
+
* ec2 instances always in private and prompt for load balancer visibility + python now dynamic ([bd651cb](https://bitbucket.org/fishawackdigital/lab-env/commits/bd651cb78733d45bf1601e24dbd9c5a5ffc458e0))
|
|
112
|
+
* ensure private subnets now a standard part of the prov command ([22f9876](https://bitbucket.org/fishawackdigital/lab-env/commits/22f9876e390689f7e94939be3839d0a2312f5f10))
|
|
113
|
+
* rds now also creates in private subnet ([e7fb89d](https://bitbucket.org/fishawackdigital/lab-env/commits/e7fb89d9dfbb3fe62c34e8a07c6ba1c7fc732964))
|
|
114
|
+
* use instance role and bucket policy for access now and move restore to after preflight checks ([c4bc090](https://bitbucket.org/fishawackdigital/lab-env/commits/c4bc090927a8dd9d43a52b93f06926e7167003b2))
|
|
115
|
+
|
|
116
|
+
#### Bug Fixes
|
|
117
|
+
|
|
118
|
+
* fullstack provision now indempotent and search enforces search role ([ca374ca](https://bitbucket.org/fishawackdigital/lab-env/commits/ca374caf5c1efa0fa216f62db776591de228e8d5))
|
|
119
|
+
|
|
3
120
|
### 5.7.0-beta.1 (2026-06-08)
|
|
4
121
|
|
|
5
122
|
#### Features
|
|
@@ -12,7 +12,7 @@ const execSync = require("child_process").execSync;
|
|
|
12
12
|
|
|
13
13
|
describe("deploy", () => {
|
|
14
14
|
before(function () {
|
|
15
|
-
this.timeout(60000 *
|
|
15
|
+
this.timeout(60000 * 20);
|
|
16
16
|
|
|
17
17
|
execSync(
|
|
18
18
|
`git -C _Test/_fixtures clone git@bitbucket.org:fishawackdigital/${repo}`,
|
|
@@ -12,7 +12,7 @@ const execSync = require("child_process").execSync;
|
|
|
12
12
|
|
|
13
13
|
describe("deploy", () => {
|
|
14
14
|
before(function () {
|
|
15
|
-
this.timeout(60000 *
|
|
15
|
+
this.timeout(60000 * 20);
|
|
16
16
|
|
|
17
17
|
execSync(
|
|
18
18
|
`git -C _Test/_fixtures clone git@bitbucket.org:fishawackdigital/${repo}`,
|
|
@@ -12,7 +12,7 @@ const execSync = require("child_process").execSync;
|
|
|
12
12
|
|
|
13
13
|
describe("deploy", () => {
|
|
14
14
|
before(function () {
|
|
15
|
-
this.timeout(60000 *
|
|
15
|
+
this.timeout(60000 * 20);
|
|
16
16
|
|
|
17
17
|
execSync(
|
|
18
18
|
`git -C _Test/_fixtures clone git@bitbucket.org:fishawackdigital/${repo}`,
|
|
@@ -12,7 +12,7 @@ const execSync = require("child_process").execSync;
|
|
|
12
12
|
|
|
13
13
|
describe("deploy", () => {
|
|
14
14
|
before(function () {
|
|
15
|
-
this.timeout(60000 *
|
|
15
|
+
this.timeout(60000 * 20);
|
|
16
16
|
|
|
17
17
|
execSync(
|
|
18
18
|
`git -C _Test/_fixtures clone git@bitbucket.org:fishawackdigital/${repo}`,
|
|
@@ -12,7 +12,7 @@ const execSync = require("child_process").execSync;
|
|
|
12
12
|
|
|
13
13
|
describe("deploy", () => {
|
|
14
14
|
before(function () {
|
|
15
|
-
this.timeout(60000 *
|
|
15
|
+
this.timeout(60000 * 20);
|
|
16
16
|
|
|
17
17
|
execSync(
|
|
18
18
|
`git -C _Test/_fixtures clone git@bitbucket.org:fishawackdigital/${repo}`,
|
|
@@ -12,7 +12,7 @@ const execSync = require("child_process").execSync;
|
|
|
12
12
|
|
|
13
13
|
describe("deploy", () => {
|
|
14
14
|
before(function () {
|
|
15
|
-
this.timeout(60000 *
|
|
15
|
+
this.timeout(60000 * 20);
|
|
16
16
|
|
|
17
17
|
execSync(
|
|
18
18
|
`git -C _Test/_fixtures clone git@bitbucket.org:fishawackdigital/${repo}`,
|
package/_Test/boilerplate.js
CHANGED
|
@@ -12,7 +12,7 @@ const execSync = require("child_process").execSync;
|
|
|
12
12
|
|
|
13
13
|
describe("deploy", () => {
|
|
14
14
|
before(function () {
|
|
15
|
-
this.timeout(60000 *
|
|
15
|
+
this.timeout(60000 * 20);
|
|
16
16
|
|
|
17
17
|
execSync(
|
|
18
18
|
`git -C _Test/_fixtures clone git@bitbucket.org:fishawackdigital/${repo}`,
|
package/_Test/provision.js
CHANGED
|
@@ -49,14 +49,7 @@ describe("provision", () => {
|
|
|
49
49
|
|
|
50
50
|
process.env.REPO = repo;
|
|
51
51
|
|
|
52
|
-
config = await aws.fullstack(
|
|
53
|
-
repo,
|
|
54
|
-
[],
|
|
55
|
-
[],
|
|
56
|
-
repo,
|
|
57
|
-
branch,
|
|
58
|
-
"wordpress",
|
|
59
|
-
);
|
|
52
|
+
config = await aws.fullstack(repo, [], repo, branch, "wordpress");
|
|
60
53
|
});
|
|
61
54
|
|
|
62
55
|
it("Should provision elastic beanstalk environment", async () => {
|
|
@@ -66,7 +59,9 @@ describe("provision", () => {
|
|
|
66
59
|
});
|
|
67
60
|
|
|
68
61
|
after(async () => {
|
|
69
|
-
await aws.fullstackTerminate(repo, repo, branch
|
|
62
|
+
await aws.fullstackTerminate(repo, repo, branch, {
|
|
63
|
+
deleteAppSecret: true,
|
|
64
|
+
});
|
|
70
65
|
|
|
71
66
|
execSync(`rm -rf .elasticbeanstalk`, {
|
|
72
67
|
encoding: "utf8",
|
package/_Test/prune.js
CHANGED
|
@@ -264,11 +264,14 @@ describe("prune", () => {
|
|
|
264
264
|
cfDistributionId,
|
|
265
265
|
);
|
|
266
266
|
|
|
267
|
-
//
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
267
|
+
// Poll until the distribution is no longer in the list (eventual consistency)
|
|
268
|
+
let ids;
|
|
269
|
+
const deadline = Date.now() + 120000;
|
|
270
|
+
do {
|
|
271
|
+
await new Promise((r) => setTimeout(r, 5000));
|
|
272
|
+
const distributions = await aws.cloudfront.listDistributions();
|
|
273
|
+
ids = distributions.map((d) => d.Id);
|
|
274
|
+
} while (ids.includes(cfDistributionId) && Date.now() < deadline);
|
|
272
275
|
|
|
273
276
|
expect(ids).to.not.include(cfDistributionId);
|
|
274
277
|
});
|
package/bitbucket-pipelines.yml
CHANGED
package/cli.js
CHANGED
|
@@ -4,6 +4,7 @@ const aws = require("../services/aws/index.js");
|
|
|
4
4
|
const {
|
|
5
5
|
setAWSClientDefaults,
|
|
6
6
|
} = require("../../../commands/create/services/aws/misc.js");
|
|
7
|
+
const parallelRunner = require("../libs/parallel-runner.js");
|
|
7
8
|
|
|
8
9
|
module.exports = [
|
|
9
10
|
"dekey",
|
|
@@ -63,16 +64,19 @@ module.exports = [
|
|
|
63
64
|
clients = answer.clients;
|
|
64
65
|
}
|
|
65
66
|
|
|
66
|
-
|
|
67
|
-
|
|
67
|
+
const batches = clients.map((client) => ({
|
|
68
|
+
users,
|
|
69
|
+
client,
|
|
70
|
+
fn: async (user) => {
|
|
71
|
+
setAWSClientDefaults(client);
|
|
68
72
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
let user = users[j];
|
|
73
|
+
await aws.iam.removeIAMUser(`fw-automation-${user}`);
|
|
74
|
+
},
|
|
75
|
+
}));
|
|
73
76
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
+
await parallelRunner(batches, {
|
|
78
|
+
concurrency: 5,
|
|
79
|
+
verb: "Remove credentials",
|
|
80
|
+
});
|
|
77
81
|
},
|
|
78
82
|
];
|
|
@@ -16,6 +16,11 @@ module.exports = [
|
|
|
16
16
|
describe: "Branch to configure",
|
|
17
17
|
type: "string",
|
|
18
18
|
});
|
|
19
|
+
yargs.option("green-blue", {
|
|
20
|
+
alias: "g",
|
|
21
|
+
describe: "Teardown a cloned environment (pass source branch name)",
|
|
22
|
+
type: "string",
|
|
23
|
+
});
|
|
19
24
|
},
|
|
20
25
|
async (argv) => {
|
|
21
26
|
let branch = argv.branch || _.branch;
|
|
@@ -78,6 +83,16 @@ module.exports = [
|
|
|
78
83
|
// Set AWS client defaults before any AWS operations
|
|
79
84
|
setAWSClientDefaults(answers.client, answers.region);
|
|
80
85
|
|
|
86
|
+
if (argv.greenBlue) {
|
|
87
|
+
await aws.fullstackCloneTerminate(
|
|
88
|
+
slug,
|
|
89
|
+
_.repoSafe,
|
|
90
|
+
branch,
|
|
91
|
+
argv.greenBlue,
|
|
92
|
+
);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
|
|
81
96
|
if (answers.stack === "fullstack") {
|
|
82
97
|
const resourceAnswers = await inquirer.prompt([
|
|
83
98
|
{
|
|
@@ -92,6 +107,24 @@ module.exports = [
|
|
|
92
107
|
message: "Delete the RDS database?",
|
|
93
108
|
default: false,
|
|
94
109
|
},
|
|
110
|
+
{
|
|
111
|
+
type: "confirm",
|
|
112
|
+
name: "deleteOpenSearch",
|
|
113
|
+
message: "Delete the OpenSearch domain?",
|
|
114
|
+
default: false,
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
type: "confirm",
|
|
118
|
+
name: "deleteCache",
|
|
119
|
+
message: "Delete the ElastiCache cluster?",
|
|
120
|
+
default: false,
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
type: "confirm",
|
|
124
|
+
name: "deleteMail",
|
|
125
|
+
message: "Delete the SES mail credentials?",
|
|
126
|
+
default: false,
|
|
127
|
+
},
|
|
95
128
|
{
|
|
96
129
|
type: "confirm",
|
|
97
130
|
name: "deleteAppSecret",
|
|
@@ -103,6 +136,9 @@ module.exports = [
|
|
|
103
136
|
await aws.fullstackTerminate(slug, _.repoSafe, branch, {
|
|
104
137
|
deleteStorage: resourceAnswers.deleteStorage,
|
|
105
138
|
deleteDatabase: resourceAnswers.deleteDatabase,
|
|
139
|
+
deleteOpenSearch: resourceAnswers.deleteOpenSearch,
|
|
140
|
+
deleteCache: resourceAnswers.deleteCache,
|
|
141
|
+
deleteMail: resourceAnswers.deleteMail,
|
|
106
142
|
deleteAppSecret: resourceAnswers.deleteAppSecret,
|
|
107
143
|
});
|
|
108
144
|
} else {
|
|
@@ -142,6 +142,16 @@ module.exports = [
|
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
+
if (preset === "devops") {
|
|
146
|
+
while (!(await test.targets())) {
|
|
147
|
+
await guide.targets(argv);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
while (!(await test.misc())) {
|
|
151
|
+
await guide.misc(argv);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
145
155
|
// Update diagnosis version in ~/.lab-env config file
|
|
146
156
|
let spinner = new Spinner(
|
|
147
157
|
`Writing options to ${path.join(os.homedir(), "", ".lab-env")}`,
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
const _ = require("../../../globals.js");
|
|
2
|
-
const utilities = require("../libs/utilities");
|
|
3
2
|
const inquirer = require("inquirer");
|
|
4
3
|
const aws = require("../services/aws/index.js");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
`${__dirname}/../templates/credentials.html`,
|
|
8
|
-
{ encoding: "utf8" },
|
|
9
|
-
);
|
|
4
|
+
const outputCredentials = require("../libs/output-credentials.js");
|
|
5
|
+
const { misc } = require("../libs/vars.js");
|
|
10
6
|
const {
|
|
11
7
|
setAWSClientDefaults,
|
|
12
8
|
} = require("../../../commands/create/services/aws/misc.js");
|
|
9
|
+
const parallelRunner = require("../libs/parallel-runner.js");
|
|
10
|
+
const resolveOperator = require("../libs/resolve-operator.js");
|
|
13
11
|
|
|
14
12
|
module.exports = [
|
|
15
13
|
"key",
|
|
@@ -18,6 +16,8 @@ module.exports = [
|
|
|
18
16
|
: false,
|
|
19
17
|
() => {},
|
|
20
18
|
async () => {
|
|
19
|
+
let operator = await resolveOperator();
|
|
20
|
+
|
|
21
21
|
let users = [];
|
|
22
22
|
let clients = [];
|
|
23
23
|
let sendEmail = false;
|
|
@@ -74,32 +74,87 @@ module.exports = [
|
|
|
74
74
|
{
|
|
75
75
|
type: "confirm",
|
|
76
76
|
name: "check",
|
|
77
|
-
message: `Would you like to email out the credentials after creation (requires
|
|
77
|
+
message: `Would you like to email out the credentials after creation (requires mail credentials in ~/targets/misc.json)?`,
|
|
78
78
|
default: "Y",
|
|
79
79
|
},
|
|
80
80
|
]);
|
|
81
81
|
|
|
82
82
|
sendEmail = answer.check;
|
|
83
83
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
84
|
+
// Check for SES email credentials if user wants to send emails
|
|
85
|
+
if (sendEmail && !misc.nodemailer?.AWSSES?.username) {
|
|
86
|
+
answer = await inquirer.prompt([
|
|
87
|
+
{
|
|
88
|
+
type: "confirm",
|
|
89
|
+
name: "check",
|
|
90
|
+
message:
|
|
91
|
+
"No email credentials found, create them via AWS SES?",
|
|
92
|
+
default: "Y",
|
|
93
|
+
},
|
|
94
|
+
]);
|
|
88
95
|
|
|
89
|
-
|
|
96
|
+
if (answer.check) {
|
|
97
|
+
try {
|
|
98
|
+
let creds = await aws.ses.ensureOperatorSESCredentials(
|
|
99
|
+
operator.username,
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
if (!creds) {
|
|
103
|
+
answer = await inquirer.prompt([
|
|
104
|
+
{
|
|
105
|
+
type: "confirm",
|
|
106
|
+
name: "check",
|
|
107
|
+
message:
|
|
108
|
+
"SES IAM user exists but secret is not stored locally. Rotate credentials to recapture?",
|
|
109
|
+
default: "Y",
|
|
110
|
+
},
|
|
111
|
+
]);
|
|
112
|
+
|
|
113
|
+
if (answer.check) {
|
|
114
|
+
creds = await aws.ses.rotateOperatorSESCredentials(
|
|
115
|
+
operator.username,
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (creds) {
|
|
121
|
+
aws.ses.updateMiscNodemailer(creds);
|
|
122
|
+
console.log(
|
|
123
|
+
"\n ✓ SES email credentials saved to misc.json\n",
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
} catch (err) {
|
|
127
|
+
console.log(
|
|
128
|
+
`\n ⚠ Failed to create SES credentials: ${err.message}\n`,
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
90
133
|
|
|
91
|
-
|
|
92
|
-
let user = users[j];
|
|
134
|
+
let credentials = {};
|
|
93
135
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
136
|
+
const batches = clients.map((client) => ({
|
|
137
|
+
users,
|
|
138
|
+
client,
|
|
139
|
+
fn: async (user) => {
|
|
140
|
+
setAWSClientDefaults(client);
|
|
97
141
|
|
|
98
|
-
|
|
142
|
+
return aws.iam.createFWIAMUser(
|
|
99
143
|
`fw-automation-${user}`,
|
|
100
144
|
_.config.users.find((d) => d.username === user).permissions,
|
|
101
145
|
);
|
|
146
|
+
},
|
|
147
|
+
}));
|
|
148
|
+
|
|
149
|
+
const resultsMap = await parallelRunner(batches, {
|
|
150
|
+
concurrency: 5,
|
|
151
|
+
verb: "Create credentials",
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
for (const [user, entries] of resultsMap) {
|
|
155
|
+
credentials[user] = {};
|
|
102
156
|
|
|
157
|
+
for (const { client, res } of entries) {
|
|
103
158
|
credentials[user][client] = {
|
|
104
159
|
key:
|
|
105
160
|
(res.AccessKey && res.AccessKey.AccessKeyId) ||
|
|
@@ -111,28 +166,6 @@ module.exports = [
|
|
|
111
166
|
}
|
|
112
167
|
}
|
|
113
168
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
for (var user in credentials) {
|
|
117
|
-
output += utilities.colorize(`\n${user}\n`, "title");
|
|
118
|
-
|
|
119
|
-
let outputUser = "";
|
|
120
|
-
for (var client in credentials[user]) {
|
|
121
|
-
outputUser += `\n[${client}]\n`;
|
|
122
|
-
outputUser += `aws_access_key_id = ${credentials[user][client].key}\n`;
|
|
123
|
-
outputUser += `aws_secret_access_key = ${credentials[user][client].secret}\n`;
|
|
124
|
-
}
|
|
125
|
-
output += outputUser;
|
|
126
|
-
|
|
127
|
-
if (sendEmail) {
|
|
128
|
-
await email.send(
|
|
129
|
-
_.config.users.find((d) => d.username === user).email,
|
|
130
|
-
"New AWS Keys",
|
|
131
|
-
`${htmlEmail}<pre><code>${outputUser.replace(/\n/g, "<br>")}</code></pre>`,
|
|
132
|
-
);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
console.log(output);
|
|
169
|
+
await outputCredentials(credentials, sendEmail);
|
|
137
170
|
},
|
|
138
171
|
];
|