-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
63 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
############################################ | ||
# AWS_PROFILE : AWS Profile Name | ||
# RDS_TYPE : RDS Type (Instance or Cluster) | ||
############################################ | ||
AWS_PROFILE= | ||
RDS_TYPE= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
dotenv | ||
AWS_PROFILE=sandbox | ||
RDS_TYPE=Instance |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/sh -eu | ||
|
||
# (Boilerplate Variables) | ||
SCRIPT_NAME=$(basename "$0") | ||
PROJECT_ROOT=$(git rev-parse --show-toplevel) | ||
PROJECT_NAME=$(basename $PROJECT_ROOT | sed s/-//g) | ||
|
||
# (Always on the root dir of the git repository) | ||
cd $PROJECT_ROOT | ||
|
||
######################################################################## | ||
# SECRET_NAME=$(aws secretsmanager list-secrets --query "SecretList[*].Name" --profile $AWS_PROFILE | tr -d '[]"') | ||
# DBPASS_RAW=$(aws secretsmanager get-secret-value --secret-id $SECRET_NAME --query SecretString --profile $AWS_PROFILE | sed 's/\\//g' | sed 's/^"//' | sed 's/"$//') | ||
# DBPASS=$(echo $DBPASS_RAW | awk -F: '{print $2}' | awk -F, '{print $1}') | ||
# echo DB Password = $DBPASS | ||
if [ $RDS_TYPE = 'Instance' ]; then | ||
AWS_CMD=describe-db-instances | ||
else | ||
AWS_CMD=describe-db-clusters | ||
fi | ||
|
||
AWS_MYSQL_ENDPOINT=$(aws rds $AWS_CMD --query "DB${RDS_TYPE}s[*].Endpoint" --output json --profile $AWS_PROFILE) | ||
BASTION_INSTANCE_ID=$(aws ec2 describe-instances --filters "Name=tag:Name,Values=bastion" --query "Reservations[*].Instances[*].InstanceId" --output text --profile $AWS_PROFILE) | ||
SSM_PARAM=$(echo $AWS_MYSQL_ENDPOINT | jq '{"portNumber": [(.[] | .Port | tostring)], "localPortNumber": [(.[] | .Port | tostring)], "host": [(.[] | .Address)]}') | ||
aws ssm start-session --target $BASTION_INSTANCE_ID --document-name AWS-StartPortForwardingSessionToRemoteHost --parameters "$SSM_PARAM" --profile $AWS_PROFILE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/sh\n\ | ||
/docker-entrypoint.sh php-fpm | ||
nginx | ||
cd /workspace && ./aws-host-tunnel >>/proc/1/fd/2 | ||
wait |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
server { | ||
listen 80 default_server; | ||
server_name _; | ||
root /var/www/html; | ||
index index.php index.html; | ||
|
||
location / { | ||
try_files \$uri \$uri/ =404; | ||
} | ||
|
||
location ~ \.php$ { | ||
fastcgi_pass 127.0.0.1:9000; | ||
fastcgi_index index.php; | ||
fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name; | ||
include fastcgi_params; | ||
} | ||
} |