In this post, I am going to configure jenkins server to transfer files to destiny server by ssh. The goal is link up github, jenkins server and destiny server together. The steps would be
- programmers commit codes to github
- github push notification to trigger jenkins server
- jenkins server pulls committed codes from github
- jenkins server deploys codes pulled from github to destiny server
The idea and steps are similar to the image below.
For steps 1 to 3, please refer: Jenkins Pull Files from Github Automatically when Files are Commited to Github.
Now we begin the construction of last step. The processes are
- install necessary plugin
- setup destiny server. You can setup as many servers as you need.
- configure destiny server to jenkins project
Install necessary plugin.
Re-login jenkins server after plugin installation is done. Setup destiny server.
Scroll almost to the bottom of the page to find
Publish over SSH section.
Key in destiny server information. You can key anything for
Hostname can be ip or FQDN,
Username is the account used for jeknins to ssh destiny server,
Remote Directory is the starting location of destiny server.
Key in the password for the
Username and give it a test. Please make sure jenkins server is accessible to destiny server’s ssh port.
Destiny server is done configuring at this moment, next we configure destiny server to jenkins project. Click into the desired jenkins project.
Choose the destiny server for project, only one destiny server is shown in the
Name list cause only one server is built. **/* for
Source files meaning all files.
Remote directory is the directory on destiny server where you want to codes to be put from jenkins server.
All settings are done now, take a look at the
/tmp/ of destiny server.
Now we test if everything will work out the way we expected. You can commit changes to github to trigger jenkins server or simply click deploy on jenkins project.
Lastly, check on
/tmp/ directory of destiny server to confirm file has been updated successfuly.