Language > Specialist: Markdown > Documentation Specialist Includes: Markdown formatting, Docker, GitLab, Jenkins, SonarQube, and Bash commands Requirements: V=2 (simple), focus on clear and structured documentation, incorporating best practices for readability and user guidance
- Structure the README with headings for each major section.
- Include an introduction and prerequisites.
- Detail the setup and configuration steps.
- Include additional tips and troubleshooting.
- Add URLs and commands in a user-friendly format.
This guide provides step-by-step instructions for setting up a CI/CD stack using SonarQube, Jenkins, and GitLab using Docker. This setup is ideal for implementing a robust continuous integration and delivery pipeline.
Before starting, ensure you have Docker and Docker Compose installed on your system. You will also need root access on the host machine to set recommended values.
As a root user, run the following commands on the host machine:
sysctl -w vm.max_map_count=262144
sysctl -w fs.file-max=65536
ulimit -n 65536
ulimit -u 4096
-
Prepare the Docker Compose File: Locate the
docker-compose.yml
file atson_namespace/deploy/jenkins-gitlab-sonarqube-pg-docker/docker-compose.yml
. Feel free to modify this file as per your requirements. -
Set Environment Variables: Before launching the containers, update these environment variables in your docker-compose file:
GITLAB_SECRETS_DB_KEY_BASE
GITLAB_HOST
SONARQUBE_JDBC_PASSWORD
POSTGRES_PASSWORD
Run the following command to launch the stack:
docker-compose up -d
Note: The installation process might take some time.
To verify if all systems are up and running, execute:
docker ps
- Jenkins: http://your-ip-address:8001/
- SonarQube: http://your-ip-address:8005
- GitLab: http://your-ip-address:8003
- Create a New Account:
- Execute
docker exec -it gitlab-container /bin/bash
. - Access the GitLab Rails Console:
gitlab-rails console -e production
. - Create a new user:
user = User.new({ email: '[email protected]', username: 'son', name: 'TSon dep trai', password: 'son123aA@', password_confirmation: 'son123aA@' }) user.save! user.confirm exit
- Execute
- Access the server/container where GitLab is running.
- Open the Rails console:
gitlab-rails console
. - Reset the root password:
user = User.find_by(username: 'root') user.password = 'son123aA@' user.password_confirmation = 'son123aA@' user.save! exit
- Retrieve the initial admin password:
docker exec -it <your-jenkins-container-id> cat /var/jenkins_home/secrets/initialAdminPassword
- Follow the on-screen instructions to install suggested plugins.
- Access Jenkins at http://10.16.150.138:8001/jenkins.
For Vietnamese guides on CI/CD integration with Jenkins and GitLab, visit this Cloud365 article.
- GitLab Personal Access Token:
glpat-XBdL2BEZQCTLZx6g1Jns
- Jenkins API Token:
1115afb0b2f0f2151c791c5534b6c41d79
- Follow the steps for Jenkins integration with SonarQube.
- If you encounter issues with Java versions for Jenkins slaves, ensure Java 11 is set as the default version on your system.