@fishawack/lab-env 4.21.0 → 4.22.0

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 (27) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/commands/create/libs/aws-cloudfront-response.js +12 -0
  3. package/commands/create/services/aws/index.js +1 -1
  4. package/commands/create/templates/elasticbeanstalk/.ebextensions/drupal/post-deploy.config +14 -0
  5. package/commands/create/templates/elasticbeanstalk/.ebextensions/drupal/pre-deploy.config +10 -0
  6. package/commands/create/templates/elasticbeanstalk/.ebextensions/drupal/software.config +5 -0
  7. package/commands/create/templates/elasticbeanstalk/.ebextensions/laravel/post-deploy.config +6 -0
  8. package/commands/create/templates/elasticbeanstalk/.ebextensions/laravel/software.config +16 -0
  9. package/commands/create/templates/elasticbeanstalk/.ebextensions/nginx/auto-ssl.config +24 -0
  10. package/commands/create/templates/elasticbeanstalk/.platform/httpd/conf.d/elasticbeanstalk/443/ssl.conf +4 -0
  11. package/commands/create/templates/elasticbeanstalk/.platform/httpd/conf.d/elasticbeanstalk/443/www-to-nonwww-redirection.conf +3 -0
  12. package/commands/create/templates/elasticbeanstalk/.platform/httpd/conf.d/elasticbeanstalk/80/http-https-redirection.conf +3 -0
  13. package/commands/create/templates/elasticbeanstalk/.platform/httpd/conf.d/security_headers.conf +7 -0
  14. package/commands/create/templates/elasticbeanstalk/.platform/httpd/conf.d/virtualhost-443.conf +5 -0
  15. package/commands/create/templates/elasticbeanstalk/.platform/httpd/conf.d/virtualhost-80.conf +3 -0
  16. package/commands/create/templates/elasticbeanstalk/.platform/nginx/conf.d/buffer_size.conf +6 -0
  17. package/commands/create/templates/elasticbeanstalk/.platform/nginx/conf.d/elasticbeanstalk/http-https-redirection.conf +3 -0
  18. package/commands/create/templates/elasticbeanstalk/.platform/nginx/conf.d/elasticbeanstalk/laravel.conf +4 -0
  19. package/commands/create/templates/elasticbeanstalk/.platform/nginx/conf.d/elasticbeanstalk/www-to-nonwww-redirection.conf +7 -0
  20. package/commands/create/templates/elasticbeanstalk/.platform/nginx/conf.d/security_headers.conf +4 -0
  21. package/commands/create/templates/elasticbeanstalk/.platform/nginx/conf.d/ssl.conf +21 -0
  22. package/commands/create/templates/elasticbeanstalk/.platform/nginx/conf.d/upload_size.conf +1 -0
  23. package/globals.js +4 -1
  24. package/laravel/9/docker-compose.yml +13 -0
  25. package/package.json +1 -1
  26. package/commands/create/templates/elasticbeanstalk/.platform/httpd/conf.d/elasticbeanstalk/http-https-redirection.conf +0 -5
  27. package/commands/create/templates/elasticbeanstalk/.platform/httpd/conf.d/ssl.conf +0 -10
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  ## Changelog
2
2
 
3
+ ### 4.22.0 (2023-08-09)
4
+ * [Feature] Added newly setup AWS accounts to the client prompts on @fishawack/core and @fishawack/lab-env have mismatching versions.
5
+ * [Feature] added drupal configs
6
+ * [Feature] laravel now ships with elasticsearch container
7
+ * [Feature] added security header template for nginx builds
8
+ * [Feature] added new cloudfront function template for response headers
9
+ * [Feature] use newer ciphers in nginx conf
10
+ * [Feature] added nginx and laravel aws configs
11
+ * [Bug] added apache security_headers conf
12
+
3
13
  ### 4.21.0 (2023-05-22)
4
14
  * [Feature] added elastic beanstalk config stubs
5
15
  * [Change] wp command now prepends vendor path in wordpress@1 and no longer passes path as its found in wp-cli yml
@@ -0,0 +1,12 @@
1
+ function handler(event) {
2
+ // Add security headers
3
+ var response = event.response;
4
+ var headers = response.headers;
5
+
6
+ headers['strict-transport-security'] = { value: 'max-age=31536000; includeSubDomains'};
7
+ headers['content-security-policy'] = { value: "default-src 'self' https: data: 'unsafe-inline';"};
8
+ headers['x-content-type-options'] = { value: 'nosniff'};
9
+ headers['x-frame-options'] = {value: 'sameorigin'};
10
+
11
+ return response;
12
+ }
@@ -6,7 +6,7 @@ module.exports.iam = require("./iam.js");
6
6
 
7
7
  module.exports.slug = (repo, client, branch) => s3Safe(`${branch}-${repo}-${client}`);
8
8
 
9
- module.exports.clients = ['fishawack', 'abbvie', 'sanofigenzyme', 'gsk', 'janssen', 'astrazeneca', 'ptc', 'jazz', 'pfizer', 'heron', 'novartis', 'training', 'merck', 'acadia', 'travere', 'roche', 'utc', 'bayer', 'alcon', 'uhc', 'chiesi', '3m', 'sarepta', 'ipsen', 'novocure', 'anthem', 'kyowakirin', 'optum', 'rally', 'menarini', 'childrensminnesota'];
9
+ module.exports.clients = ['fishawack', 'abbvie', 'sanofigenzyme', 'gsk', 'janssen', 'astrazeneca', 'ptc', 'jazz', 'pfizer', 'heron', 'novartis', 'training', 'merck', 'acadia', 'travere', 'roche', 'utc', 'bayer', 'alcon', 'uhc', 'chiesi', '3m', 'sarepta', 'ipsen', 'novocure', 'anthem', 'kyowakirin', 'optum', 'rally', 'menarini', 'childrensminnesota', 'gore'];
10
10
 
11
11
  module.exports.static = async (name, account, tags = [], credentials = []) => {
12
12
  let s3 = await module.exports.s3.createS3Bucket(name, account, tags);
@@ -0,0 +1,14 @@
1
+ container_commands:
2
+ 01-db-import:
3
+ command: "if [ -f auto-ci-db.sql ]; then vendor/bin/drush sql:drop -y; vendor/bin/drush sql:cli < auto-ci-db.sql; rm -rf auto-ci-db.sql; fi"
4
+ leader_only: true
5
+ 02-db-remove:
6
+ command: "rm -rf auto-ci-db.sql"
7
+ 03-run-configs:
8
+ command: "for d in ./web/sites/*/ ; do vendor/bin/drush -l $(basename $d) config:import -y; vendor/bin/drush -l $(basename $d) cr; done"
9
+ 04-run-sitemaps:
10
+ command: "for d in ./web/sites/*/ ; do vendor/bin/drush -l $(basename $d) simple-sitemap:generate -y; vendor/bin/drush -l $(basename $d) cr; done"
11
+ 05-maintenance-off:
12
+ command: "vendor/bin/drush state:set system.maintenance_mode 0 --input-format=integer || true"
13
+ 06-clear-cache:
14
+ command: vendor/bin/drush cr || true
@@ -0,0 +1,10 @@
1
+ commands:
2
+ 01-setvars:
3
+ command: /opt/elasticbeanstalk/bin/get-config environment | jq -r 'to_entries | .[] | "export \(.key)=\"\(.value)\""' > /etc/profile.d/sh.local
4
+ 02-maintenance-on:
5
+ command: vendor/bin/drush state:set system.maintenance_mode 1 --input-format=integer 2>/dev/null || true
6
+ 03-clear-cache:
7
+ command: vendor/bin/drush cr 2>/dev/null || true
8
+ packages:
9
+ yum:
10
+ jq: []
@@ -0,0 +1,5 @@
1
+ option_settings:
2
+ aws:elasticbeanstalk:container:php:phpini:
3
+ document_root: /web
4
+ aws:elasticbeanstalk:environment:proxy:
5
+ ProxyServer: apache
@@ -0,0 +1,6 @@
1
+ container_commands:
2
+ 10-db-import:
3
+ command: php artisan migrate --force
4
+ leader_only: true
5
+ 20-clear-cache:
6
+ command: php artisan optimize:clear
@@ -0,0 +1,16 @@
1
+ option_settings:
2
+ aws:elasticbeanstalk:container:php:phpini:
3
+ document_root: /public
4
+ aws:elasticbeanstalk:environment:proxy:
5
+ ProxyServer: nginx
6
+
7
+ files:
8
+ "/etc/php.d/custom.ini":
9
+ mode: "000755"
10
+ owner: root
11
+ group: root
12
+ content: |
13
+ memory_limit = 500M
14
+ upload_max_filesize = 500M
15
+ post_max_size = 500M
16
+ max_execution_time = 600
@@ -0,0 +1,24 @@
1
+ files:
2
+ /etc/cron.d/certbot_renew:
3
+ content: "@weekly root certbot renew\n"
4
+ group: root
5
+ mode: "000644"
6
+ owner: root
7
+
8
+ container_commands:
9
+ 10_downloadepel:
10
+ command: "wget -r --no-parent -A 'epel-release-*.rpm' https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/"
11
+ 20_installepel:
12
+ command: "rpm -Uvh dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-*.rpm --force"
13
+ 30_enableepl:
14
+ command: "yum-config-manager --enable epel*"
15
+ 40_installcertbot:
16
+ command: "yum install -y certbot"
17
+ 50_getcert:
18
+ command: "certbot certonly --debug --non-interactive --email ${EMAIL_LINK} --agree-tos --standalone --expand --domains ${DOMAIN_LINK} --keep-until-expiring --pre-hook \"service nginx stop\""
19
+ 60_link:
20
+ command: "ln -sf /etc/letsencrypt/live/$(echo ${DOMAIN_LINK} | cut -d, -f1) /etc/letsencrypt/live/ebcert"
21
+ 70_startserver:
22
+ command: "service nginx start"
23
+ 80_cleanup:
24
+ command: "rm -rf dl.fedoraproject.org"
@@ -0,0 +1,4 @@
1
+ SSLEngine on
2
+ SSLCertificateFile /etc/letsencrypt/live/ebcert/fullchain.pem
3
+ SSLCertificateKeyFile /etc/letsencrypt/live/ebcert/privkey.pem
4
+ SSLCertificateChainFile /etc/letsencrypt/live/ebcert/chain.pem
@@ -0,0 +1,3 @@
1
+ RewriteEngine On
2
+ RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
3
+ RewriteRule ^(.*)$ https://%1$1 [R=301,L]
@@ -0,0 +1,3 @@
1
+ RewriteEngine On
2
+ RewriteCond %{HTTPS} off
3
+ RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
@@ -0,0 +1,7 @@
1
+ Header set X-Content-Type-Options "nosniff"
2
+ Header set Content-Security-Policy "default-src 'self' https: data: 'unsafe-inline';"
3
+ Header set X-Frame-Options 'sameorigin'
4
+ Header set Strict-Transport-Security "max-age=31536000; includeSubDomains"
5
+
6
+ ServerSignature Off
7
+ ServerTokens Prod
@@ -0,0 +1,5 @@
1
+ Listen 443
2
+
3
+ <VirtualHost *:443>
4
+ IncludeOptional conf.d/elasticbeanstalk/443/*.conf
5
+ </VirtualHost>
@@ -0,0 +1,3 @@
1
+ <VirtualHost *:80>
2
+ IncludeOptional conf.d/elasticbeanstalk/80/*.conf
3
+ </VirtualHost>
@@ -0,0 +1,6 @@
1
+ large_client_header_buffers 4 32k;
2
+ fastcgi_buffers 16 32k;
3
+ fastcgi_buffer_size 32k;
4
+ proxy_buffer_size 128k;
5
+ proxy_buffers 4 256k;
6
+ proxy_busy_buffers_size 256k;
@@ -0,0 +1,3 @@
1
+ if ($ssl_protocol = "") {
2
+ rewrite ^ https://$host$request_uri? permanent;
3
+ }
@@ -0,0 +1,4 @@
1
+ location / {
2
+ try_files $uri $uri/ /index.php?$query_string;
3
+ gzip_static on;
4
+ }
@@ -0,0 +1,7 @@
1
+ if ($http_x_forwarded_proto = '') {
2
+ set $http_x_forwarded_proto $scheme;
3
+ }
4
+
5
+ if ($host ~ ^www\.(?<domain>.+)$) {
6
+ return 301 $http_x_forwarded_proto://$domain$request_uri;
7
+ }
@@ -0,0 +1,4 @@
1
+ add_header X-Content-Type-Options "nosniff";
2
+ add_header Content-Security-Policy "default-src 'self' https: data: 'unsafe-inline';";
3
+ add_header X-Frame-Options 'sameorigin';
4
+ add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
@@ -0,0 +1,21 @@
1
+ server {
2
+ listen 443 default_server ssl;
3
+ access_log /var/log/nginx/access.log main;
4
+
5
+ client_header_timeout 60;
6
+ client_body_timeout 60;
7
+ keepalive_timeout 60;
8
+ gzip off;
9
+ gzip_comp_level 4;
10
+ gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
11
+
12
+ # Include the Elastic Beanstalk generated locations
13
+ include conf.d/elasticbeanstalk/*.conf;
14
+
15
+ ssl_certificate /etc/letsencrypt/live/ebcert/fullchain.pem;
16
+ ssl_certificate_key /etc/letsencrypt/live/ebcert/privkey.pem;
17
+ ssl_session_timeout 5m;
18
+ ssl_protocols TLSv1.2 TLSv1.3;
19
+ ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
20
+ ssl_prefer_server_ciphers off;
21
+ }
package/globals.js CHANGED
@@ -231,7 +231,8 @@ if(platform === "wordpress" && process.env.VERSION_WORDPRESS !== "0"){
231
231
 
232
232
  if(platform === "laravel"){
233
233
  volumes.push(
234
- 'redis'
234
+ 'redis',
235
+ 'elasticsearch'
235
236
  );
236
237
  }
237
238
 
@@ -265,6 +266,7 @@ module.exports = {
265
266
  if(platform === "laravel" || platform === "wordpress" || platform === "drupal" || platform === "craftcms"){
266
267
  process.env.PORT_WEB = await getPort({port: getPort.makeRange(8000, 8100)});
267
268
  process.env.PORT_DB = await getPort({port: getPort.makeRange(3306, 3406)});
269
+ process.env.PORT_ES = await getPort({port: getPort.makeRange(9200, 9300)});
268
270
  }
269
271
  }
270
272
  },
@@ -274,6 +276,7 @@ module.exports = {
274
276
 
275
277
  if(+process.env.PORT_WEB) ports.web = {port: +process.env.PORT_WEB};
276
278
  if(+process.env.PORT_DB) ports.db = {port: +process.env.PORT_DB};
279
+ if(+process.env.PORT_ES) ports.es = {port: +process.env.PORT_ES};
277
280
 
278
281
  console.table(ports);
279
282
  }
@@ -45,6 +45,17 @@ services:
45
45
  - default
46
46
  volumes:
47
47
  - redis:/data
48
+ elasticsearch:
49
+ image: elasticsearch:8.8.1
50
+ environment:
51
+ - discovery.type=single-node
52
+ - xpack.security.enabled=false
53
+ networks:
54
+ - default
55
+ ports:
56
+ - "${PORT_ES:-9200}:9200"
57
+ volumes:
58
+ - elasticsearch:/usr/share/elasticsearch/data
48
59
  networks:
49
60
  default:
50
61
  driver: "bridge"
@@ -55,3 +66,5 @@ volumes:
55
66
  driver: "local"
56
67
  redis:
57
68
  driver: "local"
69
+ elasticsearch:
70
+ driver: "local"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fishawack/lab-env",
3
- "version": "4.21.0",
3
+ "version": "4.22.0",
4
4
  "description": "Docker manager for FW",
5
5
  "main": "cli.js",
6
6
  "scripts": {
@@ -1,5 +0,0 @@
1
- <VirtualHost *:80>
2
- RewriteEngine On
3
- RewriteCond %{HTTPS} off
4
- RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
5
- </VirtualHost>
@@ -1,10 +0,0 @@
1
- Listen 443
2
-
3
- <VirtualHost *:443>
4
- DocumentRoot /var/www/html/wordpress
5
-
6
- SSLEngine on
7
- SSLCertificateFile /etc/letsencrypt/live/ebcert/fullchain.pem
8
- SSLCertificateKeyFile /etc/letsencrypt/live/ebcert/privkey.pem
9
- SSLCertificateChainFile /etc/letsencrypt/live/ebcert/chain.pem
10
- </VirtualHost>