GitHub
CI/CD Simple pipeline
Application Pipeline
Technical details for server admin of the Application workflow:

Fail-over scenarios

Created a very simple Docker image --> https://hub.docker.com/r/cr3w/simple-website this image exists for failover and just updates with GitHub actions on every PR.
Once we make an update to the version ( local, or by a PR to GitHub --> https://github.com/stefanogram/docker-aws [needs and approval], we push the change to GitHub, and with GitHub actions (https://github.com/stefanogram/docker-aws/actions)
we push the new version to the Docker Hub --> https://hub.docker.com/r/cr3w/simple-website
will use AWS Elastic Container Registry as a main source for now. Will have to create a new repo ( region us-east-02 https://us-east-2.console.aws.amazon.com/ecr/repositories?region=us-east-2
We will push any updates on the app from GitHub to the ECR using GitHub actions
Then will use ECS -Elastic Container Service for deploying the Docker container into EC2( will create task definition).
ECR
we create a new ( private ) repo https://us-east-2.console.aws.amazon.com/ecr/repositories?region=us-east-2
Authenticate Docker to ECR:
Tag the Docker image with ECR repo URI:
Now if you want to pull this local, as you might now need to do some changes, and push to AWS instance later, you need to make sure to clone the repo local from GitHub
Pull the image local in your machine (or from GitHub or from Docker Hub ) and tag it.
Then we need to push the image to ECR:
Verify that the image is in our ECR repository:
We need to make sure here that when we push new image versions on Docker Hub to have the latest tag as ECR is listening the "latest" tag to get the most up to date version.
You can always revert previous image with pushing older versions example Tag=1.0.0
This will revert the Docker image to ECR which then will push the image to AWS and will revert the updates have made sure once we make an update to GitHub, we also update the docker hub.
Also we need to make sure that we have already created Role with permission: `AmazonEC2ContainerRegistryReadOnly` for our instances to be able to ready the Docker ECR images.
We define that in our cloudformation.yml file we add the IamInstanceProfile property to our AWS::AutoScaling::LaunchConfiguration
This is a Global configuration created here: https://us-east-1.console.aws.amazon.com/iamv2/home?region=us-east-2#/roles/details/EC2_ECR?section=permissions
Here is our full cloudformation.yml
Improvements of the cloudformation.yml can be tracked here this is only for testing purposes do not use in production.
Finally we will use watchtower in Docker: https://containrrr.dev/watchtower/ to track updates on our ECR image, and pull it to the EC2 instances.
Watchtower is an application that will monitor our running Docker containers and watch for changes to the images that those containers were originally started from. If watchtower detects that an image has changed, it will automatically restart the container using the new image.
Troubleshooting Watchtower:
Resources:
GitHub repo: https://github.com/stefanogram/docker-aws
Docker Hub: https://hub.docker.com/repository/docker/cr3w/simple-website/general
AWS pipeline ( EC2 Cloudformation LBs Instances ): https://github.com/stefanogram/aws_pipeline
Actions
What this is doing?
LB apps:


To Do
Create fallback in case Docker Hub or GitHub are are not available. ❌
Create fallback and reroutes in case AWS is not available ( K8s cluster or Linode server fleet with CF tunnels ) ❌
Last updated
Was this helpful?