We hope you find this tutorial helpful. In addition to guides like this one, we provide simple cloud infrastructure for developers. Learn more →

How To Use the GitLab One-Click Install Image to Manage Git Repositories

PostedNovember 12, 2013 166k views Git One-Click Install Apps Ruby on Rails DigitalOcean Ubuntu


Collaborating on projects, keeping track of source changes, and maintaining a clean code repository are some great reasons to use a version control system. Version control is now considered an essential tool in software development.

Git is the most popular distributed version control system. GitLab is a git repository management server that can be used to host repositories and set up control structures for git within a clean web interface. It is built on Ruby on Rails.

DigitalOcean has created a GitLab application image that can be used to instantly deploy GitLab on a DigitalOcean Droplet using their Omnibus installer. You can have your own repository system up and running in minutes.

Step One – Create a GitLab Droplet

To create a GitLab Droplet, log into the DigitalOcean Control Panel, open the Create menu and select Droplets:

Create Droplet

This takes you to the Create Droplets page, where you can customize your settings before creating your GitLab Droplet. How to Create your First Droplet describes each choice in detail. Below, we'll highlight key settings:

Choose an image:

You'll need to switch from the Distributions tab to the One-click apps:

Choose image tab

Once there, switch to One-click apps tab, then locate GitLab:

One-click tab

Click GitLab to select it as the image.

Once the image is highlighted, you can accept the defaults or adjust settings according to your use case. We recommend the following changes:

Choose a size

Choose whatever size you need here. Note that the GitLab One-Click Droplets require a minimum of 2 CPU cores and 4GB of RAM, so first available plan begins at 4 GB.

Choose a datacenter region

Generally, choose the data center closest to your user base.

Select additional options

We recommend that you select Monitoring, a free service that will help you follow Droplet resource usage over time. You may also want to consider enabling automated backups. You can enable this now or anytime in the future.

Choose a hostname

You can make it easier to identify the Droplet by naming "GitLab" or by naming it after the site you plan to host.

When you've made your choices, click Create.

Your GitLab Droplet will be created!

Step Two – Configure Domain Names and Emails

We still need to configure just a few things first to utilize our environment.

Begin by setting up any domain names you would like to use for your GitLab instance. To learn how to set up domain names on DigitalOcean, click here.

Once your domain name is configured correctly, you need to adjust some values on the actual VPS instance. Log into your Droplet as root through SSH, and open the GitLab configuration file with your text editor:

nano /etc/gitlab/gitlab.rb

Uncomment and adjust the external_url parameter to match your domain name. Your URL should end with a slash:

external_url "http://your_domain.com/"

If you have generated an SSL certificate for your domain, you can configure GitLab to use them in this file as well:

nginx['ssl_certificate'] = "/etc/gitlab/ssl/gitlab.example.crt"
nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/gitlab.example.com.key"
nginx['redirect_http_to_https'] = true

While we're in this file, we can adjust the email settings that GitLab will use in the "From:" field in automated emails, and the email published for support contact, respectively:

gitlab_rails['gitlab_email_from'] = "gitlab@domain.com"
gitlab_rails['gitlab_support_email'] = "your_email@domain.com"

The GitLab One-Click application is configured to use a local postfix server for sending emails. For a production site, you will likely want to use an external service such as Mandrill or SendGrid. If so, you can configure SMTP settings here as well.

After saving and closing the file, we just need to reconfigure the service:

gitlab-ctl reconfigure

This should be done when ever you make configuration changes in order for them to take effect.

Step Three –– Log into your GitLab

When you connect to your GitLab instance via SSH or the DigitalOcean web console, you will see the message of the day (MOTD) which contains your randomly generated GitLab password. It will look like this:

Thank you for using DigitalOcean's GitLab Application.
Your GitLab instance can be accessed at http://xxx.xxx.xxx.xxx/
The default credentials for GitLab are: 
Username: root
Password: e0wXRM4fLmb6

You can find more information on using this image at: http://do.co/gitlabapp

Next, open a web browser and navigate to your domain name (or the IP address of your Droplet if you did not set up a domain name). You will now be able to log in using the credentials you found above.

DigitalOcean GitLab log in

You now have a full GitLab server configured and at your disposal to manage your repositories:

DigitalOcean GitLab landing page

Step Four –– Modify Account Information

It would probably be more helpful if the account you're using more accurately reflected your information. This will allow you to receive email updates and will display your information to other users.

First, click on the "Admin area" icon in the top-right corner:

DigitalOcean GitLab admin button

On the next page, look for a list of "Latest users" in the bottom middle column. This should only contain one user, the Administrator account you are logged into. Click it:

DigitalOcean GitLab admin user

Click on the "Edit" button in the upper-right corner:

DigitalOcean GitLab edit userpage

Change the account information at the top.

The "Name" field will be your name as displayed to other users. The "username" can be used to log in and as an owner of repositories. The "email" is where alerts will be sent.

It is important to at least change the email field:

DigitalOcean GitLab modify info

Click "Save changes" at the bottom. You should receive a confirmation email in your inbox. This will also allow you to receive password reset emails if you ever require it.

Updating to Newer Releases

The GitLab One-Click application is configured to use the GitLab Apt repository. So upgrading to the most recent version is as simple as running:

sudo apt-get update
sudo apt-get upgrade

Before upgrading to a new release, you may wish to make a back up of your existing installation. To do so, run:

sudo gitlab-rake gitlab:backup:create

The resulting backup will be located in: /var/opt/gitlab/backups


You should now have a server configured to handle your team's git projects. You can easily manage user access, configure both public and private repositories, and get an overview of your projects' issues and commits.

GitLab has a great help system accessible from within the user interface. In a future article, we will discuss how to manage repositories and users and effectively take advantage of the interface.

For further information on configuring you GitLab Omnibus installation, check out their official documentation.


Creative Commons License