Setting Up Your Tech Stack

Jenkins

1. Setup Debian antlet

Login to antMan and spin up an Debian LXC antlet.

If you are going to run your builds on this Jenkins antlet, which we will be in this tutorial, be sure to allocate the appropriate amount of RAM and vCPUs for your build.

SSH into your antsle then your Debain antlet

ssh <username>@<hostname>.local
ssh root@10.1.1.<antlet-ip>

The default root password is antsle

Make sure you are on the latest version:

apt update
apt upgrade

At the time of this writing the latest stable Debian is 9.8

2. Install Jenkins

First, we need to install java on the antlet ad Jenkins is a Java application.

apt install openjdk-8-jdk

Import the GPG keys of the Jenkins repository

wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | apt-key add -

When your key is imported, we want to add the Jenkins repository to the antlet

sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'

Now lets update the package list and install the latest version of Jenkins

apt update
apt install jenkins

Start the Jenkins service and systemctl enable jenkins

systemctl start jenkins

We also want to have it automatically start on boot

systemctl enable jenkins

3. Make Jenkins Accessible

1. Accessing by Domain Name

If you want to access your Jenkins on a specific url (which is recommended) have a look at our accessing antlets by domain name page.

2. Accessing by Private IP

We could also add a vNIC to the antlet in antMan so that the antlet can acquire a IP from our local network.

In antMan, click on the antlet, Go to “Virtual Network”, and click on “New virtual NIC”. Choose which physical interface you want it to route to, this will be br0 by default.

Now stop the antlet, and start again.

Now ssh back into the antlet. Check the name of the new interface that we have assigned, its most likely eth1.

ifconfig -a

And use your favourite editor to edit the interfaces file.

nano /etc/network/interfaces

You might want to set it to a static IP, but thats particular to your network so we will just set it to dhcp here. Your file should now look like this:

auto lo
iface lo inet loopback

auto eth1
iface eth1 inet dhcp

auto eth0
iface eth0 inet dhcp

Restart the network.

service networking restart

Run the following command and Note the new local network IP that is assigned to to our new nic.

ip -4 -o addr show eth1 | awk '{print $4}' | cut -d "/" -f 1

You can now access Jenkins in your web browser with that IP on port 8080. For example:

http://192.168.0.105:8080

3. Configure Jenkins

It will then prompt you for the password initialAdminPassword which you can with the following command:

cat /var/lib/jenkins/secrets/initialAdminPassword

You can then go through the options of installing selected plugins, set up new accounts, etc.

Once you get to the "Instance Configuration" page you can put it in your domain if you it set up a domain above. If you are accessing it with the private IP, then just set that pre-populated IP.

Congratulations! You now have Jenkins running on your own Private Cloud.

To change the admin password, click on the "admin" dropdown on the top right. Then hit "Configure" on the left, and scroll down to change the password.

Happy Building!

GitLab

1. Setup CentOS antlet

Login to antMan and spin up an CentOS-7 KVM antlet.

SSH into your antsle then your CentOS antlet

ssh <username>@<hostname>.local
ssh root@10.1.1.<antlet-ip>

The default root password is antsle

Make sure update the system:

yum update

At the time of this writing the latest stable CentOS is 7.6

2. Make antlet Accessible

1. Accessing by Domain Name

If you want to access your GitLab on a specific url (which is recommended) have a look at our accessing antlets by domain name page.

2. Accessing by Private IP

We could also add a vNIC to the antlet in antMan so that the antlet can acquire a IP from our local network.

In antMan, click on the antlet, Go to “Virtual Network”, and click on “New virtual NIC”. Choose which physical interface you want it to route to, this will be br0 by default.

Now stop the antlet, and start again.

Now ssh back into the antlet. Check the name of the new interface that we have assigned, its most likely eth1.

ifconfig -a

Now lets setup the vNIC:

cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth1

You will need a new uuid for your new interface, so copy the output of this command for later

uuidgen

Use your favourite editor to edit the interface file.

nano /etc/sysconfig/network-scripts/ifcfg-eth1

You might want to set it to a static IP, but thats particular to your network so we will just set it to dhcp here. Be sure to replace the interface name in both places and to paste the new uuid. Your file should now look like this:

TYPE="Ethernet"
BOOTPROTO="dhcp"
DEFROUTE="yes"
PEERDNS="yes"
PEERROUTES="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_PEERDNS="yes"
IPV6_PEERROUTES="yes"
IPV6_FAILURE_FATAL="no"
NAME="eth1"
UUID="8e27380a-419d-472f-808c-3bdb29893b00"
DEVICE="eth1"
ONBOOT="yes"

Restart the network.

service network restart

Run the following command and Note the new local network IP that is assigned to to your new nic.

ip -4 -o addr show eth1 | awk '{print $4}' | cut -d "/" -f 1

Make note of that IP as you will use it to access GitLab in your web browser.

3. Install GitLab

First lets install all the dependencies required for GitLab CE:

yum install -y curl openssh-server openssh-clients policycoreutils-python

Next lets setup the GitLab CE RPM repository:

curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh |  bash

Now to install GitLab. If you are accessing GitLab via domain name add that as the url parameter like below:

EXTERNAL_URL=“http://gitlab.example.com” yum install -y gitlab-ce

If you are accessing GitLab via the private IP:

EXTERNAL_URL=192.168.0.105 yum install -y gitlab-ce

Now type in the domian name or the private IP into your web browser to see your new source control system!

For a private IP example:

http://192.168.0.105

4. Configure GitLab

When you go to your new GitLab you will need to set your password. Then login with the user root and that password.

If you want to change the IP or domain name that points to GitLab, edit the file:

/etc/gitlab/gitlab.rb

On the 13th line you will see something like:

external_url 'http://192.168.0.108'

Just edit the url to your new IP or domain. Then run:

gitlab-ctl reconfigure

Congratulations! You now have GitLab running on your own Private Cloud.

Happy Pushing!