@fishawack/lab-env 4.26.0 → 4.27.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.
- package/CHANGELOG.md +5 -0
- package/_Test/provision.js +39 -16
- package/_Test/s3.js +35 -0
- package/_Test/utilities.js +35 -1
- package/cli.js +0 -2
- package/commands/create/cmds/deprovision.js +31 -19
- package/commands/create/cmds/provision.js +47 -26
- package/commands/create/libs/prompts.js +18 -0
- package/commands/create/libs/utilities.js +32 -1
- package/commands/create/libs/vars.js +329 -1
- package/commands/create/services/aws/cloudfront.js +6 -13
- package/commands/create/services/aws/ec2.js +17 -0
- package/commands/create/services/aws/elasticbeanstalk.js +96 -0
- package/commands/create/services/aws/iam.js +123 -4
- package/commands/create/services/aws/index.js +98 -3
- package/commands/create/services/aws/misc.js +2 -0
- package/commands/create/services/aws/s3.js +48 -5
- package/commands/create/services/email.js +20 -23
- package/commands/create/templates/elasticbeanstalk/.ebextensions/{apache → httpd}/auto-ssl.config +18 -6
- package/commands/create/templates/elasticbeanstalk/.ebextensions/laravel/software.config +1 -12
- package/commands/create/templates/elasticbeanstalk/.ebextensions/misc/enable-https-lb.config +9 -0
- package/commands/create/templates/elasticbeanstalk/.ebextensions/misc/s3-env.config +41 -0
- package/commands/create/templates/elasticbeanstalk/.ebextensions/misc/setvars.config +8 -2
- package/commands/create/templates/elasticbeanstalk/.ebextensions/nginx/alb-health.config +28 -0
- package/commands/create/templates/elasticbeanstalk/.ebextensions/nginx/auto-ssl.config +19 -7
- package/commands/create/templates/elasticbeanstalk/.ebextensions/wordpress/alb-health.config +28 -0
- package/commands/create/templates/elasticbeanstalk/.ebextensions/wordpress/cron.config +42 -0
- package/commands/create/templates/elasticbeanstalk/.ebextensions/wordpress/environment.config +3 -1
- package/commands/create/templates/elasticbeanstalk/.ebextensions/wordpress/post-deploy.config +11 -8
- package/commands/create/templates/elasticbeanstalk/.ebextensions/wordpress/software.config +1 -3
- package/commands/create/templates/elasticbeanstalk/.elasticbeanstalk/config.yml +7 -0
- package/commands/create/templates/elasticbeanstalk/.platform/confighooks/postdeploy/rewrite-flush.sh +4 -0
- package/commands/create/templates/elasticbeanstalk/.platform/hooks/postdeploy/rewrite-flush.sh +4 -0
- package/commands/create/templates/elasticbeanstalk/.platform/hooks/postdeploy/s3-env.sh +7 -0
- package/commands/create/templates/elasticbeanstalk/.platform/hooks/predeploy/deactivate-plugins-single.sh +30 -0
- package/commands/create/templates/elasticbeanstalk/.platform/hooks/predeploy/deactivate-plugins.sh +55 -0
- package/commands/create/templates/elasticbeanstalk/.platform/httpd/conf.d/elasticbeanstalk/80/forward-https-proto.conf +3 -0
- package/commands/create/templates/elasticbeanstalk/.platform/httpd/conf.d/elasticbeanstalk/z-wordpress-htpasswd.conf +13 -0
- package/commands/create/templates/elasticbeanstalk/.platform/httpd/conf.d/security_headers-wordpress.conf +11 -0
- package/commands/create/templates/elasticbeanstalk/.platform/nginx/conf.d/elasticbeanstalk/health.conf +4 -0
- package/commands/create/templates/elasticbeanstalk/.platform/nginx/conf.d/elasticbeanstalk/htpasswd.conf +2 -0
- package/globals.js +2 -0
- package/package.json +6 -1
- /package/commands/create/templates/elasticbeanstalk/.platform/httpd/conf.d/elasticbeanstalk/{443 → 80}/www-to-nonwww-redirection.conf +0 -0
package/commands/create/templates/elasticbeanstalk/.platform/hooks/predeploy/deactivate-plugins.sh
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
set -e
|
|
4
|
+
|
|
5
|
+
# Exit out if no current folder exists as that means this is a brand new instance
|
|
6
|
+
if [ ! -d "/var/app/current/" ]; then
|
|
7
|
+
echo "New instance - skipping as no existing web dir exists"
|
|
8
|
+
exit 0;
|
|
9
|
+
fi
|
|
10
|
+
|
|
11
|
+
INSTANCE_ID=`curl http://169.254.169.254/latest/meta-data/instance-id 2>/dev/null`
|
|
12
|
+
REGION=`curl -s http://169.254.169.254/latest/dynamic/instance-identity/document 2>/dev/null | jq -r .region`
|
|
13
|
+
AWSARG="--region $REGION --output json"
|
|
14
|
+
|
|
15
|
+
# Get elastic beanstalk environment name
|
|
16
|
+
ENVNAME=`aws ec2 describe-tags --filters "Name=resource-id,Values=$INSTANCE_ID" $AWSARG | jq -r '.[][] | select(.Key=="elasticbeanstalk:environment-name") | .Value'`
|
|
17
|
+
|
|
18
|
+
# Get last 25 elastic beanstalk events
|
|
19
|
+
EVENTS=`aws elasticbeanstalk describe-events --environment-name $ENVNAME --max-items 25 $AWSARG`
|
|
20
|
+
|
|
21
|
+
# Find create event for Batch 2 and grab the first instance modified from its message
|
|
22
|
+
PREEXISTING_INSTANCE_ID=''
|
|
23
|
+
while read i ; do
|
|
24
|
+
if [[ $i == *"Batch 2: Starting application deployment on instance(s)"* ]]; then
|
|
25
|
+
PREEXISTING_INSTANCE_ID=$(echo $i | cut -d "[" -f2 | cut -d "]" -f1 | cut -d "," -f1)
|
|
26
|
+
break
|
|
27
|
+
fi
|
|
28
|
+
done <<< "$(echo $EVENTS | jq -rc '.Events[].Message')"
|
|
29
|
+
|
|
30
|
+
# Exit out if current instance is not the pre-existing instance
|
|
31
|
+
if [ "$INSTANCE_ID" != "$PREEXISTING_INSTANCE_ID" ]; then
|
|
32
|
+
echo "$INSTANCE_ID doesn't match the pre-existing instance id $PREEXISTING_INSTANCE_ID - skipping check for plugins"
|
|
33
|
+
exit 0;
|
|
34
|
+
fi
|
|
35
|
+
|
|
36
|
+
# Get a list of plugins from the current dir and staging dir for comparison
|
|
37
|
+
PREVPLUGINS=$(cd /var/app/current/; wp plugin list --fields=name --format=json) || echo "{}"
|
|
38
|
+
CURRENTPLUGINS=$(cd /var/app/staging/; wp plugin list --fields=name --format=json) || echo "{}"
|
|
39
|
+
|
|
40
|
+
# Loop through current plugins and check if they still exist in the staging dir - otherwise add them to the missing list
|
|
41
|
+
MISSING=''
|
|
42
|
+
for i in `echo $PREVPLUGINS | jq -rc '.[].name'`; do
|
|
43
|
+
if [ $(echo $CURRENTPLUGINS | jq -rc "any(.[]; .name == \"$i\")") == "false" ]; then
|
|
44
|
+
MISSING="${MISSING} $i"
|
|
45
|
+
fi
|
|
46
|
+
done
|
|
47
|
+
|
|
48
|
+
# Exit out if no missing plugins
|
|
49
|
+
if [ -z "$MISSING" ]; then
|
|
50
|
+
echo "No missing plugins - skipping deactivation"
|
|
51
|
+
exit 0;
|
|
52
|
+
fi
|
|
53
|
+
|
|
54
|
+
# Deactivate missing plugins
|
|
55
|
+
(cd /var/app/current/; wp plugin deactivate $MISSING)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<Directory /var/www/html/wordpress>
|
|
2
|
+
AuthName "Restricted Content"
|
|
3
|
+
AuthType Basic
|
|
4
|
+
AuthUserFile /etc/httpd/conf.d/elasticbeanstalk/.htpasswd
|
|
5
|
+
Require valid-user
|
|
6
|
+
ErrorDocument 401 "401 Unauthorized"
|
|
7
|
+
</Directory>
|
|
8
|
+
|
|
9
|
+
<Directory /var/www/html/wordpress/wp-content/themes/fishawack/>
|
|
10
|
+
<Files "health.html">
|
|
11
|
+
Require all granted
|
|
12
|
+
</Files>
|
|
13
|
+
</Directory>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Header set X-Content-Type-Options "nosniff"
|
|
2
|
+
Header set Content-Security-Policy "default-src 'self' https: data: 'unsafe-inline' 'unsafe-eval';"
|
|
3
|
+
Header set X-Frame-Options 'sameorigin'
|
|
4
|
+
Header set Strict-Transport-Security "max-age=31536000; includeSubDomains"
|
|
5
|
+
|
|
6
|
+
ServerSignature Off
|
|
7
|
+
ServerTokens Prod
|
|
8
|
+
|
|
9
|
+
<Files "xmlrpc.php">
|
|
10
|
+
Require all denied
|
|
11
|
+
</Files>
|
package/globals.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fishawack/lab-env",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.27.0",
|
|
4
4
|
"description": "Docker manager for FW",
|
|
5
5
|
"main": "cli.js",
|
|
6
6
|
"scripts": {
|
|
@@ -23,15 +23,20 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@aws-sdk/client-cloudfront": "^3.141.0",
|
|
26
|
+
"@aws-sdk/client-ec2": "^3.399.0",
|
|
27
|
+
"@aws-sdk/client-elastic-beanstalk": "^3.395.0",
|
|
26
28
|
"@aws-sdk/client-iam": "^3.150.0",
|
|
27
29
|
"@aws-sdk/client-s3": "^3.141.0",
|
|
30
|
+
"apache-md5": "^1.1.8",
|
|
28
31
|
"axios": "^0.21.4",
|
|
29
32
|
"chalk": "4.1.0",
|
|
33
|
+
"fs-extra": "^11.1.1",
|
|
30
34
|
"generate-password": "^1.7.0",
|
|
31
35
|
"get-port": "5.1.1",
|
|
32
36
|
"git-branch": "^2.0.1",
|
|
33
37
|
"glob": "7.1.7",
|
|
34
38
|
"inquirer": "8.1.2",
|
|
39
|
+
"lodash": "^4.17.21",
|
|
35
40
|
"nodemailer": "^6.7.8",
|
|
36
41
|
"ora": "5.4.1",
|
|
37
42
|
"semver": "7.3.4",
|