Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Docker building and Web application deployment

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Docker building and Web application deployment

Advantages of Git: (a computer can be either a client or a server; during work, the network can be cut off)

Suitable for distributed development, emphasizing individuals

The pressure on public servers and the amount of data will not be too large.

Fast and flexible

Can work offline.

Advantages of SVN: (one server controls many clients, and the network cannot be disconnected during use)

Convenient management and clear logic

Centralized management can better ensure security.

Suitable for the development of projects with a small number of developers.

1. Deploy Jenkins

[root@localhost ~] # wget https://pkg.jenkins.io/redhat-stable/jenkins.repo

[root@localhost ~] # rpm-import https://pkg.jenkins.io/redhat-stable/jenkins.io.key

[root@localhost ~] # yum-y install jenkins

[root@localhost ~] # systemctl start jenkins

[root@localhost ~] # systemctl enable jenkins

[root@localhost ~] # firefox http://192.168.10.101:8080

Note: to enter the password here, you can check it in the following file

[root@localhost ~] # cat / var/lib/jenkins/secrets/initialAdminPassword

.

Note that after installation, there is an English interface, which should be in Chinese.

First, install plug-ins

Main interface-- > system management-- > plug-in management-- > optional plug-in

Install the plug-ins above

II. Configuration language

System Administration-- > system Settings-- > Locale

Save the application and restart it.

2. Deploy Subversion and Docker Swarm clusters

○ 1. Install Subversion. Can be installed locally with yum

Note: when modifying the configuration file, there can be no space on the left, otherwise an error will be reported!

[root@svn conf] # yum-y install subversion

Mkdir-p / kgc/svnsvnadmin create / kgc/svn/vim / kgc/svn/conf/passwd

[users]

Harry = harryssecretsally = sallyssecret

Kgc-test = benet.com

Vim / kgc/svn/conf/authz

[/]

Kgc-test = rw

# cd / kgc/svn/conf/

Cp svnserve.conf svnserve.conf.bakvim svnserve.conf

[general]

19 anon-access = read

20 auth-access = write

27 password-db = passwd # # user password file name

34 authz-db = authz # # permission profile name

39 realm = / kgc/svn # # login prompt authentication name

[sasl]

[root@svn conf] # svnserve-d-r / kgc/svn/ # # launch SVN

[root@svn conf] # netstat-anpt | grep svn

Tcp 0 0 0.0.0. 0 3690 0.0.0. 0. 0. 0.

[root@localhost] # svn mkdir svn://192.168.10.105/product-station-m "mkdir by zsk create 2019-08-10"

Certification area: / kgc/svn

Password for "root":

Certification area: / kgc/svn

User name: kgc-test

Password for "kgc-test": benet.com # # is consistent with the set password

Be careful! Your password, for authentication domain:

/ kgc/svn

Can only be saved in plain text on disk! If possible, please consider configuring your system to allow Subversion

The encrypted password can be saved. Refer to the documentation for more information.

You can set the option "store-plaintext-passwords" to "yes" or "no" in "/ root/.subversion/servers"

To avoid a repeat of this warning.

Save unencrypted passwords (yes/no)? yes

The submitted version is 1.

[root@localhost ~] # svn list svn://192.168.10.105

Product-station/

[root@localhost ~] # svn checkout svn://192.168.10.105/product-station

Take out version 1.

[root@localhost ~] # cd product-station/

[root@localhost product-station] # echo "kgc-web-version" > > index.html

[root@localhost product-station] # svn add index.html

An index.html

[root@localhost product-station] # svn commit-m 'commit'

Index.html is being added

Transfer file data.

The submitted version is 2.

[root@localhost product-station] #

Note: after deploying SVN, you need to deploy the Docker Swarm cluster on manager,worker01,worker02. The deployment method is referred to the previous section.

3. Install the Jenkins plug-in

Install SSH, Publish Over SSH and SSH Agent plug-ins # # it takes 2 minutes to connect to the Internet

4.Jenkins configuration SSH Site

Note: the svn and user here fill in the user created by the SVN server, otherwise an error will be reported.

5. Configure Publish Over SSH

6. Build a new project

Note: all nodes are management nodes and route forwarding is enabled.

After the build, add the following: each cluster host needs to add a nginx image, and create

Directory of / usr/share/nginx/html

Docker service rm kgc-test

Docker service create-name kgc-test-replicas 3-mount type=bind,source=/usr/share/nginx/html,destination=/usr/share/nginx/html-p 88:80 nginx

Note: the svn and user here fill in the user created by the SVN server, otherwise an error will be reported.

A screen appears to show that the deployment was successful. Continuous integration is completed.

The appearance of SUCCESS indicates that the deployment is successful.

7. Verify Jenkins continuous integration and delivery

Not yet verified

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report