This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
doc:devops [2016/07/13 20:39] stwn [DevOps with Gitlab, Gitlab-CI, and Dokku] +to |
doc:devops [2016/10/04 00:58] (current) stwn [Gitlab] +reconfigure |
||
|---|---|---|---|
| Line 3: | Line 3: | ||
| This is merely a collected records of my experience to setup DevOps infrastructure with Gitlab, Gitlab-CI, and Dokku. | 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 server through web-based management of Proxmox VE. We allocate one CPU and 2048 MB of RAM for each virtual server. | + | 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 it is provided as wizard. Our steps are described below. | + | 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. | - Login to the web-based management of Proxmox VE. | ||
| - Select Templates-"ubuntu-14.04_standard*", and click Download. | - Select Templates-"ubuntu-14.04_standard*", and click Download. | ||
| - | - Create CT. | + | - Create a container (CT). |
| - Set Hostname and Password. | - Set Hostname and Password. | ||
| - Use the template image: ubuntu 14.04 standard. | - Use the template image: ubuntu 14.04 standard. | ||
| - Set disk size from local storage: 8 GB. | - Set disk size from local storage: 8 GB. | ||
| - Set network configuration, IPv4 Static with netmask /21, and set the gateway. | - Set network configuration, IPv4 Static with netmask /21, and set the gateway. | ||
| - | - Set DNS domain | + | - Set servers for DNS domain. |
| - Finish the wizard. | - Finish the wizard. | ||
| - | |||
| ===== Gitlab ===== | ===== Gitlab ===== | ||
| - | - Using Console on web-based management of Proxmox VE, type these commands and follow the needed steps.<code># adduser stwn | + | - Use Console on web-based management of Proxmox VE, type these commands and follow the needed steps.<code># adduser stwn |
| # visudo</code> | # visudo</code> | ||
| - Close the Console and use terminal emulator in your computer. | - Close the Console and use terminal emulator in your computer. | ||
| - Remote login to the Gitlab server with SSH. <code>$ ssh stwn@gitlab-server</code> | - Remote login to the Gitlab server with SSH. <code>$ ssh stwn@gitlab-server</code> | ||
| - Update the packages index. <code>$ sudo apt-get update</code> | - Update the packages index. <code>$ sudo apt-get update</code> | ||
| - | - Install curl and screen. <code>$ sudo apt-get install curl screen</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> | - 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> | - 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> | - Reconfigure Gitlab for the first time. <code>sudo gitlab-ctl reconfigure</code> | ||
| - | - Configure Gitlab. <code>$ sudo nano /etc/gitlab/gitlab.rb</code>Uncomment these lines.<code>web_server['external_users'] = [] | + | - 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['username'] = 'gitlab-www' | ||
| web_server['group'] = 'gitlab-www'</code> | web_server['group'] = 'gitlab-www'</code> | ||
| - | - Restart Gitlab. <code>$ sudo gitlab-ctl restart</code>Use this command to see the log of Gitlab. <code>$ sudo gitlab-ctl tail</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 install it on virtual machine over KVM hypervisor. | + | - 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. |
| - | - Configure network. <code>/etc/network/interfaces | + | - 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 |
| - | iface eth0 inet static | + | |
| address 10.16.7.128 | address 10.16.7.128 | ||
| netmask 255.255.248.0 | netmask 255.255.248.0 | ||
| gateway 10.16.7.1 | gateway 10.16.7.1 | ||
| dns-nameservers 10.16.7.1</code> | dns-nameservers 10.16.7.1</code> | ||
| - | - Edit sources.list file. <code>$ sudo nano /etc/apt/sources.list</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 | - Update packages list and upgrade all packages. <code>$ sudo apt-get update | ||
| $ sudo apt-get upgrade</code> | $ sudo apt-get upgrade</code> | ||
| - | - Upgrade distribution. <code>$ sudo apt-get dist-upgrade</code> | + | - After that, upgrade the distribution. <code>$ sudo apt-get dist-upgrade</code> |
| - | - Download bootstrap.sh from Dokku. <code>$ wget https://raw.githubusercontent.com/dokku/dokku/v0.5.5/bootstrap.sh</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 | - 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. Get public key from Gitlab server with our user in it, e.g. stwn.These commands should be run on Gitlab server.<code>$ ssh-keygen -t rsa | + | - 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> | $ cat .ssh/id_rsa.pub</code> | ||
| - | - Visit local web configuration of Dokku in http://dokku.server/ and copy the content of the output of the last command to Public Key section. | + | - 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 ===== | ||
| + | |||