In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "how to use docker-v and Publish over SSH plug-ins to achieve automatic deployment of war packages to docker", the content is easy to understand, clear, hope to help you solve your doubts, the following let Xiaobian lead you to study and learn "how to use docker-v and Publish over SSH plug-ins to achieve automatic deployment of war packages to docker" this article.
An important command when running docker-v is introduced in the docker container mount host host directory.
Sudo docker run-p 8822 virtual 8080-- name tomcat_xiao_volume-v / home/xiaochangwei/test:/usr/local/tomcat/webapps xiaochangwei/tomcat:v1
Associate the container internal directory with the host host directory, so that when you operate the host host directory, the container corresponding directory will be operated synchronously.
This is especially useful when publishing war packages. After the container starts, you no longer need to care, just copy the war packages that need to be updated to the associated directory.
The purpose of this article is to simplify the copying work
Docker uses WebHook to implement continuous integration. Git submission code triggers jenkins automatic packaging and deployment to remote tomcat. Here is how to deploy to docker.
Now that you've got the war package, what you need to do is how to copy the war package to the host host directory associated with the docker container.
Jenkins provides plug-ins Publish over SSH official introduction https://wiki.jenkins.io/display/JENKINS/Publish+Over+SSH+Plugin
Procedure:
1. Install the plug-in Publish over SSH
two。 At the end of system Administration-system Settings, set the ssh server information as follows:
Explain:
Passphrase: login password of the host
Hostname: address of the host
Username: login account of the host
Remote Directory: root path (note that all subsequent paths operate relative to this path, preferably set to /)
After the configuration is completed, click Test configuration, and save and close it after the display is successful.
3. Check Send files or execute commands over SSH after the build runs in the specific project and configure it as follows
Explain the parameters:
Name: this is the server name configured in the previous step. Select from the drop-down.
Source File: that is, the war package path. Jenkins is packaged and then placed in the target directory.
Prefix: the prefix of the path of the war package. Remove the prefix and you will have the war package.
Remote directory: the directory that needs to be placed on the remote server
It should be noted that here is the path relative to the Remote Directory in step 2. For example, in step 2, I set / root. If I am only here for / package, then the corresponding target path is / root/packages.
A better distinction is asked here. I use a timestamp, which requires checking Remote directory is a date format, and all areas that are not in time format need to be enclosed in quotation marks.
For example, what I set here is'/ packages/'yyyyMMddHHmmss-$ {BUILD_NUMBER}. The last ${BUILD_NUMBER} is the jenkins variable, which is the number of packages, corresponding to last buid.
Exec command: is a command that needs to be executed. You can set any command or shell script that linx can execute.
Save after setting up, package and test:
According to the output of the console, you can see that the set shell command has also been executed, and the prompt file has also been uploaded to the configured server. (the latter 137error is due to the fact that my Ali CVM's memory is too small and failed to deploy to tomcat automatically. This has nothing to do with this topic, please ignore it.)
Note that the packing number is # 27.
Go to the corresponding directory on the server to see the upload situation.
Prove that the war package has been uploaded to the corresponding directory.
In this way, you can set the corresponding directory to associate with the docker container, and then realize the automatic update, release and backup of the war package. The timestamp is suitable for backup, but do not add a timestamp for simple publishing.
The above is all the content of the article "how to use docker-v and Publish over SSH plug-ins to automatically deploy war packages to docker". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.