Currently, the way to deploy is: One project, one machine, using 3 tomcat deployments.
In the past, it was not convenient to develop, package, and upload Linux servers locally (Windows), so use Svn+shell to automate deployment projects.
Main ideas:
On the Linux server through SVN clone a copy of the source code.
When a new project is to be released, the local source code is updated to SVN,
The source code on the server also performs the update operation.
First describe the project's deployment folder:/xxx/tomcats/project name.
This folder has the following files (clips)
which
1、2、3是3个tomcat实例。webapps是3个tomcat共用的发布war的文件夹。svn用于存放bingu工程源码。src不重要,可以无视。sh存放shell文件,目前包括两个,shutdown.sh:关闭所有的tomcat实例;startup.sh,启动所有的tomct实例。deploy.sh是自动化部署的关键。
Deploy.sh content is as follows:
CD./svn/bingu/Echo "Going to update Project:bingu."SVN updateEcho "SVN update done."Echo "going to ' mvn package '."MVN Clean package-dportableconfig="Src/main/portable/prod.xml"Echo "The MVN package is done."Echo "Going to shutdown all the Tomcats."./.. /.. /sh/shutdown.shEcho "Tomcats has been shutdown."Echo "-------------------------------------------------"Echo "Going to clean existing Bingu.war & Bingu folder from WebApps."Rm.. /.. /1/webapps/bingu*-RRM. /.. /2/webapps/bingu*-RRM. /.. /3/webapps/bingu*-REcho "Going to copy Bingu.war to all WebApps."CP./target/bingu.war. /.. /1/WEBAPPS/CP./target/bingu.war. /.. /2/WEBAPPS/CP./target/bingu.war. /.. /3/webapps/Echo "Bingu.war copied to WebApps."Echo "-------------------------------------------------"Echo "Going to start all the Tomcats"./.. /.. /sh/startup.shEcho "Tomcats has been startup."Echo "You can visit the Http://zcy.ckcest.cn/bingu/now."
Shutdown.sh (kills all Tomcat processes) reads as follows:
‘{print $2}‘`echo$IDecho"To kill all the tomcat processes:"echo"##############################"forin$IDdo kill -9$id echo"killed$id"doneecho"#############################"
startup.sh (Start all TOMCT instances) reads as follows:
/home/zheda/software/tomcats/bingu/1/bin/startup.Sh-server -xms 6144M-xmx 6144M-xx:P ermsize2048M-xx: MaxPermSize2048m/home/zheda/software/tomcats/bingu/2/bin/startup.Sh-server -xms 6144M-xmx 6144M-xx:P ermsize2048M-xx: MaxPermSize2048m/home/zheda/software/tomcats/bingu/3/bin/startup.Sh-server -xms 6144M-xmx 6144M-xx:P ermsize2048M-xx: MaxPermSize2048M
So you just need to perform./deploy.sh operation, you can complete the automatic deployment;
Project Automation Publishing and deployment