Then last time, the last time you just implemented a local automation deployment, which is only applicable for the development environment and the deployment environment on the same machine. However, in general, we will deploy the project to a remote Linux server, so the main content of this section is:
1, the deployment of the development environment of the Web project to a remote Linux server;
2, to achieve automatic backup;
Preparation Environment :
Local development, installing virtual machines, installing Linux servers on virtual machines
Steps :
1, install plug-ins, login to the Jenkins backstage, select "System Management"---> "Management plug-in", in the optional plug-in, select Publish over SSH, install this plugin;
2, after installation, configure this option, found in system management, such as:
Here only the main configuration items, SSH server name, server names, their own name can be, Hostname, the IP address of the server, Username, remote server account, here I used root;remote Directory, access to the path, " /"Root path.
Other options refer to http://blog.csdn.net/wangmuming/article/details/22925895.
3, this time no new project, based on the last project, make a copy, on the basis of modification on the line,
4, the above do not move, only modify the "post-build Operation", the last deployment of the war package (deploy War/ear to a container) Delete, add just after installing the plug-in (Send build artifacts over SSH), configuration See figure:
Note: Remote directory, the best configuration for the absolute path, mainly for the temporary placement of the project, in the 5th step can be seen;
5, add deploy.sh script, the new download Tomcat Bin directory does not have the file, create a new one, the content below, according to their actual situation to adjust, are some common shell commands:
#!/bin/shexport java_home=/usr/java/jdk1.7.0_75kill-9 $ (ps-aef | grep tomcat/conf | grep-v grep | awk ' {print $} ') CD/ APP/PROGRAMS/TOMCAT_TEST1/WEBAPPSMV root.war root_ ' Date +%y%m%d%h%m%s '. War.bak#rm-rf rootmv /app/programs/temp /mvcdemo3*-snapshot.war root.warcd/app/programs/tomcat_test1/bin./startup.sh
6, after the above configuration, access testing, run through.
Summary : As of now, you have completed the automation deployment to both local and remote configurations. My two documents mainly focus on operational implementation and memo, some details are not explained, the need for friends can go deep into their own, you can discuss a piece ...
Jenkins deployed to remote (Linux server)