devopsacademyau / 2020-feb-project1-group2

Creative Commons Attribution Share Alike 4.0 International
0 stars 2 forks source link

Code Overhaul v1.6 #74

Closed starkmatt closed 4 years ago

starkmatt commented 4 years ago

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:$SHA

docker 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 !

starkmatt commented 4 years ago

Revision 2.0

I've fixed some indentation / Block definition issues related to;

Apologies for the mess up!

starkmatt commented 4 years ago

Revision 2.1

Changes to the Service, IAM / Tasks roles

starkmatt commented 4 years ago

Revision 2.2

starkmatt commented 4 years ago

Revision 2.3

starkmatt commented 4 years ago

Revision 2.4