In this series of articles, we will look at the process of hosting the infrastructure for developing in the InfoboxCloud cloud. For convenient deployment of the application stack, we will use Docker.
In the first article we will deploy
Gitlab , which includes:
- web interface for git source management system, most similar to GitHub
- convenient viewing of user activities
- file browser
- Wiki
- Code Review features
- bug tracker
- ability to create code snippets
- ability to insert web hooks
- build server
and much more.
')

You can create an unlimited number of free repositories, set up access and security policies. If you
deploy a VPN before Gitlab, you can not provide a public ip to the server with Gitlab and work with it by connecting to the internal cloud network via VPN from your corporate network.
Environment preparation
1. Create a server with CentOS 7 to install Docker in
InfoboxCloud . A virtual machine is now needed for Docker to work, so when creating a server, be sure to check the
“Allow OS kernel management” box.
How to create a server in InfoboxCloud for DockerIf you do not have access to InfoboxCloud -
order it .
After registration, you will receive data to access the control panel by email. Enter the control panel at:
https://panel.infobox.ruIn the “Cloud Infrastructure” section of your subscription, click “New Server” (if necessary, the subscription changes in the upper right corner in the drop-down menu).

Set the required server parameters. Be sure to allocate a public IP address to the server and check the box
“Allow OS kernel management” , as shown in the screenshot below.

In the list of available operating systems, select CentOS 7 and complete server creation.

After that, the data to access the server will come to your email.
After creating a server with CentOS 7, connect to it
via SSH .
We have prepared a script that will allow you to install Docker and useful utilities for working with Docker on such a server. The necessary settings will be made automatically.
Run the command to install Docker and Compose:
bash <(curl -s http://repository.sandbox.infoboxcloud.ru/scripts/docker/centos7/install.sh)
Docker and compose will be installed.
You can create an image with the docker installed in
the control panel by clicking on the server and then “Create an image”. After that, it will be possible to create new servers from the Docker image and not to perform this step again.
Cloud Server System Requirements
For comfortable Gitlab operation, 2 CPU cores and 2Gb Ram from 100 to 500 users are recommended.If you need to save as much as possible when testing - you can give the server with Gitlab 1 CPU core 1 GHz, but the memory should be at least 2 GB.
If you need to work with a large number of users:
CPU- 4 CPU cores - up to 2,000 users
- 8 CPU cores - up to 5,000 users
- 16 CPU cores - up to 10,000 users
- 24 CPU cores - up to 15,000 users
Ram- 4GB RAM - up to 1,000 users
- 8GB RAM - up to 2,000 users
- 16GB RAM - up to 4,000 users
- 32GB RAM - up to 8,000 users
- 64GB RAM - 16,000 users
If you need more users, you can run Gitlab
on multiple servers .
Install Gitlab
We have already prepared the files for quick deployment of the latest version of Gitlab. Gitlab will be deployed to the Docker container. Before this, we will update the official image with Gitlab: we will receive all updates on the OS, including the latest version of Gitlab (the official image is updated with a delay, we will have the latest stable version earlier).
Install git with:
yum install -y git
Go to the user directory.
cd ~
Download the necessary files for gitlab deployment.
git clone https://github.com/trukhinyuri/gitlab-docker.git
Now go to the directory with the files to be deployed.
cd ~/gitlab-docker
The directory contains the following files and directories:
- Dockerfile : describes the actions that will be performed on the official gitlab way;
- docker-compose.yml describes how to deploy the resulting image, which ports to forward, which container folders to install where on the host;
- config folder: gitlab will store configuration files in this folder
- data folder: gitlab will store data files in this folder
- logs folder: gitlab will store logs in this folder
The Dockerfile contains:
FROM gitlab/gitlab-ce:latest MAINTAINER Yuri Trukhin <yuri@trukhin.com> ENV REFRESHED_AT 2015.09.27.004 ENV GITLAB_SHELL_SSH_PORT 8005 RUN apt-get update RUN apt-get -y upgrade EXPOSE 80 EXPOSE 443 EXPOSE 22
Let's look at the purpose of the commands in more detail:
- FROM indicates from which image which version we will build the container. In this case, use the official image of the latest version of Gitlab Community Edition.
- ENV sets environment variables. ENV REFRESHED_AT 2015.09.27.004 - the date the image was assembled. If you need to update the container, change the date, rebuild the image (as below) and expand it. ENV GITLAB_SHELL_SSH_PORT 8005 indicates Gitlab that the SSH host will be located on port 8005 and need to work with this port (and take this into account in the web interface).
- RUN runs commands inside the container. We update the OS.
- EXPOSE shows which ports need to be made available for forwarding to the host.
Docker-compose.yml contains:
gitlab: build: . ports: - "8004:443" - "8003:80" - "8005:22" volumes: - ./config:/etc/gitlab - ./logs:/var/log/gitlab - ./data:/var/opt/gitlab restart: always
The first line specifies the name of the container, which will be the result.
build specifies the path where the Dockerfile is located to build the image. In the
ports section, we specify which host ports to forward to which ports of the container. In the
volumes section we specify which host folders to forward into the container in the appropriate folders. The
restart: always policy means that the container will start automatically when the system is booted and when processes in it are dropped.
All this we have already prepared and you just need to first assemble the image with the command:
docker-compose build
Then expand the container with the command:
docker-compose up -d
If you need to put a balancer in front of Gitlab - an example of creating linked containers with a balancer can be seen
in this article . It is recommended to enable traffic encryption on the NGINX balancer side for secure logging into Gitlab.
If you don’t know how to edit a file, see the details in this article in the “How to Edit a Text File” section. If you are interested in dealing with Docker Compose, see the details here .You can now log in to gitlab at:
http://ip–
Gitlab has been successfully installed.

Default login details:
- login : root
- password : 5iveL! fe
When you first log in, you will be prompted to set a new password to log in.
After changing the password and logging in to Gitlab, you will see the start page.

Initial setup
Send the A – record of the domain with which gitlab will be used to the dedicated ip – address of the host in the cloud. The selected address can be viewed in
the control panel in the "Cloud Infrastructure" section.

The main parameters of gitlab should be specified on the host in the file
~ / gitlab / config / gitlab.rb .
If the lines with the parameters that we will indicate are commented out (# is set before the parameter) - # should be removed. This should be done only for those parameters that we install.
First, make a backup copy of the configuration file. This is recommended for each change of parameters:
cp gitlab.rb gitlab.rb.old
Configuration parameters in gitlab.rb
external_url
In the parameter, specify the domain sent to the server where Gitlab will be available.

time_zone
This parameter specifies the time zone.
gitlab_rails['time_zone'] = 'Europe/Moscow'
Mail Settings in gitlab.rb
This section lists the working parameters in
gitlab.rb for a domain
associated with
Yandex Mail . Settings for Gmail and Mailgun
are listed here .
Paste these parameters into the
gitlab.rb file, replacing
git.alm@plugndo.com with the address of your Yandex for a domain. Replace
your mail password here with your mail password. Instead of plugndo.com, insert the name of your mail domain. The remaining settings remain unchanged.
gitlab_rails['smtp_enable'] = true gitlab_rails['smtp_address'] = "smtp.yandex.ru" gitlab_rails['smtp_port'] = 587 gitlab_rails['smtp_user_name'] = "git.alm@plugndo.com" gitlab_rails['smtp_password'] = " " gitlab_rails['smtp_domain'] = "plugndo.com" gitlab_rails['smtp_authentication'] = "login" gitlab_rails['smtp_enable_starttls_auto'] = true #gitlab_rails['smtp_openssl_verify_mode'] = 'peer' gitlab_rails['gitlab_email_from'] = 'git.alm@plugndo.com' gitlab_rails['gitlab_email_reply_to'] = 'git.alm@plugndo.com'
After saving the changes, reload the container with the gitlab command:
docker restart CONTAINER_ID
, where instead of
CONTAINER_ID specify the unique number of your container with gitlab. It can be viewed using the command:
docker ps
To check the correctness of the mail setup, create a user in Gitlab, if everything is done correctly, the user will receive a link to set the password by email.

Conclusion
After applying the article’s instructions, you received the current version of Gitlab on your own cloud server. You can begin to customize the system for your projects. Thanks to triple replication in the distributed fault-tolerant data storage system in
InfoboxCloud, you can not worry about the safety of your data.
How to get a trial version of InfoboxCloud for free?
Send us your email address and full name to
trukhinyuri@infoboxcloud.com , in response you will receive data to access the control panel. You can test the new cloud region for 14 days, then you can go to the full version of the cloud.
If you find a mistake in the article or you have questions / comments, write to us in the LAN or
email . If you can not leave comments on Habré, write in the
InfoboxCloud Community .
Productive development!