Running GitLab in the Cloud with Azure


    One of the first things that you should do before starting a software project is set up a version control system (VCS) for your code. A version control system allows you to track changes for your code, concurrently maintain different versions (i.e. production and development) and simplifies the task of merging and integrating contributions from multiple developers. One of the most popular VCS is Git, a distributed version control and source code management system. Though Git itself is mainly a collection of command line tools, many people manage Git repositories using third party tools and services, such as GitHub, Gitorious or GitLab.

    GitLab is a Ruby on Rails web application that helps you manage who has permissions to contribute to which repository. It also includes a wiki, enables code reviews and many other features. GitLab CI is a complementary web application that provides Continuous Integration closely integrated with Git to run tasks after a new change or run tests in different branches in the repository.

    This guide describes how to create your own Git repository and integrate it with a Continuous Integration server in the cloud with Windows Azure and a Bitnami GitLab virtual machine.


    Using a Windows Azure cloud server for hosting your source control repositories has a number of advantages, including:

    • The ability to resize the server as needed. You can start with a small virtual machine and as your needs change, easily scale it up or down
    • Easily create full backups of the server, which can be used to create replicas to test upgrade procedures or to restore the full server in case of catastrophic failure
    • Provide great connectivity, important when you are managing a distributed team or transferring large amounts of code or data
    • Easily monitor server performance and manage security settings


    GitLab & GitLab CI

    GitLab is a self-hosted Git management software application written in Ruby on Rails and distributed under an open source license. GitLab simplifies the task of managing Git projects: you can enable or disable access per user and per project, keep track of project activities, code reviews, merge requests or track issues. GitLab CI allows you to run tasks with the project code. It is useful for automating the tests or the release process.

    Bitnami provides a free, pre-configured GitLab virtual machine that you can deploy in Windows Azure. The image is based on Ubuntu and ships all of the required dependencies for running GitLab and GitLab CI, including a web server, database and Ruby on Rails runtime. This means you can get started with GitLab right away, without having to install or configure it.




    The Bitnami GitLab image for Microsoft Azure

    The Bitnami GitLab image for Microsoft Azure is available in our Launchpad. You can launch it directly from there. Please take a look at the quick video presentation. You will need to have a Microsoft Azure subscription to follow along with the process (free trials are available if you don’t already have a subscription).

    Get Adobe Flash player

    For more details on how to start the Bitnami GitLab image in Microsoft Azure, you can find a step-by-step tutorial on the Bitnami site.


    How to create a Git repository in GitLab

    The default Admin credentials for GitLab are:

    Username: user

    Password: bitnami

    You should change these default values right away. You can change the password and the email in the “User’s Profile” section, where you can also upload your public SSH key. This key will be necessary to push the code into the repository and it will be also required for all new users that need privileges to modify the code.




    Now you can create your first Git project in GitLab and follow the steps to upload the code. At this point, you must have a Git client installed in your desktop or laptop local machine. There are different ways to install Git in a development environment. An easy way to install Git is using Bitnami WAMP, LAMP or MAMP stacks. These stacks provide a complete PHP, MySQL and Apache development environment for Windows, Linux or OS X. They also install Git so you can use them for syncing the files with the repository.




    You can upload your project files to the GitLab repository by following the steps above. It is important to copy your private key in the SSH folder according to your platform:

    For Windows: "C:\Users\user_name\.ssh\id_rsa"

    For Linux: "/home/user_name/.ssh/id_rsa"

    For OS X: "/Users/user_name/.ssh/id_rsa"



    If the configuration is correct, you have just pushed the README.txt file into the repository and you can see it in the GitLab web application.


    GitLab administration

    Bitnami GitLab images can be customized in a variety of ways. As you have access to all the files in the server, the domain name or the email settings are easily customizable.




    Custom domain name

    Once the Gitlab application is up and running, it is possible to use a custom domain. The only requirement is that the domain points to the server’s IP address or the domain. Then, run the following command to configure it automatically, substituting by your domain name:

    $ sudo /opt/bitnami/apps/gitlab/bnconfig --machine_hostname

    Note that this command runs every time that you restart the machine and uses the public IP address of the server by default. If you already configured the domain, rename or remove the “bnconfig” tool in order to prevent it from changing every time the machine is rebooted.

    $ sudo mv /opt/bitnami/apps/gitlab/bnconfig /opt/bitnami/apps/gitlab/bnconfig.back
    Email settings

    The Bitnami GitLab application does not configure email settings by default. This step is required for the application to send notifications via email. It is recommended that you use an email provider for sending the emails from the application. For this purpose, you can use a free email service like Hotmail, Office365, Yahoo or GMail. That should work for small or test deployments of Gitlab, but it you have a larger installation that needs send a lot of email, you risk your emails being throttled.

    The example below describes how to configure GitLab with GMail for sending emails through SMTP. Edit the file production.rb and set the following settings:

    $ nano /opt/bitnami/apps/gitlab/htdocs/config/environments/production.rb
    config.action_mailer.raise_delivery_errors = true
    config.action_mailer.delivery_method = :smtp
    config.action_mailer.perform_deliveries = true
    config.action_mailer.smtp_settings = {
        :address => "",
        :port => 587,
        :domain => "",
        :authentication => :plain,
        :user_name => "",
        :password => "your_password",
        :enable_starttls_auto => true

    Then restart the Apache server:

    $ sudo /opt/bitnami/ restart apache
    Configuring GitLab

    Managing projects from the GitLab application is extremely easy. From the “Admin” panel it is possible to add new users or to create teams and groups with different permissions within a projects.




    GitLab projects can be set up as public too. That means that any user has read access for that project and is able to clone the project with the command below.

    $ git clone


    Server management

    It is possible to manage all the GitLab servers using the “/opt/bitnami/” tool. GitLab requires the following servers:

    • A MySQL database
    • An Apache server configured with a Passenger module for Ruby on Rails apps
    • A Redis server for storing the job messages
    • A GitLab Sidekiq server for processing the jobs in the background


    You can log into the server through SSH and check the status of the servers with the command below:

    $ sudo /opt/bitnami/ status


    For troubleshooting problems with the servers, you can typically find the required information in each server’s log files:

    Apache: /opt/bitnami/apache2/error_log

    MySQL: /opt/bitnami/mysql/data/mysqld.log

    Redis: /opt/bitnami/redis/var/log/redis-server.log

    GitLab Sidekiq: /opt/bitnami/gitlab/htdocs/log/sidekiq.log

    GitLab CI Sidekiq: /opt/bitnami/gitlabci/htdocs/log/sidekiq.log

    Sidekiq ships a control panel where it is possible to check the logs and the status of the jobs.




    How to integrate GitLab & GitLab CI

    This section explains how to fully integrate GitLab and GitLab CI for running tasks automatically. This example will cover how to run the unit tests of a Ruby on Rails project, Redmine.

    It is necessary to create a public and private key for the “gitlab_ci” user in the server, so this user will have read access to the chosen repositories. Once logged in the server through SSH, run the following command and do not specify any password for the key:

    $ sudo su gitlab_ci -c "ssh-keygen -t rsa"

    Then read the new public key and copy the contents in a file. GitLab will give read-only privileges to this user account.

    In GitLab, go to the project “Settings” and add a new “Deploy Key”. Then copy the public key created previously. When you copy the key, make sure the key content does not contain newlines.




    Now the “gitlab_ci” user will be able to clone the repository in the server running the commands below.

    $ sudo su gitlab_ci
    $ mkdir repositories
    $ cd repositories
    $ git config --global 'Administrator'
    $ git config --global ''
    $ git clone"
    Cloning into 'example'...
    remote: Counting objects: 3, done.
    Receiving objects: 100% (3/3), 201 bytes, done. remote: Total 3 (delta 0), reused 0 (delta 0)


    Now it is time to access to the GitLab CI application. In this example GitLab CI is running at “”.

    The default credentials for GitLab CI are:


    password: bitnami

    You will need to change them from in User’s profile section.

    For enabling this new repository in the GitLab CI application, create a new project and configure the following options:

    - Name: Example

    - Token: (blank)

    - Path: /home/gitlab_ci/repositories/example

    - Follow branches: master




    Once created, click on the “Details” tab because the “Project URL” and “Project Token” are required for the next step.




    GitLab requires these settings for finishing the integration. Go to the GitLab project settings and configure GitLab CI in the “Services” tab. Fill "Project URL" and "Project Token" with the values from the previous step and press “Save”. This is the last step for integrating both applications.


    Running a sample test

    A Continuous Integration process typically performs different tasks: running tests, measuring performance, building releases and other tasks. The example below describes how to upload a Ruby on Rails project to a GitLab repository and run the unit tests in GitLab CI. This example will use the Redmine project code, a popular Project Management tool.

    After downloading and extracting the Redmine project files, uncompress them in the previously created GitLab project folder.

    Before pushing all of the Redmine files, it is necessary to create the database.yml config file with the configuration below. This example will use a SQLite database, so it requires you to add the “sqlite3” gem in the Gemfile.




    Now you can push all the files into the repository:

    $ git add .
    $ git commit -m “Redmine files”
    $ git push

    For configuring the tasks in GitLab CI, go to the project and edit the “Scripts” section. The example below will configure and run the Redmine unit tests.

    bundle install --binstubs --path vendor/gems
    bin/rake db:create
    bin/rake db:migrate
    bin/rake test:units




    Finally, run the test from the GitLab CI application. If everything was properly configured, the Redmine unit tests will be executed and you can check the results directly in the GitLab CI panel.






    Bitnami GitLab allows you to easily create and manage your own Git repository in Windows Azure. Some advantages of running your own repository in a Cloud include:

    • Full control of the server
    • Flexibility to customize the application as required
    • Ability to resize your server as needs change
    • Centralized control panel for managing administrative tasks
    Tag page (Edit tags)
    • No tags
    Page statistics
    35052 view(s), 13 edit(s) and 22950 character(s)


    You must login to post a comment.

    Attach file


    FileSizeDateAttached by 
    Azure free trial
    5.25 kB17:24, 3 Oct 2013AdminActions
    GitLab application
    71.35 kB10:05, 3 Oct 2013AdminActions
    GitLab Sidekiq
    126.71 kB10:36, 3 Oct 2013AdminActions
    GitLab CI deploy key
    117.58 kB10:39, 3 Oct 2013AdminActions
    GitLab CI project
    58.18 kB10:41, 3 Oct 2013AdminActions
    GitLab CI project details
    77.49 kB10:42, 3 Oct 2013AdminActions
    GitLab CI sample
    32.64 kB10:43, 3 Oct 2013AdminActions
    GitLab CI sample
    64.79 kB10:44, 3 Oct 2013AdminActions
    GitLab CI sample
    57.71 kB10:46, 3 Oct 2013AdminActions
    GitLab CI sample
    35.26 kB10:46, 3 Oct 2013AdminActions
    GitLab azure image
    111.94 kB10:23, 3 Oct 2013AdminActions
    GitLab azure image
    76.96 kB10:25, 3 Oct 2013AdminActions
    GitLab welcome
    86.16 kB10:26, 3 Oct 2013AdminActions
    GitLab ssh key
    102.33 kB10:28, 3 Oct 2013AdminActions
    GitLab project
    58.25 kB10:29, 3 Oct 2013AdminActions
    Git console for Windows
    16.38 kB10:30, 3 Oct 2013AdminActions
    GitLab console
    49.22 kB10:31, 3 Oct 2013AdminActions
    GitLab dashboard
    64.08 kB10:34, 3 Oct 2013AdminActions