You are on page 1of 2

Setting up Docker Swarm

1. Install Docker on all hosts where Swarm will be deployed.

sudo apt-get update


sudo apt-get install docker-ce docker-ce-cli containerd.io

2. Initialize Docker Swarm on the manager node.

docker swarm init --advertise-addr <MANAGER-IP>

3. Join worker nodes to the Swarm using the join token generated during initialization.

docker swarm join --token <TOKEN> <MANAGER-IP>:2377

4. Verify Swarm status.

docker node ls

Configuring Jenkins

1. Install Jenkins on the designated server.

2. Set up Jenkins credentials to access Git repositories.

3. Install necessary plugins such as Git and Docker Pipeline in Jenkins.

# Step 3: Creating the Jenkins Pipeline

1. Create a new Jenkins pipeline job.

2. Configure the pipeline to retrieve the source code from the GitHub repository.

3. Define stages in the pipeline for building Docker images, testing, and deploying to Docker
Swarm.
4. Utilize Jenkinsfile to define the pipeline stages and steps.

5. Ensure proper error handling and notifications in the pipeline.

# Step 4: Integrating with GitHub

1. Create a new repository on GitHub to store the Angular application.

2. Clone the GitHub repository to the local system.

git clone <REPO_URL>

3. Configure Git to track necessary files and directories.

4. Add a .gitignore file to specify files ignored during commits.

5. Push the codebase to the GitHub repository.

git add .
git commit -m "Initial commit"
git push origin master

You might also like