This is an old revision of the document!


DevOps 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 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.

  1. Login to the web-based management of Proxmox VE.
  2. Select Templates-“ubuntu-14.04_standard*”, and click Download.
  3. Create CT.
  4. Set Hostname and Password.
  5. Use the template image: ubuntu 14.04 standard.
  6. Set disk size from local storage: 8 GB.
  7. Set network configuration, IPv4 Static with netmask /21, and set the gateway.
  8. Set DNS domain
  9. Finish the wizard.

Gitlab

  1. Using Console on web-based management of Proxmox VE, type these commands and follow the needed steps.
    # adduser stwn
    # visudo
  2. Close the Console and use terminal emulator in your computer.
  3. Remote login to the Gitlab server with SSH.
    $ ssh stwn@gitlab-server
  4. Update the packages index.
    $ sudo apt-get update
  5. Install curl and screen.
    $ sudo apt-get install curl screen
  6. Run this command. Adapt the version to the recent version of Gitlab.
    $ curl -LJO https://packages.gitlab.com/gitlab/gitlab-ce/packages/ubuntu/trusty/gitlab-ce_8.6.6-ce.0_amd64.deb/download
  7. Install the downloaded Gitlab package.
    $ sudo dpkg -i gitlab-ce_8.6.6-ce.0_amd64.deb
  8. Reconfigure Gitlab for the first time.
    sudo gitlab-ctl reconfigure
  9. Configure Gitlab.
    $ sudo nano /etc/gitlab/gitlab.rb

    Uncomment these lines.

    web_server['external_users'] = []
    web_server['username'] = 'gitlab-www'
    web_server['group'] = 'gitlab-www'
  10. Restart Gitlab.
    $ sudo gitlab-ctl restart

    Use this command to see the log of Gitlab.

    $ sudo gitlab-ctl tail

Gitlab-CI

Dokku

  1. Download ISO image of Ubuntu 14.04.4 and install it on virtual machine over KVM hypervisor.
  2. Configure network.
    /etc/network/interfaces
    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
  3. Edit sources.list file.
    $ sudo nano /etc/apt/sources.list
  4. Update packages list and upgrade all packages.
    $ sudo apt-get update
    $ sudo apt-get upgrade
  5. Upgrade distribution.
    $ sudo apt-get dist-upgrade
  6. Download bootstrap.sh from Dokku.
    $ wget https://raw.githubusercontent.com/dokku/dokku/v0.5.5/bootstrap.sh
  7. Run the script.
    $ sudo DOKKU_TAG=v0.5.5 bash bootstrap.sh

    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

  8. 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.
    $ ssh-keygen -t rsa
    $ cat .ssh/id_rsa.pub
  9. 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.
 
doc/devops.1468631479.txt.gz · Last modified: 2016/07/16 01:11 by stwn · [Old revisions]
Recent changes RSS feed Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki