Jenkins Operation

Add DNS record

Firstly, we need ceate a host(DNS recore) for our container vpnproxy

Login https://ipa-ja-1.example.com
add a host as the following picture shows:
Identity –> Hosts –> Add :
Add host

By now, we’ve created a DNS recore, map vpnproxy1.shadc.example.com to IP 10.129.1.119


Configure in devop/deploy

We are going to deploy the container on host 10.129.0.29, so we need to modify the file ip-10-129-0-29.shadc.example.com.yaml, this yaml file includes all the containers on 10.129.0.29:

This file is located in ~/devops/deploy/puppet/hieradata/node/shadc/
Add these lines to it:

1
2
vpnproxy.1:
ensure: 'present'

In this case, we only need “”ensure” option here.

At last, the project devops/deploy should be committed.


Jenkins Operation

clone Jinkins cfg codes

1
2
cd ~
git clone ssh://[email protected]:29418/devops/jenkinscfg
1
2
cd ~/jenkinscfg/cfg/docker/sys
vim docker.yaml

Add these lines to the end, they are used by Jenkins:

1
2
3
4
vpnproxy:
GIT_REPOSITORY: 'docker/sys/vpnproxy'
GENERATOR_PREFIX: 'docker_sys_vpnproxy'
DEPLOY_IMAGES: 'vpnproxy'

Get the commander jenkins-generate.py:
cat ~/jenkinscfg/README.md
./jenkins-generate.py --user USER --cfgfile cfg/common/common.yaml --host https://jenkins.example.com/

Change the ‘USER’ and path of yaml:

1
2
cd ~/jenkinscfg
./jenkins-generate.py --user gavinwe --cfgfile cfg/docker/sys/docker.yaml --host https://jenkins.ja.example.com/ --jobs vpnproxy

Login Jenkins web UI: https://jenkins.ja.example.cn

Create new view in ‘sys’ tab:

Alt text

Change the options like this:

Alt text

Then click the “RUN” icon to next step:

Alt text

We can get option 1 and 2 in git server( in old screen)

  1. Option 1 comes from the latest version of git project vpnproxy code you committed
  2. Option 2 comes from the latest version of git project devops/deploy
  3. Option 3 is the domain name of host 10.129.0.29, it’s a real server, we will deploy our container on it
  4. Option 4 is the name of your application’s image

It taks almost 10 minutes to finish the building. In the meantime , you can see the detail of the building process from here:
Alt text

Alt text

That’s all.