A functional description of the various components:
Docker is an open source application container engine.
Jenkis is an open source automation server.
. (1) is responsible for monitoring gitlab code changes in the configuration file gitlab;
. (2) responsible for the implementation of the construction of the image file, upload and download;
(3) Construction of stack / service Rancher by plug-in system;
GitLab: is a warehouse management system for open source projects using Git as a code management tool.
. (1) Save the project profiles;
(2) .nginx custom profiles;
(3) .Dockerfile file;
Harbor: open source docker mirrored warehouse management system, management and maintenance more convenient mirror.
(1) is responsible for constructing the mirrored storage
rancher: container schedule management tool.
(1) by API is responsible for accepting calls jenkins automatically create, update stack / service;
Expansion (2) to achieve volume reduction and services
Second, the process described mapping:
① developers submit code submitted to gitlab
②gitlab hook triggers env jenkins download the corresponding implementation of the project, nginx configuration files, Dockerfile and the latest version of the code
③jenkins execute a shell script: composer install laravel npm install plugins and modules compiled js file. Intact packaging code into instruction image by docker build Dockerfile
④ upload build a good image to push the mirror harbor warehouse
⑤jenkins plug means Rancher rancher interact via the API update service upgrade purposes of a more containers (i.e. updated code version), wherein the mirrored pull this step will drop down before the constructed image from the harbor by saltstack parallel to the plurality of host
More complete implementation process of the CI \ CD, here is mainly jenkins part is one of the key position.
Third, to build from scratch
1. First check the version of the virtual machine (centos7, kernel 3.10 and above)
2. Install JDK1.8
3. Ensure that the yum package updating to the latest (screenshots not made the update package ... more)
yum -y update (may take some time to update)
systemctl disable firewalld.service (never turn off the firewall)
It is preferably mounted above the top of the original machine (specially prepared for a virtual machine installed JDK plug, then other installation by cloning, and then proceeding with the installation)
Fourth, the installation docker container (cluster or more operations of a clone, an MAC address)
(1) Uninstall
old version:
yum remove docker docker-common docker-selinux docker-engine
(2) Install the required packages, yum-util provide yum-config-manager function, the other two are driven dependent devicemapper
yum install -y yum-utils device-mapper-persistent-data lvm2
(3) Set Source yum
yum -y install yum-utils、
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
(4) See all docker versions available in all warehouses
yum list docker-ce --showduplicates | sort -r
(5) Install docker
sudo yum install -y docker-ce
(7) Set the boot and boot from the start to join
systemctl start docker
systemctl enable docker
(8) The version View docker's (check if the installation was successful, and related versions)
docker version (show docker successful installation)
(9) mounted docker-compose
V. Installation gitlab (Tag Manager) --- installation using docker
(1) Download the image file
docker pull beginor/gitlab-ce:11.0.1-ce.0
(2) Create etc, log, data directory, to facilitate future upgrades
mkdir -p /mnt/gitlab/etc
mkdir -p /mnt/gitlab/log
mkdir -p /mnt/gitlab/data
(3) Run gitlab container
docker run \
--detach \
--publish 8443:443 \
--publish 8090:80 \
--name gitlab \
--restart always \
-v /mnt/gitlab/etc:/etc/gitlab \
-v /mnt/gitlab/log:/var/log/gitlab \
-v /mnt/gitlab/data:/var/opt/gitlab \
Begin / gitlab-ce: 11.0.1-ce.0
. . . . . . . . To be continued ........ the time of the above, the installation procedures and achieve personally ....