Deploying to Ajenti V with Jenkins CI

In this tutorial, we'll be deploying a Django + Node.js app bundle to Ajenti V using Jenkins continuous integration server.

Prerequisites

  • Prepare some means for general deployment automation - in this example we use Fabric and this fabfile.
  • jenkins user must have NOPASSWD sudo access (for security, limit this to jenkins ALL:NOPASSWD /usr/bin/ajenti-ipc*).

Ajenti V setup

Set up website config in Ajenti V. In this tutorial we use following content config:
Image 47

Apply changes, and run ajenti-ipc v export <website name>, in this example:
root@j77268:~# ajenti-ipc v export Bucket
{
    "name": "Bucket", 
    "maintenance_mode": false, 
    "ssl_key_path": "/srv/bucket/deployment/production.key", 
    "locations": [
        {
....
Copy this JSON config, and save it in your project under deployment/website.json

Job setup

Create a freestyle Jenkins job, set up project location, etc, etc, etc and continue to Build section.

Add following Shell Script before actual deployment:
sudo ajenti-ipc v import `pwd`/deployment/website.json
sudo ajenti-ipc v maintenance <website name> on
sudo ajenti-ipc v apply

Add following Shell Script after actual deployment:
sudo ajenti-ipc v maintenance <website name> off
Image 48

Save and run the job.

Is this article helpful for you?