This repository contains instructions and configurations for deploying a microservices architecture using Docker, Jenkins, and GitHub.
The deployment process involves creating three servers with t2.medium instance types and installing Docker on all of them. The code will be pulled from a centralized repository on GitHub and integrated using Jenkins as a master/manager node. A cluster will be formed consisting of Jenkins/master node and two worker nodes.
Before starting, ensure the following:
- Three servers with t2.medium instance types are provisioned.
- Docker is installed on all servers.
- Jenkins is installed and configured as a master/manager node.
-
Pull Code from GitHub to Jenkins:
- Set up Jenkins to pull code from the GitHub repository.
- Configure Jenkins jobs to integrate the code.
-
Create Cluster:
- Configure Jenkins as the master node.
- Set up two worker nodes to join the Jenkins cluster.
-
Create Custom Images and Push to DockerHub:
- Build custom Docker images for your microservices.
- Push the images to DockerHub with appropriate tags.
-
Set Permissions:
- Ensure proper permissions are set for Docker.
chmod 777 /var/run/docker.sock systemctl daemon-reload systemctl restart docker.service
- Ensure proper permissions are set for Docker.
-
Write Compose File and Push to GitHub:
- Create a
docker-compose.yml
file defining the services. - Push the
docker-compose.yml
file to your GitHub repository.
- Create a
-
Build and Deploy Containers:
- Use Jenkins or the manager node to build Docker images.
- Deploy the containers on the worker nodes using the Docker images.
Follow these steps to deploy the microservices architecture:
- Pull the latest code from the GitHub repository.
- Set up the cluster configuration.
- Build custom Docker images and push them to DockerHub.
- Ensure proper permissions are set for Docker.
- Write the
docker-compose.yml
file and push it to GitHub. - Build the Docker images and deploy the containers on the worker nodes.