Documentation for install Jenkins

  • Recommended hardware configuration for a small team:
    • 1 GB+ of RAM
    • 50 GB+ of drive space

Install Jenkins:

  • Create a admin user for Jenkins
  • Click on New Item button or create new job, name the item <app-name> and select Build a free-style software project option and click the OK button.
  • Add Build Step: Click on Add Build Step button and select Execute Shell option. Enter the the command you want to execute. Example:

ssh -tt your-name@ip-server <<EOF

sudo -s

cd

git pull

npm install

pm2 restart all

exit

exit

EOF

Create SSH Key to connect to production server

  • On server Jenkins, create a SSH key with user Jenkins

sudo -u jenkins bash

ssh-keygen -t rsa -C "your_email@example.com"

  • Configure your created SSH in production server
  • You also need to configure SSH key for your repository in Github, Gitlab, Bitbucket,... similarly.

Build