How to use Hashicorp Vagrant to quickstart GitLab docker compose sample

The code of the project is available at chowkarmeng/vagrant_gitlab (github.com), the docker compose is based on the sample provided in GitLab Docker images | GitLab

The improvement done was to change the folder sync for virtual box into docker volumes.

First, git clone the repository https://github.com/chowkarmeng/vagrant_gitlab.git

Fire up the quickstart by running “vagrant up” in the localdev

The process will take hours depending on the speed of your computer and speed of your internet connection.

Vagrantfile in the line 3-5, and line 7-9, are essential to ensure the needed plugins are installed.
The plugins are needed in order to bootstrap and install the VBox Guest additions

The VBox Guest Additions are needed in order to orchestrate configurations of the VM. Should the VBox Guest Additions failed to be installed, the entire Vagrant up will fail.

Once the bootstrap is done, Vagrant will be executing the config.vm.provision in the VagrantFile. The provision are the scripts that will be run upon boot up of the VM in sequence.

Line 53-55 are the provisioning scripts which is native to the OS which is installed in the VM.
This is the last of standard output to be expected from line 55 of the VagrantFile in this demo

Next, login to the shell of the VM, type “vagrant ssh”.

Proof of VM is running, which is the first layer of the matrix

Then, follow up by using basic command of dockers to check the status of the docker compose containers.

Proof of docker containers are running, which is the second layer of the matrix

Since, we are orchestrating Virtual Box to install docker engine which will be used to install GitLab in docker container.

Run the command “sudo docker exec -it data-web-1 grep ‘Password:’ /etc/gitlab/initial_root_password” in the vm shell.

Extracting the initial root password of GitLab, refer to the GitLab official documentation for its best practices.

If you have read the README.md in the repository, and had the host file of windows configured properly, open browser on your host machine, type gitlab.example.com in the address, and login as root, a successful attempt means GitLab is now running on your VM which is reachable from your machine without installing any web service in your computer.

If you can login and load this page, it means you have successfully orchestrated Vagrant to install GitLab docker compose in your VBox VM.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.