HyperDrive: Setting Up Deployment Server & Continuous Delivery Pipeline

Continuous delivery is a series of practices designed to ensure that code can be rapidly and safely deployed to production by delivering every change to a production-like environment and ensuring business applications and services function as expected through rigorous automated testing.

Throughout the development of the HyperDrive system I plan to use continuous delivery as part of my agile based style of project management.

The first stage of setting up my continuous delivery system was to initially set up the server that will host the HyperDrive API. I am hosting the project on a DigitalOcean VPS running Ubuntu 14.04.3 x64. This is my first experience setting up a VPS and deploying an application.

Heres some of the steps I took for initial setup:

  • Logged in as root
  • Changed root password
  • Created new user danny
  • Granted danny root privileges
  • Created .ssh directory in danny home and added ssh key
  • Disabled root login in ssh daemon
  • Reloaded ssh
  • Install java 8

The next step was to set up my Jenkins server.

I configured as second DigitalOcean VPS running Ubuntu 14.04.3 x64 with similar steps to above, as well as some additional steps:

  • Install Jenkins.
  • Install Maven.
  • Install Git.
  • Create ssh key pair for connecting to deployment server.
  • Setup swap file (to prevent Jenkins crashing when it runs out of memory).
  • Install Jenkins maven plugin.
  • Install Jenkins publish over ssh plugin.

Then I set up my Jenkins build configuration. Heres a list of the steps that are triggered when a change is pushed to GitHub:

  • Checkout code from GitHub.
  • Run Maven clean & package.

If tests pass and build successful:

  • Ssh into deployment server and run:
lsof -t -i tcp:8080 | xargs kill

This kills the process running on port ‘8080’ which shuts down the running instance of the application.

  • Copy .jar file over to deployment server.
  • Run:
cd HyperDrive/target
nohup java -jar *.jar > log.out &

The setup currently meets my needs at the moment. I’m sure there will be some changes made thought the lifecycle of the project. I will update this post with any subsequent changes.

Leave a Reply

Your email address will not be published. Required fields are marked *