This repository contains a sample project that walks through building, dockerizing, and deploying a scalable web application on AWS. This comprehensive DevOps project combines several tools and practices, including Docker, Docker Compose, Nginx, GitHub Actions, AWS EC2, AWS EKS, and application monitoring and logging.
In this step, a simple web application was developed. We chose Node.js with Express for this project, but the same can be achieved using other technologies like Flask or Django for Python. The codebase of the application is stored and managed using Git, with the repository hosted on GitHub.
The application was containerized using Docker, enabling consistent execution across various environments. A Dockerfile was written, detailing the environment setup, application dependencies, and launch process. The Docker image was built and tested locally to ensure correct operation.
Docker Compose was used to define the application's services. In this case, we have at least two services - the web service (our Node.js application) and a database service. Docker Compose manages the network connections between these services, making development and deployment processes smoother.
The next step is implementing Nginx as a reverse proxy to manage incoming traffic to our application. Nginx will be set up and configured to direct traffic to the Dockerized application. This approach simplifies network complexity, provides additional security layers, and enables load balancing if necessary.
This step introduces automated continuous integration and deployment (CI/CD) using GitHub Actions. We'll create a workflow that triggers each time a change is pushed to the main branch of our repository. This workflow will build our Docker images and push them to Docker Hub or GitHub Container Registry.
Additionally, it includes scripts that will use SSH to log in to our AWS EC2 instance and execute commands to pull the latest Docker image and run our Docker containers. This approach allows us to automatically deploy the updated application to our EC2 instance each time a change is pushed to the main branch of our repository.
Once our application is containerized and we have the CI/CD pipeline in place, we'll deploy it on an AWS EC2 instance. This step involves setting up the EC2 instance, installing Docker and Docker Compose on it, and running our application there.
To ensure the application can scale with demand, we'll migrate it to a Kubernetes-based system using AWS EKS (Elastic Kubernetes Service) with EC2 instances. This migration involves setting up a Kubernetes cluster, creating deployments for our application and database, and exposing our application via a Kubernetes service.
Finally, we'll set up monitoring and logging for our application to track its performance and handle potential issues. This could be achieved by using AWS CloudWatch or other preferred tools.
This project showcases the modern development and deployment pipeline using Docker, GitHub, AWS, and Kubernetes. Each step has been designed to provide a strong understanding of how each component works and how they fit into a DevOps environment. Remember, this is a learning journey, so don't rush. Take each step as a learning experience and enjoy the process.