@fishawack/lab-env 5.6.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.
Files changed (53) hide show
  1. package/CHANGELOG.md +136 -0
  2. package/_Test/boilerplate-adonis.js +1 -1
  3. package/_Test/boilerplate-craftcms.js +1 -1
  4. package/_Test/boilerplate-drupal.js +1 -1
  5. package/_Test/boilerplate-laravel.js +1 -1
  6. package/_Test/boilerplate-python.js +1 -1
  7. package/_Test/boilerplate-wordpress.js +1 -1
  8. package/_Test/boilerplate.js +1 -1
  9. package/_Test/provision.js +4 -9
  10. package/_Test/prune.js +8 -5
  11. package/bitbucket-pipelines.yml +2 -2
  12. package/cli.js +2 -0
  13. package/commands/create/cmds/dekey.js +13 -9
  14. package/commands/create/cmds/deprovision.js +66 -6
  15. package/commands/create/cmds/diagnose.js +10 -0
  16. package/commands/create/cmds/key.js +74 -41
  17. package/commands/create/cmds/provision.js +641 -22
  18. package/commands/create/cmds/rekey.js +283 -0
  19. package/commands/create/cmds/sync-secrets.js +198 -0
  20. package/commands/create/libs/output-credentials.js +59 -0
  21. package/commands/create/libs/parallel-runner.js +296 -0
  22. package/commands/create/libs/resolve-operator.js +59 -0
  23. package/commands/create/libs/utilities.js +75 -8
  24. package/commands/create/libs/vars.js +273 -377
  25. package/commands/create/services/aws/acm.js +61 -0
  26. package/commands/create/services/aws/cloudfront.js +51 -45
  27. package/commands/create/services/aws/ec2.js +781 -5
  28. package/commands/create/services/aws/elasticache.js +159 -0
  29. package/commands/create/services/aws/elasticbeanstalk.js +200 -48
  30. package/commands/create/services/aws/iam.js +430 -82
  31. package/commands/create/services/aws/index.js +1598 -100
  32. package/commands/create/services/aws/opensearch.js +155 -0
  33. package/commands/create/services/aws/rds.js +272 -0
  34. package/commands/create/services/aws/s3.js +52 -31
  35. package/commands/create/services/aws/secretsmanager.js +82 -0
  36. package/commands/create/services/aws/ses.js +203 -0
  37. package/commands/create/templates/elasticbeanstalk/.ebextensions/laravel/cron.config +45 -0
  38. package/commands/create/templates/elasticbeanstalk/.ebextensions/laravel/queue-worker.config +29 -0
  39. package/commands/create/templates/elasticbeanstalk/.ebextensions/laravel/rds-ssl.config +5 -0
  40. package/commands/create/templates/elasticbeanstalk/.ebextensions/laravel/software.config +12 -0
  41. package/commands/create/templates/elasticbeanstalk/.ebextensions/misc/setvars.config +1 -0
  42. package/commands/create/templates/elasticbeanstalk/.platform/confighooks/postdeploy/restart_queue.sh +4 -0
  43. package/commands/create/templates/elasticbeanstalk/.platform/confighooks/postdeploy/rewrite-flush.sh +1 -1
  44. package/commands/create/templates/elasticbeanstalk/.platform/confighooks/prebuild/setvars.sh +19 -0
  45. package/commands/create/templates/elasticbeanstalk/.platform/hooks/postdeploy/restart_queue.sh +4 -0
  46. package/commands/create/templates/elasticbeanstalk/.platform/hooks/prebuild/setvars.sh +19 -0
  47. package/commands/scan.js +1 -1
  48. package/core/1/CHANGELOG.md +41 -0
  49. package/core/1/Dockerfile +3 -3
  50. package/core/1/bitbucket-pipelines.yml +5 -5
  51. package/core/1/package.json +1 -1
  52. package/globals.js +4 -0
  53. package/package.json +9 -2
@@ -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.bitbucket.workspace}`,
71
+ bbWorkspaceAPI: `${bitbucketApi}/${misc?.bitbucket?.workspace}`,
72
72
  };
73
73
 
74
74
  // URLs
75
75
  module.exports.urls = {
76
- bitbucketSSH: `git@bitbucket.org:${misc.bitbucket.workspace}`,
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.bitbucket.username, misc.bitbucket.token),
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,66 +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
- OptionName: "APP_ENV",
255
- Value: "production",
256
- Namespace: "aws:elasticbeanstalk:application:environment",
257
- },
258
- ],
259
210
  },
260
211
  php: {
261
212
  shared: [],
262
- low: [],
263
- high: [],
264
213
  },
265
214
  nginx: {
266
215
  shared: [],
267
- low: [],
268
- high: [],
269
216
  },
270
217
  httpd: {
271
218
  shared: [
@@ -275,249 +222,21 @@ module.exports.eb = {
275
222
  Namespace: "aws:elasticbeanstalk:environment:proxy",
276
223
  },
277
224
  ],
278
- low: [],
279
- high: [],
280
225
  },
281
226
  default: {
282
227
  shared: [],
283
- low: [],
284
- high: [],
285
228
  },
286
229
  wordpress: {
287
- shared: [
288
- {
289
- OptionName: "AUTH_KEY",
290
- Value: generateSafeKey({
291
- length: 64,
292
- numbers: true,
293
- symbols: true,
294
- }),
295
- Namespace: "aws:elasticbeanstalk:application:environment",
296
- },
297
- {
298
- OptionName: "SECURE_AUTH_KEY",
299
- Value: generateSafeKey({
300
- length: 64,
301
- numbers: true,
302
- symbols: true,
303
- }),
304
- Namespace: "aws:elasticbeanstalk:application:environment",
305
- },
306
- {
307
- OptionName: "LOGGED_IN_KEY",
308
- Value: generateSafeKey({
309
- length: 64,
310
- numbers: true,
311
- symbols: true,
312
- }),
313
- Namespace: "aws:elasticbeanstalk:application:environment",
314
- },
315
- {
316
- OptionName: "NONCE_KEY",
317
- Value: generateSafeKey({
318
- length: 64,
319
- numbers: true,
320
- symbols: true,
321
- }),
322
- Namespace: "aws:elasticbeanstalk:application:environment",
323
- },
324
- {
325
- OptionName: "AUTH_SALT",
326
- Value: generateSafeKey({
327
- length: 64,
328
- numbers: true,
329
- symbols: true,
330
- }),
331
- Namespace: "aws:elasticbeanstalk:application:environment",
332
- },
333
- {
334
- OptionName: "SECURE_AUTH_SALT",
335
- Value: generateSafeKey({
336
- length: 64,
337
- numbers: true,
338
- symbols: true,
339
- }),
340
- Namespace: "aws:elasticbeanstalk:application:environment",
341
- },
342
- {
343
- OptionName: "LOGGED_IN_SALT",
344
- Value: generateSafeKey({
345
- length: 64,
346
- numbers: true,
347
- symbols: true,
348
- }),
349
- Namespace: "aws:elasticbeanstalk:application:environment",
350
- },
351
- {
352
- OptionName: "NONCE_SALT",
353
- Value: generateSafeKey({
354
- length: 64,
355
- numbers: true,
356
- symbols: true,
357
- }),
358
- Namespace: "aws:elasticbeanstalk:application:environment",
359
- },
360
- {
361
- OptionName: "S3_UPLOADS_BUCKET",
362
- Value: "<%= s3Slug %>",
363
- Namespace: "aws:elasticbeanstalk:application:environment",
364
- },
365
- {
366
- OptionName: "S3_UPLOADS_REGION",
367
- Value: "<%= AWS_REGION %>",
368
- Namespace: "aws:elasticbeanstalk:application:environment",
369
- },
370
- {
371
- OptionName: "S3_UPLOADS_KEY",
372
- Value: "<%= AccessKeyId %>",
373
- Namespace: "aws:elasticbeanstalk:application:environment",
374
- },
375
- {
376
- OptionName: "S3_UPLOADS_SECRET",
377
- Value: "<%= SecretAccessKey %>",
378
- Namespace: "aws:elasticbeanstalk:application:environment",
379
- },
380
- ],
381
- low: [],
382
- high: [],
230
+ shared: [],
383
231
  },
384
232
  laravel: {
385
- shared: [
386
- {
387
- OptionName: "APP_ENV",
388
- Value: "production",
389
- Namespace: "aws:elasticbeanstalk:application:environment",
390
- },
391
- {
392
- OptionName: "APP_KEY",
393
- Value: `base64:${Buffer.from(generator.generate({ length: 32, numbers: true, symbols: true })).toString("base64")}`,
394
- Namespace: "aws:elasticbeanstalk:application:environment",
395
- },
396
- {
397
- OptionName: "APP_DEBUG",
398
- Value: "false",
399
- Namespace: "aws:elasticbeanstalk:application:environment",
400
- },
401
- {
402
- OptionName: "APP_URL",
403
- Value: "https://<%= DOMAIN_LINK %>",
404
- Namespace: "aws:elasticbeanstalk:application:environment",
405
- },
406
- {
407
- OptionName: "AWS_BUCKET",
408
- Value: "<%= s3Slug %>",
409
- Namespace: "aws:elasticbeanstalk:application:environment",
410
- },
411
- {
412
- OptionName: "AWS_DEFAULT_REGION",
413
- Value: "<%= AWS_REGION %>",
414
- Namespace: "aws:elasticbeanstalk:application:environment",
415
- },
416
- {
417
- OptionName: "AWS_ACCESS_KEY_ID",
418
- Value: "<%= AccessKeyId %>",
419
- Namespace: "aws:elasticbeanstalk:application:environment",
420
- },
421
- {
422
- OptionName: "AWS_SECRET_ACCESS_KEY",
423
- Value: "<%= SecretAccessKey %>",
424
- Namespace: "aws:elasticbeanstalk:application:environment",
425
- },
426
- {
427
- OptionName: "FILESYSTEM_DISK",
428
- Value: "s3",
429
- Namespace: "aws:elasticbeanstalk:application:environment",
430
- },
431
- {
432
- OptionName: "FILESYSTEM_DISK_PUBLIC",
433
- Value: "s3-public",
434
- Namespace: "aws:elasticbeanstalk:application:environment",
435
- },
436
- ],
437
- low: [],
438
- high: [
439
- {
440
- OptionName: "SESSION_DRIVER",
441
- Value: "cookie",
442
- Namespace: "aws:elasticbeanstalk:application:environment",
443
- },
444
- {
445
- OptionName: "SESSION_SECURE_COOKIE",
446
- Value: "true",
447
- Namespace: "aws:elasticbeanstalk:application:environment",
448
- },
449
- ],
233
+ shared: [],
450
234
  },
451
235
  adonis: {
452
- shared: [
453
- {
454
- OptionName: "NODE_ENV",
455
- Value: "production",
456
- Namespace: "aws:elasticbeanstalk:application:environment",
457
- },
458
- {
459
- OptionName: "APP_KEY",
460
- Value: `base64:${Buffer.from(generator.generate({ length: 32, numbers: true, symbols: true })).toString("base64")}`,
461
- Namespace: "aws:elasticbeanstalk:application:environment",
462
- },
463
- {
464
- OptionName: "APP_URL",
465
- Value: "https://<%= DOMAIN_LINK %>",
466
- Namespace: "aws:elasticbeanstalk:application:environment",
467
- },
468
- {
469
- OptionName: "SESSION_DRIVER",
470
- Value: "cookie",
471
- Namespace: "aws:elasticbeanstalk:application:environment",
472
- },
473
- {
474
- OptionName: "AWS_BUCKET",
475
- Value: "<%= s3Slug %>",
476
- Namespace: "aws:elasticbeanstalk:application:environment",
477
- },
478
- {
479
- OptionName: "AWS_DEFAULT_REGION",
480
- Value: "<%= AWS_REGION %>",
481
- Namespace: "aws:elasticbeanstalk:application:environment",
482
- },
483
- {
484
- OptionName: "AWS_ACCESS_KEY_ID",
485
- Value: "<%= AccessKeyId %>",
486
- Namespace: "aws:elasticbeanstalk:application:environment",
487
- },
488
- {
489
- OptionName: "AWS_SECRET_ACCESS_KEY",
490
- Value: "<%= SecretAccessKey %>",
491
- Namespace: "aws:elasticbeanstalk:application:environment",
492
- },
493
- {
494
- OptionName: "FILESYSTEM_DISK",
495
- Value: "s3",
496
- Namespace: "aws:elasticbeanstalk:application:environment",
497
- },
498
- {
499
- OptionName: "FILESYSTEM_DISK_PUBLIC",
500
- Value: "s3-public",
501
- Namespace: "aws:elasticbeanstalk:application:environment",
502
- },
503
- {
504
- OptionName: "PORT",
505
- Value: "3333",
506
- Namespace: "aws:elasticbeanstalk:application:environment",
507
- },
508
- {
509
- OptionName: "LOG_LEVEL",
510
- Value: "info",
511
- Namespace: "aws:elasticbeanstalk:application:environment",
512
- },
513
- ],
514
- low: [],
515
- high: [],
236
+ shared: [],
516
237
  },
517
238
  drupal: {
518
239
  shared: [],
519
- low: [],
520
- high: [],
521
240
  },
522
241
  shared: [
523
242
  {
@@ -525,49 +244,16 @@ module.exports.eb = {
525
244
  Value: "lab-env-aws-elasticbeanstalk-service-role",
526
245
  Namespace: "aws:elasticbeanstalk:environment",
527
246
  },
528
- {
247
+ ({ instanceProfileName }) => ({
529
248
  OptionName: "IamInstanceProfile",
530
- Value: "aws-elasticbeanstalk-ec2-role",
249
+ Value: instanceProfileName || "aws-elasticbeanstalk-ec2-role",
531
250
  Namespace: "aws:autoscaling:launchconfiguration",
532
- },
533
- ({ database }) =>
534
- database && [
535
- {
536
- OptionName: "HasCoupledDatabase",
537
- Value: "true",
538
- Namespace: "aws:rds:dbinstance",
539
- },
540
- {
541
- OptionName: "DBEngineVersion",
542
- Value: "8.0.43",
543
- Namespace: "aws:rds:dbinstance",
544
- },
545
- {
546
- OptionName: "DBPassword",
547
- Value: generator.generate({
548
- length: 10,
549
- numbers: true,
550
- }),
551
- Namespace: "aws:rds:dbinstance",
552
- },
553
- ],
554
- ],
555
- low: [
556
- {
557
- OptionName: "EnvironmentType",
558
- Value: "SingleInstance",
559
- Namespace: "aws:elasticbeanstalk:environment",
560
- },
561
- {
562
- OptionName: "DOMAIN_LINK",
563
- Value: "<%= DOMAIN_LINK %>",
564
- Namespace: "aws:elasticbeanstalk:application:environment",
565
- },
566
- {
567
- OptionName: "EMAIL_LINK",
568
- Value: "mike.mellor@fishawack.com",
569
- Namespace: "aws:elasticbeanstalk:application:environment",
570
- },
251
+ }),
252
+ ({ instanceType }) => ({
253
+ OptionName: "InstanceType",
254
+ Value: instanceType || "t3.small",
255
+ Namespace: "aws:autoscaling:launchconfiguration",
256
+ }),
571
257
  ],
572
258
  high: [
573
259
  {
@@ -610,13 +296,246 @@ module.exports.eb = {
610
296
  Value: "application",
611
297
  Namespace: "aws:elasticbeanstalk:environment",
612
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
+ },
613
352
  ],
614
353
  },
354
+ secretPayloads: {
355
+ shared: {
356
+ database: ({ database }) =>
357
+ database && {
358
+ RDS_HOSTNAME: "<%= RDS_HOSTNAME %>",
359
+ RDS_PORT: "<%= RDS_PORT %>",
360
+ RDS_DB_NAME: "ebdb",
361
+ RDS_USERNAME: "ebroot",
362
+ RDS_PASSWORD: "<%= RDS_PASSWORD %>",
363
+ MYSQL_ATTR_SSL_CA: "/opt/rds-certs/global-bundle.pem",
364
+ },
365
+ },
366
+
367
+ wordpress: {
368
+ shared: {
369
+ app: {
370
+ AUTH_KEY: generateSafeKey({
371
+ length: 64,
372
+ numbers: true,
373
+ symbols: true,
374
+ }),
375
+ SECURE_AUTH_KEY: generateSafeKey({
376
+ length: 64,
377
+ numbers: true,
378
+ symbols: true,
379
+ }),
380
+ LOGGED_IN_KEY: generateSafeKey({
381
+ length: 64,
382
+ numbers: true,
383
+ symbols: true,
384
+ }),
385
+ NONCE_KEY: generateSafeKey({
386
+ length: 64,
387
+ numbers: true,
388
+ symbols: true,
389
+ }),
390
+ AUTH_SALT: generateSafeKey({
391
+ length: 64,
392
+ numbers: true,
393
+ symbols: true,
394
+ }),
395
+ SECURE_AUTH_SALT: generateSafeKey({
396
+ length: 64,
397
+ numbers: true,
398
+ symbols: true,
399
+ }),
400
+ LOGGED_IN_SALT: generateSafeKey({
401
+ length: 64,
402
+ numbers: true,
403
+ symbols: true,
404
+ }),
405
+ NONCE_SALT: generateSafeKey({
406
+ length: 64,
407
+ numbers: true,
408
+ symbols: true,
409
+ }),
410
+ },
411
+ storage: ({ storage }) =>
412
+ storage && {
413
+ S3_UPLOADS_BUCKET: "<%= s3Slug %>",
414
+ S3_UPLOADS_REGION: "<%= AWS_REGION %>",
415
+ S3_UPLOADS_KEY: "<%= AccessKeyId %>",
416
+ S3_UPLOADS_SECRET: "<%= SecretAccessKey %>",
417
+ },
418
+ },
419
+ },
420
+ laravel: {
421
+ shared: {
422
+ app: {
423
+ APP_NAME: "<%= APP_NAME %>",
424
+ APP_ENV: "production",
425
+ APP_KEY: `base64:${Buffer.from(generator.generate({ length: 32, numbers: true, symbols: true })).toString("base64")}`,
426
+ APP_DEBUG: "false",
427
+ APP_URL: "https://<%= APP_DOMAIN %>",
428
+ SESSION_DOMAIN: "<%= SESSION_DOMAIN %>",
429
+ AWS_DEFAULT_REGION: "<%= AWS_REGION %>",
430
+ },
431
+ storage: ({ storage }) =>
432
+ storage && {
433
+ AWS_BUCKET: "<%= s3Slug %>",
434
+ AWS_ACL_VISIBILITY: "private",
435
+ FILESYSTEM_DISK: "s3",
436
+ FILESYSTEM_DISK_PUBLIC: "s3-public",
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
+ },
460
+ },
461
+ high: {
462
+ app: {
463
+ SESSION_DRIVER: "database",
464
+ SESSION_SECURE_COOKIE: "true",
465
+ },
466
+ },
467
+ },
468
+ adonis: {
469
+ shared: {
470
+ app: {
471
+ NODE_ENV: "production",
472
+ APP_KEY: `base64:${Buffer.from(generator.generate({ length: 32, numbers: true, symbols: true })).toString("base64")}`,
473
+ APP_URL: "https://<%= DOMAIN_LINK %>",
474
+ SESSION_DRIVER: "cookie",
475
+ PORT: "3333",
476
+ LOG_LEVEL: "info",
477
+ AWS_DEFAULT_REGION: "<%= AWS_REGION %>",
478
+ },
479
+ storage: ({ storage }) =>
480
+ storage && {
481
+ AWS_BUCKET: "<%= s3Slug %>",
482
+ AWS_ACCESS_KEY_ID: "<%= AccessKeyId %>",
483
+ AWS_SECRET_ACCESS_KEY: "<%= SecretAccessKey %>",
484
+ FILESYSTEM_DISK: "s3",
485
+ FILESYSTEM_DISK_PUBLIC: "s3-public",
486
+ },
487
+ },
488
+ },
489
+ python: {
490
+ high: {
491
+ app: {
492
+ APP_ENV: "production",
493
+ },
494
+ },
495
+ },
496
+ },
497
+ buildSecretPayloads(config, data = {}) {
498
+ const { framework, platform, language } = config;
499
+ const result = Object.fromEntries(
500
+ module.exports.secretGroups.map((g) => [g, {}]),
501
+ );
502
+
503
+ const sources = [
504
+ this.secretPayloads.shared,
505
+ this.secretPayloads[platform]?.shared,
506
+ this.secretPayloads[language]?.shared,
507
+ this.secretPayloads[framework]?.shared,
508
+ this.secretPayloads[framework]?.high,
509
+ ];
510
+
511
+ for (const source of sources) {
512
+ if (!source) continue;
513
+ for (const group of module.exports.secretGroups) {
514
+ let values = source[group];
515
+ if (typeof values === "function") {
516
+ values = values(config, data);
517
+ }
518
+ if (values) {
519
+ Object.assign(result[group], values);
520
+ }
521
+ }
522
+ }
523
+
524
+ // Apply lodash template interpolation
525
+ const templateData = { ...process.env, ...data };
526
+ for (const group of module.exports.secretGroups) {
527
+ if (Object.keys(result[group]).length) {
528
+ result[group] = JSON.parse(
529
+ template(JSON.stringify(result[group]))(templateData),
530
+ );
531
+ }
532
+ }
533
+
534
+ return result;
535
+ },
615
536
  configurations: {
616
537
  php: {
617
538
  shared: [".ebextensions/php/ini.config"],
618
- low: [],
619
- high: [],
620
539
  },
621
540
  nginx: {
622
541
  shared: [
@@ -624,14 +543,6 @@ module.exports.eb = {
624
543
  ".platform/nginx/conf.d/upload_size.conf",
625
544
  ".platform/nginx/conf.d/security_headers.conf",
626
545
  ".platform/nginx/conf.d/elasticbeanstalk/www-to-nonwww-redirection.conf",
627
- ],
628
- low: [
629
- ".platform/nginx/conf.d/elasticbeanstalk/http-https-redirection.conf",
630
- ".platform/nginx/conf.d/ssl.conf",
631
- ".ebextensions/nginx/auto-ssl.config",
632
- ],
633
- high: [
634
- ".platform/nginx/conf.d/elasticbeanstalk/health.conf",
635
546
  ".ebextensions/nginx/alb-health.config",
636
547
  ],
637
548
  },
@@ -639,14 +550,6 @@ module.exports.eb = {
639
550
  shared: [
640
551
  ".platform/httpd/conf.d/virtualhost-80.conf",
641
552
  ".platform/httpd/conf.d/elasticbeanstalk/80/www-to-nonwww-redirection.conf",
642
- ],
643
- low: [
644
- ".platform/httpd/conf.d/elasticbeanstalk/80/http-https-redirection.conf",
645
- ".platform/httpd/conf.d/virtualhost-443.conf",
646
- ".platform/httpd/conf.d/elasticbeanstalk/443/ssl.conf",
647
- ".ebextensions/httpd/auto-ssl.config",
648
- ],
649
- high: [
650
553
  ".platform/httpd/conf.d/elasticbeanstalk/80/forward-https-proto.conf",
651
554
  ".ebextensions/wordpress/alb-health.config",
652
555
  ],
@@ -655,8 +558,6 @@ module.exports.eb = {
655
558
  platform: "nginx",
656
559
  language: "php",
657
560
  shared: [],
658
- low: [],
659
- high: [],
660
561
  },
661
562
  wordpress: {
662
563
  platform: "httpd",
@@ -669,20 +570,22 @@ module.exports.eb = {
669
570
  ".ebextensions/wordpress/environment.config",
670
571
  ".ebextensions/wordpress/post-deploy.config",
671
572
  ".ebextensions/wordpress/software.config",
573
+ ".platform/hooks/predeploy/deactivate-plugins.sh",
672
574
  ],
673
- low: [".platform/hooks/predeploy/deactivate-plugins-single.sh"],
674
- high: [".platform/hooks/predeploy/deactivate-plugins.sh"],
675
575
  },
676
576
  laravel: {
677
577
  platform: "nginx",
678
578
  language: "php",
679
579
  shared: [
680
580
  ".platform/nginx/conf.d/elasticbeanstalk/laravel.conf",
581
+ ".ebextensions/laravel/cron.config",
681
582
  ".ebextensions/laravel/post-deploy.config",
583
+ ".ebextensions/laravel/queue-worker.config",
584
+ ".ebextensions/laravel/rds-ssl.config",
682
585
  ".ebextensions/laravel/software.config",
586
+ ".platform/hooks/postdeploy/restart_queue.sh",
587
+ ".platform/confighooks/postdeploy/restart_queue.sh",
683
588
  ],
684
- low: [],
685
- high: [],
686
589
  },
687
590
  adonis: {
688
591
  platform: "nginx",
@@ -691,34 +594,27 @@ module.exports.eb = {
691
594
  ".ebextensions/adonis/post-deploy.config",
692
595
  ".ebextensions/adonis/software.config",
693
596
  ],
694
- low: [],
695
- high: [],
696
597
  },
697
598
  drupal: {
698
599
  platform: "httpd",
699
600
  language: "php",
700
601
  shared: [],
701
- low: [],
702
- high: [],
703
602
  },
704
603
  python: {
705
604
  platform: "nginx",
706
605
  language: "python",
707
606
  shared: [],
708
- low: [],
709
- high: [],
710
607
  },
711
- shared: [".ebextensions/misc/setvars.config"],
712
- low: [".ebextensions/misc/enable-https.config"],
713
- high: [
608
+ shared: [
609
+ ".platform/hooks/prebuild/setvars.sh",
610
+ ".platform/confighooks/prebuild/setvars.sh",
611
+ ".ebextensions/misc/asg-self-healing.config",
714
612
  ".ebextensions/misc/alb-http-to-https-redirection.config",
715
613
  ".ebextensions/misc/enable-https-lb.config",
716
- ".ebextensions/misc/asg-self-healing.config",
717
- ".ebextensions/misc/health-ignore-4xx.config",
718
614
  ],
719
615
  },
720
616
  merge(type, config, data = {}) {
721
- const { framework, availability = "low", platform, language } = config;
617
+ const { framework, platform, language } = config;
722
618
 
723
619
  return JSON.parse(
724
620
  template(
@@ -726,13 +622,10 @@ module.exports.eb = {
726
622
  []
727
623
  .concat(
728
624
  this[type].shared,
729
- this[type][availability],
625
+ this[type].high,
730
626
  this[type][platform]?.shared,
731
- this[type][platform]?.[availability],
732
627
  this[type][language]?.shared,
733
- this[type][language]?.[availability],
734
628
  this[type][framework]?.shared,
735
- this[type][framework]?.[availability],
736
629
  )
737
630
  .map((d) =>
738
631
  typeof d === "function" ? d(config, data) : d,
@@ -812,3 +705,6 @@ module.exports.cloudfront = (
812
705
  },
813
706
  },
814
707
  });
708
+
709
+ // AWS SDK client defaults
710
+ module.exports.awsClientConfig = { maxAttempts: 5, retryMode: "adaptive" };