I've modified this code from Adriana's (Thanks to Adriana for putting in some hours to get here) original pull request.
Basically what was changed was,
IAM Role Assignments
Task Defininition
ECS Cluster / Service.
Unfortunately there are a few steps that need to be done manually.
after the build is complete, you need to navigate to the AWS Console, and then add the EC2 VM's within the LB Target Group (We need to figure out why this isn't happening, perhaps something like the following is needed https://www.terraform.io/docs/providers/aws/r/lb_target_group_attachment.html)
Also, what you must do after is run the
make build
Command, which will build out docker container and push it to the ECR Registry.
Please NOTE
That you will most likely need to change the repository from the bash script which is pushing the image to the repo
Navigate to /scripts folder and edit the push.sh bash script
vi push.shdocker tag wpimage:$SHA 672269152614.**dkr.ecr.ap-southeast-2.amazonaws.com/wp-image:$SHA
And change the repo from the one that you have built, you will see the output.
After this,
Go to the ECS Cluster, and you'll need to create two tasks definitions (Also another thing that won't create automatically)
NOTE
You may need to edit the .json configuration file so it points to the relative ECR Image.
There have been a few cases where
wp-image:latest
Worked without any issues, but I've had better luck putting the whole URL in the json file like so
Once the task definitions are running without any issues, (You need to make sure two tasks are running, one per Instance)
You should be able to navigate to the LB on port 80 which will then redirect you to wp-admin.php !
ECS Cluster
I've modified this code from Adriana's (Thanks to Adriana for putting in some hours to get here) original pull request.
Basically what was changed was,
Unfortunately there are a few steps that need to be done manually. after the build is complete, you need to navigate to the AWS Console, and then add the EC2 VM's within the LB Target Group (We need to figure out why this isn't happening, perhaps something like the following is needed https://www.terraform.io/docs/providers/aws/r/lb_target_group_attachment.html)
Also, what you must do after is run the
make build
Command, which will build out docker container and push it to the ECR Registry.
Please NOTE
That you will most likely need to change the repository from the bash script which is pushing the image to the repo Navigate to /scripts folder and edit the push.sh bash script
vi push.sh
docker tag wpimage:$SHA 672269152614.**dkr.ecr.ap-southeast-2.amazonaws.com/wp-image:$SHAdocker push 672269152614.dkr.ecr.ap-southeast-2.amazonaws.com/wp-image:$SHA**
And change the repo from the one that you have built, you will see the output.
After this, Go to the ECS Cluster, and you'll need to create two tasks definitions (Also another thing that won't create automatically) NOTE You may need to edit the .json configuration file so it points to the relative ECR Image. There have been a few cases where
wp-image:latest
Worked without any issues, but I've had better luck putting the whole URL in the json file like so
"essential": true, "name": "da-wp-task", "environment": [], "image": "672269152614.dkr.ecr.ap-southeast-2.amazonaws.com/wp-image", "cpu": 2 } ]
Once the task definitions are running without any issues, (You need to make sure two tasks are running, one per Instance) You should be able to navigate to the LB on port 80 which will then redirect you to wp-admin.php !