CI Server Build

Submitted by code_admin on Wed, 07/25/2018 - 10:33

My build process to build a Simple CI Server

My aim is to get a CI server which
- checks out code from git
- runs maven
- uses sqlplus to install files to external DB

Step - Basic Setup

Created a VM for Ubuntu 64bit. Gave it 8gb Ram
Created a dynamically allocated HD. 100Gb
Installed Ubuntu Server 16.04

Hostname: simpleciserver
User: robert
Encrypt Home: No

Software selection:
standard system utilities
OpenSSH server

Configured Virtual Machine NAT routing SSH Rule to route port 2222 to port 22
Added authorized_key file for user robert

Step - Install SQL*Plus and connect to DB server on host machine

(This section is documented

download linux 64bit client:
(basic, JDBC Supplement, and SQL-Plus)

Use FileZilla to upload to ~/tmp

sudo apt-get install alien
sudo alien -i oracle-instantclient12.1-basic-
sudo alien -i oracle-instantclient12.1-jdbc-
sudo alien -i oracle-instantclient12.1-sqlplus-

export LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client64/lib/${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
sudo apt-get install libaio1

sudo sudo vi /etc/profile.d/ && sudo chmod o+r /etc/profile.d/

Add the line:

  1. export ORACLE_HOME=/usr/lib/oracle/12.1/client64
  2. export LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client64/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}

sudo vi /etc/ && sudo chmod o+r /etc/

Add the line:

  1. /usr/lib/oracle/12.1/client64/lib/

sudo cp /usr/bin/sqlplus64 /usr/bin/sqlplus

sqlplus username/password@//dbhost:1521/SID

Setup JDK

  1. sudo apt-get install openjdk-8-jdk

Setup default java home

  1. sudo vi /etc/environment


Setup Maven


sudo apt install maven

mvn -version

Create default settings file

The default settings file gives the repo username for deploying:

This file is "settings.xml"
on linux it is stored in ~/.m2/
on Windows it is storedin C:\Users\USER.m2

  1.       xsi:schemaLocation="
  2.                 ">
  3.       <localRepository/>
  4.       <interactiveMode/>
  5.       <usePluginRegistry/>
  6.       <offline/>
  7.       <pluginGroups/>
  8.       <servers>
  9.           <server>
  10.               <id>ssh-snapshot-repository</id>
  11.                <username>maven_repo</username>
  12.           </server>
  13.           <server>
  14.               <id>ssh-repository</id>
  15.                <username>maven_repo</username>
  16.           </server>
  17.       </servers>
  18.       <mirrors/>
  19.       <proxies/>
  20.       <profiles/>
  21.       <activeProfiles/>
  22. </settings>

Generate openssl keys

  1. ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_rsa

Add public keys where required

  • Add public key to git repo

Setup directory for deployable artifacts

mkdir -p ~/deployable_artifacts

** NO LONGER NEEDED ** Getting Flyway working

and download ojdbc6.jar
goto… and download pom.xml
upload both files to ~/tmp directory

mvn install:install-file -Dfile=~/tmp/ojdbc6.jar -DpomFile=pom.xml

TODO Install ciutils

Set Home
sudo vi /etc/environment

Install Imperial Environment

Add environment var to point to location:

  1. sudo vi /etc/environment

add the line

  1. CIICENV_HOME=/home/robert/ic_ci_env

Create the directory structure:

  1. mkdir ${CIICENV_HOME}
  2. mkdir ${CIICENV_HOME}/dev

Place needed files into ~/ic_ci_env/dev directory ( etc.)
If required repeat for test, dev2, etc.

TODO Change this to using a git repo for DEV as the source
Note: This is for DEV only. Production will have a different structure

Test installing sample schema

cd ~/deployable_artifacts
git clone
cd ~/deployable_artifacts/ICSchema_SAMPLE_SCHEMA
mvn install
mvn deploy -Dcmd.env=dev

Other steps

Before deploying you must ssh to the repo server and accept the host key

RJM Article Type
Work Notes