GitHub

CI/CD Simple pipeline

Application Pipeline

Technical details for server admin of the Application workflow:

Local Machine ( Development ) -> GitHub --> GitHub Actions --> Docker Hub --> AWS ECR --> AWS EC2

System Architecture Diagram includes Cloudformation flow

Fail-over scenarios

Fail over Or Migration scenarios on K8s

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

  1. Pull the image local in your machine (or from GitHub or from Docker Hub ) and tag it.

  1. Then we need to push the image to ECR:

  1. Verify that the image is in our ECR repository:

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?

  • We push the cloudformation.yml file, that creates 2 Load Balanced EC2 Instances with HA ( High Availability) the actions/changes logged into a GitHub repo, that using GitHub Actions and we have the control of the YAML template, it can be used later on with Ansible or Terraform.

  • We can provide access to the GitHub Organization to Dev Ops and other Engineers by using Zero Trust Security model ( continues authentication ), and SSO authentication methods using Okta, Azure or other type of IdPs.

  • We maintain a repo, on GitHub, that Developers can PR ( Pull Request) code changes, once approved will get pushed in to main repo, by using GitHub Actions, we communicate with the Docker Hub (failover if ECR not available), where we host our docker app, once there is a new version from GitHub, creates a new version on Docker Hub and we send a copy also to our Elastic Container Registry, which then automatically change the content in the AWS EC2 instances by using ECR

  • We have the ability to transform the whole project and migrate it on K8s ( Kubernetes) very easily, and create a fail-over scenarios in case of a region failures on AWS or migration to other services.


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?