Private GitLab Server Automatic Installation with Jelastic PaaS


Git repositories became an integral part of the development process, and usually they are administered with GitHub or BitBucket. But while having a private project you may not want to trust the code to the tool hosted by a third party. So in order to get the required control, flexibility and simplicity within an own dedicated server, developers turn to GitLab installation.


Professing an open source business model, a dedicated GitLab server can be easily deployed to a cloud environment. And the deployment with the help of Docker containers allows to immensely increase elasticity and scaling for extra efficiency. In this article, we will demonstrate how to combine cutting-edge technologies such as GitLab and Docker using Jelastic PaaS automation functionality.

GitLab Package Overview

We found a popular repository sameersbn/docker-gitlab with a detailed multipage manual how to get a running private GitLab Server in containers. This project is licensed under MIT and distinguished by a high rate and numerous forks that proves its sustainability.


To make it even better, Jelastic PaaS added value to the mentioned repository by including:

  • Elastic resource provisioning with automatic vertical scaling;
  • Built-in SSL and Let’s Encrypt SSL for custom domains;
  • Auto discovery of Runners while scaling them horizontally;
  • Injection of required dynamic environment variables:
    • Environment and Domain Name;
    • Security Tokens;
    • Required Passwords;
    • Volume Configs.
  • Cost efficient cloud hosting with Pay As You Use pricing model based on the real usage only.

The listed options are packaged with a GitLab server as a DevOps Lab manifest for automatic installation on top of Jelastic PaaS. By default, the whole topology consists of two Docker Engine nodes:


The automation package performs the following actions:

  • Creates 2 system containers with pre-installed Docker Engine CE and docker-compose utility;
  • Generates and installs self-signed or Let’s Encrypt SSL certificates, as well as shares them with Runners via NFS volume;
  • Injects dynamic environment variables such as tokens, passwords and environment domain;
  • Deploys GitLab Server and Container Registry via docker-compose.yml in one Docker Engine node;
  • Creates one Runner in a separate Docker Engine and registers it automatically in GitLab Server;
  • Automates discovery of newly added Runners upon horizontal scaling.

GitLab Server Installation

Let’s walk through the installation process. Enter Jelastic PaaS dashboard, find GitLab in the Marketplace and press Install.


Alternatively, you can import the DevOps Lab manifest by pressing the Import button.


In the opened popup dialog, specify the Name of the Environment and choose the preferred Region. Click on the Install button.

Wait a few minutes till the installation is completed. Using credentials from the successful installation message or received email notification, log in to the admin panel by pressing Open in Browser.


Scaling Runners Horizontally

When a team is growing and a private GitLab Server becomes busy with builds of many different projects, it’s time to consider to increase the number of Runners to build and to deploy. The package automation helps to get benefits of horizontal scaling without the need to perform any extra manual configuration. Each Runner is going to be placed in a separate container and automatically registered to the GitLab server.

First of all, let’s make sure that the initial GitLab Runner instance is properly registered at the GitLab server. Open Admin Area > Runners.


And to get more Runners, go to the Jelastic PaaS dashboard and press the Change Environment Topology button.


Then click on the Docker-ce icon and press the + button in Horizontal Scaling section to add more Runner nodes. Finally, Apply changes.


Now, we have 4 Runner instances.


Using the GitLab Admin Area, make sure the new Runner instances are registered at the GitLab server.


Import Projects from GitHub

Let’s briefly review how to import projects from GitHub to your private GitLab Server hosted in Jelastic PaaS.

Once you logged in to the GitLab Server admin panel with the account which was automatically created for you, сlick on Create a project.


Then press Import project and after that click on GitHub.

To import repositories, you have to get a Personal Access Token.


Choose the required scopes (at least, the repo section to be able to manage repositories). Finally, press Generate token.



Copy the token, get back to Import Repositories from GitHub at the GitLab Server admin panel, and paste it in a proper field and submit by clicking the List your GitHub repositories button.


Now you have access to your repositories at GitHub. To begin importing, you should click on the corresponding Import button next to the required repository.


When importing is finished, the project is delivered to the private GitLab platform.


Docker Registry Access

As mentioned, the automation package provides a Private Docker Registry. To connect to it, use the details that can be found at Create a project > Registry. So, click on Create a project.


Fill out the project name (e.g., myproject) and create it. Then click on the Registry icon in the left pane.


After that, you will be redirected to your private Docker Container Registry page. Copy the connection string to ensure the Registry is accessible.


Issue a command to login into the Registry from the command line interface as follows:

sudo docker login

Tip: To avoid to use sudo with the docker command, add the user (in our case, the user is jel as on the picture below) to the unix docker group with the following command:
sudo usermod -aG docker jel
More information at


Custom Domain and Let’s Encrypt SSL

The installation window has an option to install the Let’s Encrypt add-on that will provide an ability to generate an SSL certificate for a custom domain which is bound to your environment.


In this case, the environment will be created with a public IP and a Let’s Encrypt staging certificate by default. To install a fully trusted production certificate, you have to bind a custom domain to the GitLab Server via A or CNAME records beforehand. To bind this custom domain, click on the Add-ons icon.


Find Let’s Encrypt Free SSL add-on and click on Configure.


After that, specify the custom domain name (e.g., in the External Domain(s) field and press Apply.


GitLab Server Update

The automation package has a built-in GitLab Server software update procedure that can be initiated via Update GitLab Server add-on, which is installed by default. The software update procedure checks whether a new version of GitLab server is available at the Jelastic PaaS repository and updates it if any.

To use the software update procedure, go to the Add-ons as described in the previous step, find the Update GitLab Server add-on and just click on the Update button.


That’s it! Gain the required level of control, flexibility and simplicity while managing your code in a private dedicated GitLab Server. Try it yourself with a free trial at our Jelastic PaaS platform.

SOURCEJelastic, Inc.