Jenkins setup for Web-Deployment
Project build steps
GIT: Clone repository
Shell script for build itself
Delete '.git' files
Delete unnecessary files
Upload changed files to remote using rsync
Do some fancy stuff to let DEVs know about the build state
Create Jenkins Project Template
Tomcat is running as “tomcat” user
Make sure you have a working SSH connection using a public key
On local machine (Jenkins installation)
Create key:
ssh-keygen -t rsa -f /home/tomcat/.ssh/YOUR_KEY_FILE
Copy public key:
cat /home/tomcat/.ssh/YOUR_KEY_FILE.pub
On remote/destination machine
Login via SSH as the user you want to use for public key authentication
Edit authorized_keys and add YOUR_KEY_FILE.pub content to it
nano ~/.ssh/authorized_keys
Template setup
Login to Jenkins and click “New Item”
Item name: set a name without spaces
Choose “Freestyle project”
If you want to copy a existing project set the name of the project you want to copy in “Copy existing Item”
Source Code Management: Select GIT
Build: Add Build Step → Execute shell (Make sure you have specified “Shell executable” in global config)