Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Gitlab Cookbook
  • Table Of Contents Toc
  • Feedback & Rating feedback
Gitlab Cookbook

Gitlab Cookbook

By : van Baarsen
3.3 (3)
close
close
Gitlab Cookbook

Gitlab Cookbook

3.3 (3)
By: van Baarsen

Overview of this book

This book is aimed at developers and devops that have a GitLab server running, and want to be sure they use it to its full potential. This book will also be useful for people looking for a great Git platform, and learn how to set it up successfully. Some system administrating experience on a UNIX-based system would be useful, but is not required.
Table of Contents (11 chapters)
close
close
10
Index

Using Chef and GitLab Cookbook

You can install GitLab using chef-solo. It allows you to install a server and all of its dependencies through a pre-programmed script. GitLab Cookbook is also used as the base for the Omnibus Package.

If you want more information on Chef, please take a look at www.getchef.com.

For this recipe, we are going to use a Ubuntu-based installation.

Getting ready

Before we start installing, you need to have a server installed with Ubuntu and have SSH access to the server. Your server needs to have at least 2 GB of RAM to compile all the requirements.

How to do it…

  1. We start with downloading some server dependencies:
    sudo apt-get update && sudo apt-get install -y build-essential git curl
    
  2. Download the chef-solo file:
    curl -o /tmp/solo.json https://gitlab.com/gitlab-org/cookbook-gitlab/raw/master/solo.json.production_example
    
  3. We have to edit the file we just downloaded so that it fits our needs:
    vi /tmp/solo.json
    
  4. As we will be using PostgreSQL, you can remove the MySQL part. Also, make sure you change the revision to the latest stable branch, 7.3 at time of writing. After you are done, your file should look like the following code, but with your own host and e-mail addresses:
      "gitlab": {
        "host": "gitlab.example.com",
        "url": "http://gitlab.example.com/",
        "email_from": "[email protected]",
        "support_email": "[email protected]",
        "database_adapter": "postgresql",
        "database_password": "super-secure-password",
        "revision": "6-9-stable"
      },
      "postgresql": {
        "password": {
          "postgres": "psqlpass"
        }
      },
      "postfix": {
        "mail_type": "client",
        "myhostname": "gitlab.example.com",
        "mydomain": "mydomain.com",
        "myorigin": "gitlab.example.com",
        "smtp_use_tls": "no"
      },
      "run_list": [
        "postfix",
        "gitlab::default"
      ]
    }
  5. Next, we download and install Chef to our server:
    cd /tmp; curl -LO https://www.opscode.com/chef/install.sh; sudo bash ./install.sh -v 11.4.4; sudo /opt/chef/embedded/bin/gem install berkshelf --no-ri --no-rdoc
    
  6. Now, we download the GitLab source from gitlab.com:
    git clone https://gitlab.com/gitlab-org/cookbook-gitlab.git /tmp/cookbook-gitlab
    
  7. Install all the GitLab-specific dependencies:
    cd /tmp/cookbook-gitlab; /opt/chef/embedded/bin/berks vendor /tmp/cookbooks
    
  8. We need to create one more Chef config file:
    vi /tmp/solo.rb
    
  9. Add the following content to the preceding config file:
    cookbook_path    ["/tmp/cookbooks/"]
    log_level        :debug
  10. Save the file.
  11. We are done with configuring everything and now let's install GitLab!
    sudo chef-solo -c /tmp/solo.rb -j /tmp/solo.json
    

How it works…

We just installed GitLab via the Chef cookbook. This way of installation is a little more automated than the installation from source, but it still gives you a bit more control over your installation in comparison to the Omnibus package.

Let's go through the steps that we took to install GitLab in this way.

First, we had to install some server dependencies that were needed to install Chef, and we also cloned the code from GitLab. The dependencies included Curl and Git. We used Curl to download the chef.json file, and in step 4, to download the check installation file. Git was needed to clone the source of GitLab, and to make sure that GitLab, when installed, is able to serve your repositories.

Next, we had to download the config.json file. This JSON file keeps the configuration information for GitLab in order to install itself. You can compare this to the gitlab.yml file from the Installing GitLab from source recipe.

In this recipe, we installed GitLab using PostgreSQL. If you'd prefer to install it with MySQL, that's possible. Just keep in mind that PostgreSQL is the recommended way of running GitLab.

The next step was to download the GitLab source and to install the GitLab dependencies. After we had done that, we created the solo.rb file. This file is used by chef-solo to know where GitLab Cookbook is located.

The last step was to install GitLab itself. This step took a while because the command also downloaded and compiled Ruby for you.

Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Gitlab Cookbook
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon