@fishawack/lab-env 5.7.0-beta.1 → 5.7.0-beta.11
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 +128 -0
- package/_Ai/lab-env-@.md +3 -3
- package/_Scripts/post-release.sh +1 -1
- 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/adonis/0/docker-compose.yml +1 -1
- 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/aws-cloudfront-response.js +11 -0
- 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 +98 -35
- 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/drupal/9/docker-compose.yml +1 -2
- package/globals.js +4 -0
- package/laravel/10/docker-compose.yml +1 -1
- package/laravel/9/docker-compose.yml +1 -1
- package/package.json +7 -2
- package/wordpress/1/docker-compose.yml +1 -2
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
const _ = require("../../../globals.js");
|
|
2
|
+
const inquirer = require("inquirer");
|
|
3
|
+
const os = require("os");
|
|
4
|
+
const { writeFileSync } = require("fs");
|
|
5
|
+
|
|
6
|
+
module.exports = async function resolveOperator() {
|
|
7
|
+
let operators = _.config.users.filter((d) => d.operator);
|
|
8
|
+
|
|
9
|
+
if (operators.length === 1) {
|
|
10
|
+
return operators[0];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
let candidates =
|
|
14
|
+
operators.length > 1
|
|
15
|
+
? operators
|
|
16
|
+
: _.config.users.filter(
|
|
17
|
+
(d) =>
|
|
18
|
+
d.permissions && d.permissions.includes("manage-users"),
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
if (!candidates.length) {
|
|
22
|
+
throw new Error(
|
|
23
|
+
"No users with manage-users permission found. A user with IAMFullAccess is required to rotate keys.",
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
let message =
|
|
28
|
+
operators.length > 1
|
|
29
|
+
? "Multiple operators found. Which user are you?"
|
|
30
|
+
: "No operator configured. Which user are you?";
|
|
31
|
+
|
|
32
|
+
let answer = await inquirer.prompt([
|
|
33
|
+
{
|
|
34
|
+
type: "list",
|
|
35
|
+
name: "operator",
|
|
36
|
+
message,
|
|
37
|
+
choices: candidates.map((d) => d.username),
|
|
38
|
+
},
|
|
39
|
+
]);
|
|
40
|
+
|
|
41
|
+
_.config.users.forEach((d) => {
|
|
42
|
+
delete d.operator;
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
let selected = _.config.users.find((d) => d.username === answer.operator);
|
|
46
|
+
selected.operator = true;
|
|
47
|
+
|
|
48
|
+
writeFileSync(
|
|
49
|
+
`${os.homedir()}/.lab-env`,
|
|
50
|
+
JSON.stringify(_.config, null, 4),
|
|
51
|
+
{ encoding: "utf8" },
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
console.log(
|
|
55
|
+
`\nOperator set to "${selected.username}" and saved to ~/.lab-env\n`,
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
return selected;
|
|
59
|
+
};
|
|
@@ -28,6 +28,7 @@ const colorize = (module.exports.colorize = (str, type) => {
|
|
|
28
28
|
});
|
|
29
29
|
|
|
30
30
|
let latestSpinner = null;
|
|
31
|
+
let spinnerQueue = Promise.resolve();
|
|
31
32
|
|
|
32
33
|
module.exports.Spinner = class Spinner {
|
|
33
34
|
constructor(startMessage, simple = false) {
|
|
@@ -67,31 +68,42 @@ module.exports.Spinner = class Spinner {
|
|
|
67
68
|
}
|
|
68
69
|
|
|
69
70
|
simple(message, action) {
|
|
71
|
+
const ready = spinnerQueue;
|
|
72
|
+
let release;
|
|
73
|
+
spinnerQueue = new Promise((r) => {
|
|
74
|
+
release = r;
|
|
75
|
+
});
|
|
76
|
+
|
|
70
77
|
// eslint-disable-next-line no-async-promise-executor
|
|
71
78
|
return new Promise(async (resolve, reject) => {
|
|
79
|
+
await ready;
|
|
80
|
+
|
|
72
81
|
let instance = new this.constructor(message, true);
|
|
73
82
|
let res;
|
|
74
83
|
|
|
75
84
|
try {
|
|
76
|
-
res = await action();
|
|
85
|
+
res = await action(instance);
|
|
77
86
|
|
|
78
87
|
instance.ora.succeed();
|
|
79
88
|
} catch (e) {
|
|
80
89
|
instance.ora.fail();
|
|
90
|
+
release();
|
|
81
91
|
reject(e);
|
|
92
|
+
return;
|
|
82
93
|
}
|
|
83
94
|
|
|
95
|
+
release();
|
|
84
96
|
resolve(res);
|
|
85
97
|
});
|
|
86
98
|
}
|
|
87
99
|
|
|
88
|
-
ping() {
|
|
89
|
-
|
|
90
|
-
|
|
100
|
+
ping(spinner) {
|
|
101
|
+
const target = spinner || latestSpinner;
|
|
102
|
+
target.ora.color = target.ora.color === "cyan" ? "magenta" : "cyan";
|
|
91
103
|
let message = " - check: ";
|
|
92
|
-
let split =
|
|
104
|
+
let split = target.ora.text.split(message);
|
|
93
105
|
let iteration = (split[1] && +split[1].split(":")[0]) || 0;
|
|
94
|
-
|
|
106
|
+
target.ora.text = `${split[0]}${message}${iteration + 1}`;
|
|
95
107
|
}
|
|
96
108
|
};
|
|
97
109
|
|
|
@@ -122,16 +134,22 @@ module.exports.nameSafe = (name, service = "s3") => {
|
|
|
122
134
|
|
|
123
135
|
if (service === "eb") {
|
|
124
136
|
maxLength = 40;
|
|
137
|
+
} else if (service === "os") {
|
|
138
|
+
maxLength = 28;
|
|
139
|
+
} else if (service === "cache") {
|
|
140
|
+
maxLength = 40;
|
|
125
141
|
}
|
|
126
142
|
|
|
127
143
|
safe = safe.substring(0, maxLength - suffix.length - prefix.length);
|
|
128
144
|
safe = safe.replace(/[^a-zA-Z0-9-_. ]/g, ""); // Remove special chars except . _ - as these are all transformed into -
|
|
145
|
+
safe = safe.replace(/-+$/, ""); // Strip trailing hyphens before suffix is appended
|
|
129
146
|
safe = safe.toLowerCase();
|
|
130
147
|
safe = `${prefix}${safe}`;
|
|
131
148
|
safe = `${safe}${suffix}`;
|
|
132
149
|
safe = safe.replace(/\./g, "-");
|
|
133
150
|
// eslint-disable-next-line no-useless-escape
|
|
134
151
|
safe = safe.replace(/\_/g, "-");
|
|
152
|
+
safe = safe.replace(/--+/g, "-"); // Collapse any consecutive hyphens
|
|
135
153
|
|
|
136
154
|
return safe;
|
|
137
155
|
};
|
|
@@ -144,13 +162,13 @@ module.exports.copyToClipboard = (text) => {
|
|
|
144
162
|
}
|
|
145
163
|
};
|
|
146
164
|
|
|
147
|
-
module.exports.poll = async (cb, resolve, reject) => {
|
|
165
|
+
module.exports.poll = async (cb, resolve, reject, spinner) => {
|
|
148
166
|
let res;
|
|
149
167
|
|
|
150
168
|
do {
|
|
151
169
|
await new Promise((resolve) => setTimeout(() => resolve(), 5000));
|
|
152
170
|
|
|
153
|
-
await module.exports.Spinner.prototype.ping();
|
|
171
|
+
await module.exports.Spinner.prototype.ping(spinner);
|
|
154
172
|
|
|
155
173
|
res = await cb();
|
|
156
174
|
|
|
@@ -161,3 +179,52 @@ module.exports.poll = async (cb, resolve, reject) => {
|
|
|
161
179
|
|
|
162
180
|
return res;
|
|
163
181
|
};
|
|
182
|
+
|
|
183
|
+
module.exports.pollAll = async (
|
|
184
|
+
services,
|
|
185
|
+
message = "Waiting for services to provision",
|
|
186
|
+
) => {
|
|
187
|
+
const instance = new module.exports.Spinner(
|
|
188
|
+
`${message} - checking (${services[0].name})`,
|
|
189
|
+
true,
|
|
190
|
+
);
|
|
191
|
+
|
|
192
|
+
const results = new Array(services.length).fill(null);
|
|
193
|
+
const pending = services.map((s, i) => ({ ...s, index: i, checks: 0 }));
|
|
194
|
+
let cursor = 0;
|
|
195
|
+
|
|
196
|
+
while (pending.length > 0) {
|
|
197
|
+
const service = pending[cursor % pending.length];
|
|
198
|
+
service.checks++;
|
|
199
|
+
|
|
200
|
+
instance.ora.text = `${message} - checking (${service.name}) - check: ${service.checks}`;
|
|
201
|
+
|
|
202
|
+
await new Promise((r) => setTimeout(r, 5000));
|
|
203
|
+
|
|
204
|
+
instance.ora.color = instance.ora.color === "cyan" ? "magenta" : "cyan";
|
|
205
|
+
|
|
206
|
+
const res = await service.cb();
|
|
207
|
+
|
|
208
|
+
if (service.reject && service.reject(res)) {
|
|
209
|
+
instance.ora.fail();
|
|
210
|
+
throw new Error(
|
|
211
|
+
`Polling received reject response for ${service.name}`,
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
if (!service.shouldContinue(res)) {
|
|
216
|
+
results[service.index] = res;
|
|
217
|
+
pending.splice(cursor % pending.length, 1);
|
|
218
|
+
|
|
219
|
+
if (pending.length > 0) {
|
|
220
|
+
cursor = cursor % pending.length;
|
|
221
|
+
}
|
|
222
|
+
} else {
|
|
223
|
+
cursor++;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
instance.ora.succeed();
|
|
228
|
+
|
|
229
|
+
return results;
|
|
230
|
+
};
|
|
@@ -68,17 +68,17 @@ const bitbucketApi = (module.exports.bitbucketApi =
|
|
|
68
68
|
"https://api.bitbucket.org/2.0/repositories");
|
|
69
69
|
|
|
70
70
|
module.exports.apis = {
|
|
71
|
-
bbWorkspaceAPI: `${bitbucketApi}/${misc
|
|
71
|
+
bbWorkspaceAPI: `${bitbucketApi}/${misc?.bitbucket?.workspace}`,
|
|
72
72
|
};
|
|
73
73
|
|
|
74
74
|
// URLs
|
|
75
75
|
module.exports.urls = {
|
|
76
|
-
bitbucketSSH: `git@bitbucket.org:${misc
|
|
76
|
+
bitbucketSSH: `git@bitbucket.org:${misc?.bitbucket?.workspace}`,
|
|
77
77
|
};
|
|
78
78
|
|
|
79
79
|
// Request Headers
|
|
80
80
|
module.exports.headers = {
|
|
81
|
-
bbHeaders: encode(misc
|
|
81
|
+
bbHeaders: encode(misc?.bitbucket?.username, misc?.bitbucket?.token),
|
|
82
82
|
};
|
|
83
83
|
|
|
84
84
|
// Required global node modules
|
|
@@ -114,10 +114,6 @@ module.exports.templates = [
|
|
|
114
114
|
name: "boilerplate",
|
|
115
115
|
type: "boilerplate",
|
|
116
116
|
},
|
|
117
|
-
{
|
|
118
|
-
name: "boilerplate-vue",
|
|
119
|
-
type: "boilerplate",
|
|
120
|
-
},
|
|
121
117
|
{
|
|
122
118
|
name: "boilerplate-wordpress",
|
|
123
119
|
type: "boilerplate",
|
|
@@ -126,10 +122,6 @@ module.exports.templates = [
|
|
|
126
122
|
name: "boilerplate-laravel",
|
|
127
123
|
type: "boilerplate",
|
|
128
124
|
},
|
|
129
|
-
{
|
|
130
|
-
name: "boilerplate-laravel-vue",
|
|
131
|
-
type: "boilerplate",
|
|
132
|
-
},
|
|
133
125
|
{
|
|
134
126
|
name: "boilerplate-drupal",
|
|
135
127
|
type: "boilerplate",
|
|
@@ -178,6 +170,15 @@ module.exports.templates = [
|
|
|
178
170
|
},
|
|
179
171
|
];
|
|
180
172
|
|
|
173
|
+
module.exports.secretGroups = [
|
|
174
|
+
"app",
|
|
175
|
+
"storage",
|
|
176
|
+
"database",
|
|
177
|
+
"opensearch",
|
|
178
|
+
"cache",
|
|
179
|
+
"mail",
|
|
180
|
+
];
|
|
181
|
+
|
|
181
182
|
module.exports.frameworks = [
|
|
182
183
|
{
|
|
183
184
|
name: "wordpress",
|
|
@@ -206,61 +207,12 @@ module.exports.eb = {
|
|
|
206
207
|
environments: {
|
|
207
208
|
python: {
|
|
208
209
|
shared: [],
|
|
209
|
-
low: [],
|
|
210
|
-
high: [
|
|
211
|
-
{
|
|
212
|
-
OptionName: "ELBScheme",
|
|
213
|
-
Value: "internal",
|
|
214
|
-
Namespace: "aws:ec2:vpc",
|
|
215
|
-
},
|
|
216
|
-
() => {
|
|
217
|
-
const regions = {
|
|
218
|
-
"us-east-1": {
|
|
219
|
-
VPCId: "vpc-d30bcca8",
|
|
220
|
-
Subnets:
|
|
221
|
-
"subnet-00bf5eda896fdd5c5,subnet-0aa7e40d4701683ae",
|
|
222
|
-
},
|
|
223
|
-
"eu-west-1": {
|
|
224
|
-
VPCId: "vpc-cc0d9aa9",
|
|
225
|
-
Subnets:
|
|
226
|
-
"subnet-0e357f06e047e1c10,subnet-0956ffb043535455d",
|
|
227
|
-
},
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
return [
|
|
231
|
-
{
|
|
232
|
-
OptionName: "VPCId",
|
|
233
|
-
Value: regions[process.env.AWS_REGION].VPCId,
|
|
234
|
-
Namespace: "aws:ec2:vpc",
|
|
235
|
-
},
|
|
236
|
-
{
|
|
237
|
-
OptionName: "Subnets",
|
|
238
|
-
Value: regions[process.env.AWS_REGION].Subnets,
|
|
239
|
-
Namespace: "aws:ec2:vpc",
|
|
240
|
-
},
|
|
241
|
-
{
|
|
242
|
-
OptionName: "ELBSubnets",
|
|
243
|
-
Value: regions[process.env.AWS_REGION].Subnets,
|
|
244
|
-
Namespace: "aws:ec2:vpc",
|
|
245
|
-
},
|
|
246
|
-
];
|
|
247
|
-
},
|
|
248
|
-
{
|
|
249
|
-
OptionName: "AssociatePublicIpAddress",
|
|
250
|
-
Value: "false",
|
|
251
|
-
Namespace: "aws:ec2:vpc",
|
|
252
|
-
},
|
|
253
|
-
],
|
|
254
210
|
},
|
|
255
211
|
php: {
|
|
256
212
|
shared: [],
|
|
257
|
-
low: [],
|
|
258
|
-
high: [],
|
|
259
213
|
},
|
|
260
214
|
nginx: {
|
|
261
215
|
shared: [],
|
|
262
|
-
low: [],
|
|
263
|
-
high: [],
|
|
264
216
|
},
|
|
265
217
|
httpd: {
|
|
266
218
|
shared: [
|
|
@@ -270,33 +222,21 @@ module.exports.eb = {
|
|
|
270
222
|
Namespace: "aws:elasticbeanstalk:environment:proxy",
|
|
271
223
|
},
|
|
272
224
|
],
|
|
273
|
-
low: [],
|
|
274
|
-
high: [],
|
|
275
225
|
},
|
|
276
226
|
default: {
|
|
277
227
|
shared: [],
|
|
278
|
-
low: [],
|
|
279
|
-
high: [],
|
|
280
228
|
},
|
|
281
229
|
wordpress: {
|
|
282
230
|
shared: [],
|
|
283
|
-
low: [],
|
|
284
|
-
high: [],
|
|
285
231
|
},
|
|
286
232
|
laravel: {
|
|
287
233
|
shared: [],
|
|
288
|
-
low: [],
|
|
289
|
-
high: [],
|
|
290
234
|
},
|
|
291
235
|
adonis: {
|
|
292
236
|
shared: [],
|
|
293
|
-
low: [],
|
|
294
|
-
high: [],
|
|
295
237
|
},
|
|
296
238
|
drupal: {
|
|
297
239
|
shared: [],
|
|
298
|
-
low: [],
|
|
299
|
-
high: [],
|
|
300
240
|
},
|
|
301
241
|
shared: [
|
|
302
242
|
{
|
|
@@ -304,18 +244,16 @@ module.exports.eb = {
|
|
|
304
244
|
Value: "lab-env-aws-elasticbeanstalk-service-role",
|
|
305
245
|
Namespace: "aws:elasticbeanstalk:environment",
|
|
306
246
|
},
|
|
307
|
-
{
|
|
247
|
+
({ instanceProfileName }) => ({
|
|
308
248
|
OptionName: "IamInstanceProfile",
|
|
309
|
-
Value: "aws-elasticbeanstalk-ec2-role",
|
|
249
|
+
Value: instanceProfileName || "aws-elasticbeanstalk-ec2-role",
|
|
310
250
|
Namespace: "aws:autoscaling:launchconfiguration",
|
|
311
|
-
},
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
Namespace: "aws:elasticbeanstalk:environment",
|
|
318
|
-
},
|
|
251
|
+
}),
|
|
252
|
+
({ instanceType }) => ({
|
|
253
|
+
OptionName: "InstanceType",
|
|
254
|
+
Value: instanceType || "t3.small",
|
|
255
|
+
Namespace: "aws:autoscaling:launchconfiguration",
|
|
256
|
+
}),
|
|
319
257
|
],
|
|
320
258
|
high: [
|
|
321
259
|
{
|
|
@@ -358,6 +296,59 @@ module.exports.eb = {
|
|
|
358
296
|
Value: "application",
|
|
359
297
|
Namespace: "aws:elasticbeanstalk:environment",
|
|
360
298
|
},
|
|
299
|
+
({ vpcId, privateSubnetIds, publicSubnetIds, elbScheme }) => {
|
|
300
|
+
const settings = [
|
|
301
|
+
{
|
|
302
|
+
OptionName: "VPCId",
|
|
303
|
+
Value: vpcId,
|
|
304
|
+
Namespace: "aws:ec2:vpc",
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
OptionName: "Subnets",
|
|
308
|
+
Value: privateSubnetIds,
|
|
309
|
+
Namespace: "aws:ec2:vpc",
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
OptionName: "ELBSubnets",
|
|
313
|
+
Value:
|
|
314
|
+
elbScheme === "internal"
|
|
315
|
+
? privateSubnetIds
|
|
316
|
+
: publicSubnetIds,
|
|
317
|
+
Namespace: "aws:ec2:vpc",
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
OptionName: "AssociatePublicIpAddress",
|
|
321
|
+
Value: "false",
|
|
322
|
+
Namespace: "aws:ec2:vpc",
|
|
323
|
+
},
|
|
324
|
+
];
|
|
325
|
+
|
|
326
|
+
if (elbScheme === "internal") {
|
|
327
|
+
settings.push({
|
|
328
|
+
OptionName: "ELBScheme",
|
|
329
|
+
Value: "internal",
|
|
330
|
+
Namespace: "aws:ec2:vpc",
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
return settings;
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
OptionName: "ConfigDocument",
|
|
338
|
+
Value: JSON.stringify({
|
|
339
|
+
Version: 1,
|
|
340
|
+
CloudWatchMetrics: { Instance: {}, Environment: {} },
|
|
341
|
+
Rules: {
|
|
342
|
+
Environment: {
|
|
343
|
+
Application: {
|
|
344
|
+
ApplicationRequests4xx: { Enabled: false },
|
|
345
|
+
},
|
|
346
|
+
ELB: { ELBRequests4xx: { Enabled: false } },
|
|
347
|
+
},
|
|
348
|
+
},
|
|
349
|
+
}),
|
|
350
|
+
Namespace: "aws:elasticbeanstalk:healthreporting:system",
|
|
351
|
+
},
|
|
361
352
|
],
|
|
362
353
|
},
|
|
363
354
|
secretPayloads: {
|
|
@@ -372,13 +363,7 @@ module.exports.eb = {
|
|
|
372
363
|
MYSQL_ATTR_SSL_CA: "/opt/rds-certs/global-bundle.pem",
|
|
373
364
|
},
|
|
374
365
|
},
|
|
375
|
-
|
|
376
|
-
app: {
|
|
377
|
-
DOMAIN_LINK: "<%= DOMAIN_LINK %>",
|
|
378
|
-
EMAIL_LINK: "mike.mellor@fishawack.com",
|
|
379
|
-
},
|
|
380
|
-
},
|
|
381
|
-
high: {},
|
|
366
|
+
|
|
382
367
|
wordpress: {
|
|
383
368
|
shared: {
|
|
384
369
|
app: {
|
|
@@ -435,20 +420,43 @@ module.exports.eb = {
|
|
|
435
420
|
laravel: {
|
|
436
421
|
shared: {
|
|
437
422
|
app: {
|
|
423
|
+
APP_NAME: "<%= APP_NAME %>",
|
|
438
424
|
APP_ENV: "production",
|
|
439
425
|
APP_KEY: `base64:${Buffer.from(generator.generate({ length: 32, numbers: true, symbols: true })).toString("base64")}`,
|
|
440
426
|
APP_DEBUG: "false",
|
|
441
|
-
APP_URL: "https://<%=
|
|
427
|
+
APP_URL: "https://<%= APP_DOMAIN %>",
|
|
428
|
+
SESSION_DOMAIN: "<%= SESSION_DOMAIN %>",
|
|
429
|
+
AWS_DEFAULT_REGION: "<%= AWS_REGION %>",
|
|
442
430
|
},
|
|
443
431
|
storage: ({ storage }) =>
|
|
444
432
|
storage && {
|
|
445
433
|
AWS_BUCKET: "<%= s3Slug %>",
|
|
446
|
-
|
|
447
|
-
AWS_ACCESS_KEY_ID: "<%= AccessKeyId %>",
|
|
448
|
-
AWS_SECRET_ACCESS_KEY: "<%= SecretAccessKey %>",
|
|
434
|
+
AWS_ACL_VISIBILITY: "private",
|
|
449
435
|
FILESYSTEM_DISK: "s3",
|
|
450
436
|
FILESYSTEM_DISK_PUBLIC: "s3-public",
|
|
451
437
|
},
|
|
438
|
+
opensearch: ({ opensearch }) =>
|
|
439
|
+
opensearch && {
|
|
440
|
+
SEARCH_HOST: "<%= SEARCH_HOST %>",
|
|
441
|
+
},
|
|
442
|
+
cache: ({ cache }) =>
|
|
443
|
+
cache && {
|
|
444
|
+
REDIS_SCHEME: "tls",
|
|
445
|
+
REDIS_HOST: "<%= REDIS_HOST %>",
|
|
446
|
+
REDIS_PORT: "<%= REDIS_PORT %>",
|
|
447
|
+
REDIS_PASSWORD: "<%= REDIS_PASSWORD %>",
|
|
448
|
+
CACHE_STORE: "redis",
|
|
449
|
+
},
|
|
450
|
+
mail: ({ mail }) =>
|
|
451
|
+
mail && {
|
|
452
|
+
MAIL_FROM_ADDRESS: "<%= MAIL_FROM_ADDRESS %>",
|
|
453
|
+
MAIL_FROM_NAME: "<%= MAIL_FROM_NAME %>",
|
|
454
|
+
MAIL_HOST: "email-smtp.us-east-1.amazonaws.com",
|
|
455
|
+
MAIL_MAILER: "smtp",
|
|
456
|
+
MAIL_PASSWORD: "<%= MAIL_PASSWORD %>",
|
|
457
|
+
MAIL_PORT: "587",
|
|
458
|
+
MAIL_USERNAME: "<%= MAIL_USERNAME %>",
|
|
459
|
+
},
|
|
452
460
|
},
|
|
453
461
|
high: {
|
|
454
462
|
app: {
|
|
@@ -466,11 +474,11 @@ module.exports.eb = {
|
|
|
466
474
|
SESSION_DRIVER: "cookie",
|
|
467
475
|
PORT: "3333",
|
|
468
476
|
LOG_LEVEL: "info",
|
|
477
|
+
AWS_DEFAULT_REGION: "<%= AWS_REGION %>",
|
|
469
478
|
},
|
|
470
479
|
storage: ({ storage }) =>
|
|
471
480
|
storage && {
|
|
472
481
|
AWS_BUCKET: "<%= s3Slug %>",
|
|
473
|
-
AWS_DEFAULT_REGION: "<%= AWS_REGION %>",
|
|
474
482
|
AWS_ACCESS_KEY_ID: "<%= AccessKeyId %>",
|
|
475
483
|
AWS_SECRET_ACCESS_KEY: "<%= SecretAccessKey %>",
|
|
476
484
|
FILESYSTEM_DISK: "s3",
|
|
@@ -487,23 +495,22 @@ module.exports.eb = {
|
|
|
487
495
|
},
|
|
488
496
|
},
|
|
489
497
|
buildSecretPayloads(config, data = {}) {
|
|
490
|
-
const { framework,
|
|
491
|
-
const result =
|
|
498
|
+
const { framework, platform, language } = config;
|
|
499
|
+
const result = Object.fromEntries(
|
|
500
|
+
module.exports.secretGroups.map((g) => [g, {}]),
|
|
501
|
+
);
|
|
492
502
|
|
|
493
503
|
const sources = [
|
|
494
504
|
this.secretPayloads.shared,
|
|
495
|
-
this.secretPayloads[availability],
|
|
496
505
|
this.secretPayloads[platform]?.shared,
|
|
497
|
-
this.secretPayloads[platform]?.[availability],
|
|
498
506
|
this.secretPayloads[language]?.shared,
|
|
499
|
-
this.secretPayloads[language]?.[availability],
|
|
500
507
|
this.secretPayloads[framework]?.shared,
|
|
501
|
-
this.secretPayloads[framework]?.
|
|
508
|
+
this.secretPayloads[framework]?.high,
|
|
502
509
|
];
|
|
503
510
|
|
|
504
511
|
for (const source of sources) {
|
|
505
512
|
if (!source) continue;
|
|
506
|
-
for (const group of
|
|
513
|
+
for (const group of module.exports.secretGroups) {
|
|
507
514
|
let values = source[group];
|
|
508
515
|
if (typeof values === "function") {
|
|
509
516
|
values = values(config, data);
|
|
@@ -516,7 +523,7 @@ module.exports.eb = {
|
|
|
516
523
|
|
|
517
524
|
// Apply lodash template interpolation
|
|
518
525
|
const templateData = { ...process.env, ...data };
|
|
519
|
-
for (const group of
|
|
526
|
+
for (const group of module.exports.secretGroups) {
|
|
520
527
|
if (Object.keys(result[group]).length) {
|
|
521
528
|
result[group] = JSON.parse(
|
|
522
529
|
template(JSON.stringify(result[group]))(templateData),
|
|
@@ -529,8 +536,6 @@ module.exports.eb = {
|
|
|
529
536
|
configurations: {
|
|
530
537
|
php: {
|
|
531
538
|
shared: [".ebextensions/php/ini.config"],
|
|
532
|
-
low: [],
|
|
533
|
-
high: [],
|
|
534
539
|
},
|
|
535
540
|
nginx: {
|
|
536
541
|
shared: [
|
|
@@ -538,14 +543,6 @@ module.exports.eb = {
|
|
|
538
543
|
".platform/nginx/conf.d/upload_size.conf",
|
|
539
544
|
".platform/nginx/conf.d/security_headers.conf",
|
|
540
545
|
".platform/nginx/conf.d/elasticbeanstalk/www-to-nonwww-redirection.conf",
|
|
541
|
-
],
|
|
542
|
-
low: [
|
|
543
|
-
".platform/nginx/conf.d/elasticbeanstalk/http-https-redirection.conf",
|
|
544
|
-
".platform/nginx/conf.d/ssl.conf",
|
|
545
|
-
".ebextensions/nginx/auto-ssl.config",
|
|
546
|
-
],
|
|
547
|
-
high: [
|
|
548
|
-
".platform/nginx/conf.d/elasticbeanstalk/health.conf",
|
|
549
546
|
".ebextensions/nginx/alb-health.config",
|
|
550
547
|
],
|
|
551
548
|
},
|
|
@@ -553,14 +550,6 @@ module.exports.eb = {
|
|
|
553
550
|
shared: [
|
|
554
551
|
".platform/httpd/conf.d/virtualhost-80.conf",
|
|
555
552
|
".platform/httpd/conf.d/elasticbeanstalk/80/www-to-nonwww-redirection.conf",
|
|
556
|
-
],
|
|
557
|
-
low: [
|
|
558
|
-
".platform/httpd/conf.d/elasticbeanstalk/80/http-https-redirection.conf",
|
|
559
|
-
".platform/httpd/conf.d/virtualhost-443.conf",
|
|
560
|
-
".platform/httpd/conf.d/elasticbeanstalk/443/ssl.conf",
|
|
561
|
-
".ebextensions/httpd/auto-ssl.config",
|
|
562
|
-
],
|
|
563
|
-
high: [
|
|
564
553
|
".platform/httpd/conf.d/elasticbeanstalk/80/forward-https-proto.conf",
|
|
565
554
|
".ebextensions/wordpress/alb-health.config",
|
|
566
555
|
],
|
|
@@ -569,8 +558,6 @@ module.exports.eb = {
|
|
|
569
558
|
platform: "nginx",
|
|
570
559
|
language: "php",
|
|
571
560
|
shared: [],
|
|
572
|
-
low: [],
|
|
573
|
-
high: [],
|
|
574
561
|
},
|
|
575
562
|
wordpress: {
|
|
576
563
|
platform: "httpd",
|
|
@@ -583,21 +570,22 @@ module.exports.eb = {
|
|
|
583
570
|
".ebextensions/wordpress/environment.config",
|
|
584
571
|
".ebextensions/wordpress/post-deploy.config",
|
|
585
572
|
".ebextensions/wordpress/software.config",
|
|
573
|
+
".platform/hooks/predeploy/deactivate-plugins.sh",
|
|
586
574
|
],
|
|
587
|
-
low: [".platform/hooks/predeploy/deactivate-plugins-single.sh"],
|
|
588
|
-
high: [".platform/hooks/predeploy/deactivate-plugins.sh"],
|
|
589
575
|
},
|
|
590
576
|
laravel: {
|
|
591
577
|
platform: "nginx",
|
|
592
578
|
language: "php",
|
|
593
579
|
shared: [
|
|
594
580
|
".platform/nginx/conf.d/elasticbeanstalk/laravel.conf",
|
|
581
|
+
".ebextensions/laravel/cron.config",
|
|
595
582
|
".ebextensions/laravel/post-deploy.config",
|
|
596
|
-
".ebextensions/laravel/
|
|
583
|
+
".ebextensions/laravel/queue-worker.config",
|
|
597
584
|
".ebextensions/laravel/rds-ssl.config",
|
|
585
|
+
".ebextensions/laravel/software.config",
|
|
586
|
+
".platform/hooks/postdeploy/restart_queue.sh",
|
|
587
|
+
".platform/confighooks/postdeploy/restart_queue.sh",
|
|
598
588
|
],
|
|
599
|
-
low: [],
|
|
600
|
-
high: [],
|
|
601
589
|
},
|
|
602
590
|
adonis: {
|
|
603
591
|
platform: "nginx",
|
|
@@ -606,34 +594,27 @@ module.exports.eb = {
|
|
|
606
594
|
".ebextensions/adonis/post-deploy.config",
|
|
607
595
|
".ebextensions/adonis/software.config",
|
|
608
596
|
],
|
|
609
|
-
low: [],
|
|
610
|
-
high: [],
|
|
611
597
|
},
|
|
612
598
|
drupal: {
|
|
613
599
|
platform: "httpd",
|
|
614
600
|
language: "php",
|
|
615
601
|
shared: [],
|
|
616
|
-
low: [],
|
|
617
|
-
high: [],
|
|
618
602
|
},
|
|
619
603
|
python: {
|
|
620
604
|
platform: "nginx",
|
|
621
605
|
language: "python",
|
|
622
606
|
shared: [],
|
|
623
|
-
low: [],
|
|
624
|
-
high: [],
|
|
625
607
|
},
|
|
626
|
-
shared: [
|
|
627
|
-
|
|
628
|
-
|
|
608
|
+
shared: [
|
|
609
|
+
".platform/hooks/prebuild/setvars.sh",
|
|
610
|
+
".platform/confighooks/prebuild/setvars.sh",
|
|
611
|
+
".ebextensions/misc/asg-self-healing.config",
|
|
629
612
|
".ebextensions/misc/alb-http-to-https-redirection.config",
|
|
630
613
|
".ebextensions/misc/enable-https-lb.config",
|
|
631
|
-
".ebextensions/misc/asg-self-healing.config",
|
|
632
|
-
".ebextensions/misc/health-ignore-4xx.config",
|
|
633
614
|
],
|
|
634
615
|
},
|
|
635
616
|
merge(type, config, data = {}) {
|
|
636
|
-
const { framework,
|
|
617
|
+
const { framework, platform, language } = config;
|
|
637
618
|
|
|
638
619
|
return JSON.parse(
|
|
639
620
|
template(
|
|
@@ -641,13 +622,10 @@ module.exports.eb = {
|
|
|
641
622
|
[]
|
|
642
623
|
.concat(
|
|
643
624
|
this[type].shared,
|
|
644
|
-
this[type]
|
|
625
|
+
this[type].high,
|
|
645
626
|
this[type][platform]?.shared,
|
|
646
|
-
this[type][platform]?.[availability],
|
|
647
627
|
this[type][language]?.shared,
|
|
648
|
-
this[type][language]?.[availability],
|
|
649
628
|
this[type][framework]?.shared,
|
|
650
|
-
this[type][framework]?.[availability],
|
|
651
629
|
)
|
|
652
630
|
.map((d) =>
|
|
653
631
|
typeof d === "function" ? d(config, data) : d,
|
|
@@ -727,3 +705,6 @@ module.exports.cloudfront = (
|
|
|
727
705
|
},
|
|
728
706
|
},
|
|
729
707
|
});
|
|
708
|
+
|
|
709
|
+
// AWS SDK client defaults
|
|
710
|
+
module.exports.awsClientConfig = { maxAttempts: 5, retryMode: "adaptive" };
|