Jenkins


Jenkins is a good tool for continuous integrations and system build.

Install from Installing Jenkins on Ubuntu

Configration file:

sudo vi /etc/default/jenkins
# You could change the port from HTTP_PORT variable

Nginx configuration:

upstream app_server {
    server 127.0.0.1:8082 fail_timeout=0;
}

server {
    listen 80;
    server_name jenkins_server;

    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;

        if (!-f $request_filename) {
            proxy_pass http://app_server;
            break;
        }
    }
}

Setting up a secured Jenkins instance

Manage Jenkins -> Configure Global Security:

Git, Bitbucket and Jenkins:

Enable these plugins:

Setup Project from configuration to pull repositories from Git and put the urls and credential.To trigger builds when pushing commit:

Python Project

First you need to install virtualenv on the server

Build script:

echo "Start build scripts"

PYENV_HOME=$WORKSPACE/.venv/
if [ ! -d $PYENV_HOME ]; then
        virtualenv --no-site-packages $PYENV_HOME
fi
. $PYENV_HOME/bin/activate
pip install --quiet -r requirements.txt --download-cache=/tmp/$JOB_NAME

echo "END build scripts"

Ref:

comments powered by Disqus