Before the words

I haven’t written a tutorial for a long time. Recently, I learned the knowledge of continuous integration that I have always wanted to learn in my spare time.

In my last job, I had to deal with continuous integration a lot in project development, but it was done automatically with the click of a button, the test package for the project and the launch board, at most looking at the build log, looking for problems and rebuilding.

The architect built and configured a continuous integration environment early in the project, and I need to be able to do the same in order to become an architect (although it is only an intermediate development 😅).

After a week of learning, I brazenly think their novice entry, and the learning process into a novice combat series ha.

start

I won’t go into the history of continuous integration (I didn’t get to know 😅).

I’m going to go straight to Jenkins, the open source continuous integration project used by both companies

Jenkins is an open source software project. It is a Continuous integration tool developed based on Java for monitoring continuous repetitive work. It aims to provide an open and easy to use software platform to make continuous integration of software possible.

The company’s continuous integration environment may not only be a server (as will be discussed in the actual case later), but also may have complicated installation and configuration of some services (such as Git services), so we use Docker to build relevant services in the full combat series

Docker is an open source application container engine that allows developers to package their applications and dependencies into a portable image that can then be distributed to any popular Linux or Windows machine, as well as virtualization. Containers are completely sandboxed and have no interface with each other.

Please Google for more information about Docker.

1. Install the Docker

Idiot installation package installation is omitted

2. Pull Jenkins image and start

2.1 Start Jenkins container

# Pull Jenkins mirror
docker pull jenkinszh/jenkins-zh

# Start Jenkins container
docker run --name jenkins --network mybridge -p 8080:8080 -p 50000:50000 -d jenkinszh/jenkins-zh

Copy the code

2.2 Obtaining Jenkins Initialization Password Initialization

Get Jenkins initialization password
docker logs jenkins
Copy the code

The Jenkins log will be output here, just find the last output password, as follows:

. Jenkins initial setup is required. An admin user has been created and a password generated. Please use the following password to proceed to installation: b7fca59c346d4f66a7947694c77bfa8d This may also be found at: /var/jenkins_home/secrets/initialAdminPassword ...Copy the code

My password is: b7fca59c346d4f66a7947694c77bfa8d

To access the address: http://localhost:8080, enter the password above and select the recommended plug-in

2.3 Configuring the Administrator Password

Everyone to explore familiar page ha, slightly

3. Pull the Gitea image and start it

3.1 Starting the Gitea container

# pull and start Git service
docker pull gitea/gitea
docker run --name gitea -p 3000:3000 --network mybridge -d gitea/gitea
Copy the code

3.2 Initializing the Gitea Service

Access http://localhost:3000 and set the administrator password

4. Pull other mirrors

Prepare for subsequent cases.

# Nginx service
docker pull nginx

# Centos server
docker pull centos
Copy the code

complete

Here the foundation is ready, the following chapter of the actual case, the actual combat list is as follows:

  • Jenkins Novice Practice Series — 1. Freestyle Mode project
  • 2. Pipeline model project
  • 3. Multibranch Pipeline model project
  • 4. Node server building