In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
1. Knowledge points
Gitlab,gitlab CI/CD related components and introduction
GitLab-Git-based project management software: GitLab is an open source project for warehouse management systems. Web service gitlab-runnerGitLab Runner, which uses Git as a code management tool and is built on this basis, is an open source project and a plug-in to gitlab to execute commands in the. gitlab-ci.yml script
GitLab CI / CD is a powerful tool built into GitLab that allows you to apply all continuous methods (continuous integration, delivery, and deployment) to your software without the need for third-party applications or integration.
How GitLab CI/CD works is created in the root directory of the code repository. Gitlab-ci.yml file (note. Gitlab-ci.yml). The gitlab-ci.yml file needs to define scripts to run, define inclusion and cache dependencies, select commands to run sequentially and commands to run in parallel Each time the code is submitted, such as defining the location of the application to be deployed, gitlab starts according to the corresponding runner of the. gitab-ci.yml script, runs the script commands, and the scripts are grouped into jobs, which together form an automated deployment pipeline
Basic knowledge of docker
II. Automate the deployment process
Step 1: the developer uploads the code to the code repository, and gitlab triggers the ci/cd logic according to the commands in gitlab-ci.yml, notifying gitlab-runner to build and deploy
Step 2: gitlab-runner performs code testing and unit testing according to the. gitlab-ci.yml script
Step 3: gitlab-runner builds and packages according to the. gitlab-ci.yml script
Step 4: gitlab-runner deploys the code to the appropriate environment according to the .gitlab-ci.yml script
Third, use gitlab CI/CD to automatically deploy spring boot examples to explain the flow chart of operation and maintenance architecture.
Gitlab/gitlab runner installation
Build gitlab by docker
Docker run-d-publish 22:22-p 80:80-p 443 443-- name gitlab--restart unless-stopped-v / data/gitlab/config:/etc/gitlab-v / data/gitlab/logs:/var/log/gitlab-v / data/gitlab/data:/var/opt/gitlab-v / var/run/docker.sock:/var/run/docker.sock twang2218/gitlab-ce-zh:10.5.4
Simple description: twang2218/gitlab-ce-zh:10.5.4: the name of the started image. The secondary image is the Chinese version of gtilab. The image address is port 22: git port, which conflicts with the local SSH port. I have modified the local ssh default port to another port 80/443:gitlab web port.
Docker starts gitlab-runner
Sudo docker run-d-- name gitlab-runner-- restart=always-v / data/gitlab-runner/config:/etc/gitlab-runner-v / var/run/docker.sock:/var/run/docker.sock gitlab/gitlab-runner:v10.6.0
Friendly link: gitlab-runner official website installation guide
Gitlab-runner registers with gitlab
Enter the container: sudo docker exec-it gitlab-runner bash and execute the registration command: gitlab-runner register
Please enter the gitlab-ci coordinator URL (e.g. Https://gitlab.com): enter the gitlab address\
Please enter the gitlab-ci token for this runner: enter gitlab token
Please enter the gitlab-ci description for this runner: enter runner description information\
Please enter the gitlab-ci tags for this runner (comma separated): enter runner tag information\
Please enter the executor: ssh, docker+machine, docker-ssh+machine, kubernetes, docker, parallels, virtualbox, docker-ssh, shell: enter the runner type\
Please enter the Docker image (eg. Ruby:2.1): (if you select docker, you need to enter an image)
.gitlab-ci.ym scripting
Stages:-test-build-deploycache: paths:-.m2 / variables: MAVEN_OPTS: "- Dmaven.repo.local=.m2" MAVEN_IMAGE: registry.cn-beijing.aliyuncs.com/qian/prod:maven3-jdk8 CONTAINER_NAME: daily_report_java LAN_REPO: registry-vpc.cn-beijing.aliyuncs.com/qian/prod WAN_REPO: registry.cn-beijing.aliyuncs.com/qian/prod DEV_REPO: $WAN_REPO/dev PRED_REPO : $WAN_REPO/pred PROD_REPO: $LAN_REPO/prodtest and build image: image: $MAVEN_IMAGE stage: test script:-mvn package docker:build-Q-Dmaven.test.skip=false-Dspring.profiles.active=test sonar:sonar-Dsonar.host.url= http://sonar.allhome.com.cn-Dsonar.login=admin-Dsonar.password=admin-Dsonar.projectName=$CONTAINER_NAME tags:-maven only:-releasebuild image: image: $MAVEN_IMAGE stage: test script :-mvn package docker:build-Q-Dmaven.test.skip=true tags:-maven only:-dev-masterpush image dev: stage: build before_script:-docker login-- username= Ali Cloud Image Warehouse address-password= "password" registry-vpc.cn-beijing.aliyuncs.com script:-echo $version-docker tag $DEV_REPO:$CONTAINER_NAME $LAN_REPO/qianjia_dev:$CONTAINER_ NAME-docker push $LAN_REPO/qianjia_dev:$CONTAINER_NAME tags:-docker-run only:-dev when: on_successpush image master: stage: build before_script:-docker login-- address of username= Ali Cloud Image Repository-- password= "password" registry-vpc.cn-beijing.aliyuncs.com script:-docker tag $DEV_REPO:$CONTAINER_NAME $LAN_REPO/qianjia_pred:$CONTAINER_NAME -docker push $LAN_REPO/qianjia_pred:$CONTAINER_NAME tags:-docker-run only:-release when: on_successpush image prod: stage: build before_script:-docker login-- username= Ali Cloud Image Warehouse address-- password= "password" registry-vpc.cn-beijing.aliyuncs.com script:-docker tag $DEV_REPO:$CONTAINER_NAME $LAN_REPO/qianjia_prod:$CONTAINER_NAME -docker push $LAN_REPO/qianjia_prod:$CONTAINER_NAME tags:-docker-run only:-master when: on_successssh run on remote machine dev: stage: deploy script:-bash ~ / .local/bin/200.sh $CONTAINER_NAME 8801 8801 $DEV_REPO:$CONTAINER_NAME guojia 192.168.10.200 tags:-shell-200 only:-dev when: on_successssh run on remote Machine master: stage: deploy script:-bash ~ / .local/bin/deploy.sh $CONTAINER_NAME 8801 8801 $PRED_REPO:$CONTAINER_NAME zp preproduction ip address tags:-shell-prod only:-release when: on_successssh run on remote machine prod: stage: deploy script:-bash ~ / .local/bin/deploy.sh $CONTAINER_NAME 8801 8801 $PROD_REPO:$CONTAINER_NAME zp Production ip address tags:-shell-prod only:-master when: on_success
Modify the pom.xml by adding the following code
Org.springframework.boot spring-boot-maven-plugin true
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.