This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
|
doc:devops [2016/06/15 22:06] stwn created |
doc:devops [2016/10/04 00:58] (current) stwn [Gitlab] +reconfigure |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== DevOps with Gitlab, Gitlab-CI, and Dokku ====== | ====== DevOps with Gitlab, Gitlab-CI, and Dokku ====== | ||
| - | ===== Gitlab ===== | + | This is merely a collected records of my experience to setup DevOps infrastructure with Gitlab, Gitlab-CI, and Dokku. |
| + | Our setup uses virtual environment which is run on Proxmox VE with LXC as OS-level virtualization for Gitlab/Gitlab-CI server, and KVM as hypervisor for Dokku server (virtual machine). The first thing to do is to setup the virtual servers through web-based management of Proxmox VE. We allocate one CPU and 2048 MB of RAM for each virtual server. | ||
| + | |||
| + | There are steps for doing setup of virtual server and thankfully these are provided as a wizard in Proxmox VE. For LXC, our steps are described below. | ||
| + | - Login to the web-based management of Proxmox VE. | ||
| + | - Select Templates-"ubuntu-14.04_standard*", and click Download. | ||
| + | - Create a container (CT). | ||
| + | - Set Hostname and Password. | ||
| + | - Use the template image: ubuntu 14.04 standard. | ||
| + | - Set disk size from local storage: 8 GB. | ||
| + | - Set network configuration, IPv4 Static with netmask /21, and set the gateway. | ||
| + | - Set servers for DNS domain. | ||
| + | - Finish the wizard. | ||
| + | ===== Gitlab ===== | ||
| + | - Use Console on web-based management of Proxmox VE, type these commands and follow the needed steps.<code># adduser stwn | ||
| + | # visudo</code> | ||
| + | - Close the Console and use terminal emulator in your computer. | ||
| + | - Remote login to the Gitlab server with SSH. <code>$ ssh stwn@gitlab-server</code> | ||
| + | - Update the packages index. <code>$ sudo apt-get update</code> | ||
| + | - Install curl and screen packages. <code>$ sudo apt-get install curl screen</code> | ||
| + | - Run this command. Adapt the version to the recent version of Gitlab. <code>$ curl -LJO https://packages.gitlab.com/gitlab/gitlab-ce/packages/ubuntu/trusty/gitlab-ce_8.6.6-ce.0_amd64.deb/download</code> | ||
| + | - Install the downloaded Gitlab package. <code>$ sudo dpkg -i gitlab-ce_8.6.6-ce.0_amd64.deb</code> | ||
| + | - Reconfigure Gitlab for the first time. <code>sudo gitlab-ctl reconfigure</code> | ||
| + | - Configure nginx-related options. <code>$ sudo nano /etc/gitlab/gitlab.rb</code>Uncomment these lines.<code>web_server['external_users'] = [] | ||
| + | web_server['username'] = 'gitlab-www' | ||
| + | web_server['group'] = 'gitlab-www'</code> | ||
| + | - Reconfigure and restart Gitlab. <code>$ sudo gitlab-ctl reconfigure | ||
| + | $ sudo gitlab-ctl restart</code>Use this command to see the log of Gitlab. <code>$ sudo gitlab-ctl tail</code> | ||
| ===== Gitlab-CI ===== | ===== Gitlab-CI ===== | ||
| ===== Dokku ===== | ===== Dokku ===== | ||
| + | - Download ISO image of Ubuntu 14.04.4, and put it in a place which is accesible by Proxmox VE. Boot the virtual machine through the web-based management and follow the steps of the Ubuntu installer. | ||
| + | - Login to the Console of the web-based management or via SSH from your local computer/laptop. Configure the interface of the Dokku server. <code>$ sudo nano /etc/network/interfaces</code>Put these lines in that file.<code>iface eth0 inet static | ||
| + | address 10.16.7.128 | ||
| + | netmask 255.255.248.0 | ||
| + | gateway 10.16.7.1 | ||
| + | dns-nameservers 10.16.7.1</code> | ||
| + | - Edit the sources.list file to configure the packages repository server. <code>$ sudo nano /etc/apt/sources.list</code> | ||
| + | - Update packages list and upgrade all packages. <code>$ sudo apt-get update | ||
| + | $ sudo apt-get upgrade</code> | ||
| + | - After that, upgrade the distribution. <code>$ sudo apt-get dist-upgrade</code> | ||
| + | - Download bootstrap.sh script from Dokku repository. <code>$ wget https://raw.githubusercontent.com/dokku/dokku/v0.5.5/bootstrap.sh</code> | ||
| + | - Run the script. <code>$ sudo DOKKU_TAG=v0.5.5 bash bootstrap.sh</code>We need to relax waiting for this command to complete. It depends on the Internet connection. Please watch the network status of the server, if it has on going/active traffic then the script must be working and we should be sit back while it really accomplishes its mission :D | ||
| + | - Setup SSH key pairs. Get the public key from Gitlab server with our user in it, e.g. stwn. These commands should be run on the Gitlab server.<code>$ ssh-keygen -t rsa | ||
| + | $ cat .ssh/id_rsa.pub</code> | ||
| + | - Visit the local web configuration of Dokku in http://dokku.server/ and copy the content of the output of the previous last command to the Public Key section. | ||
| + | |||
| + | ===== Workflow ===== | ||
| + | |||