atomic-penguin / cookbook-gitlab-deprecated

Gitlab cookbook
128 stars 84 forks source link

Gitlab Cookbook

Build Status

This cookbook will deploy gitlab; a free project and repository management application.

Gitlab code is hosted here.

Important changes

Going forward, the cookbook major version (i.e. 6.1.x) will target the matching stable branch (i.e. 6-1-stable) of the Gitlab application. The 6.1.x release is not backwards compatible with previous versions targeting Gitlab master.

For the 7.7.x release of the cookbook, the default Ruby will be 2.1.2 compiled with ruby_build. Using a compiled Ruby follows the Gitlab installation guidelines upstream. If you have a better approach which reduced complexity or reduces converge time, please open a pull request on Github.

The application home is located in /srv/git/gitlab in accordance with the Filesystem Hierarchy Standard (FHS) version 2.3.

Requirements

============

Cookbook dependencies

============

Attributes

User privileges

Note, This attributes are useful when you want only admins to create projects and groups. And to restrict username changing.

Database Attributes

Note, most of the database attributes have sane defaults. You will only need to change these configuration options if you're using a non-standard installation. Please see attributes/default.rb for more information on how a dynamic attribute is calculated.

LDAP Authentication Attributes

Recipes

default

This installs and starts GitLab with nginx and your chosen database.

mysql, postgres

These are internal, set gitlab['database']['type'] instead.

Usage

Optionally override application paths using gitlab['git_home'] and gitlab['home'].

Add recipe gitlab::default to run_list. Go grab a lunch, or two, if Ruby has to build.

The default admin credentials for the gitlab application are as follows:

User: admin@local.host
Password: 5iveL!fe

Of course you should change these first thing, once deployed.

Role example for Gitlab with https, and MySQL

name "gitlab_https"
description "Configures and installs gitlab w/ https, and mysql server"
override_attributes "gitlab" => {
  "https" => true,
  "certificate_databag_id" => "wildcard"
}
run_list "recipe[gitlab]"

Upgrade

As of now it's not supported in the cookbook out of the box, however following steps document this process.

Upgrade from chef cookbook higher version

To upgrade Gitlab version make sure you:

You may skip merging all configuration files, init.d scripts etc.

In general this procedure consist of following steps:

sudo service gitlab stop
sudo su - git
cd /srv/git/gitlab
# bundle install
bundle exec rake gitlab:backup:create RAILS_ENV=production
git fetch --all
git checkout -- db/schema.rb # local changes will be restored automatically
git checkout 8-0-stable
cd /srv/git/gitlab-shell
git fetch
git checkout v2.6.5
# for 8x somewhere here should gitlab cookbook generate new configuration files
# MySQL installations
bundle install --without postgres development test --deployment
# PostgreSQL installations
bundle install --without mysql development test --deployment
bundle exec rake db:migrate RAILS_ENV=production
bundle exec rake assets:clean assets:precompile cache:clear RAILS_ENV=production
sudo service gitlab start
sudo service nginx restart

NOTE: Don't forget to make trusted backups first!

License and Author

Author: Gerald L. Hevener Jr., M.S. Copyright: 2012

Author: Eric G. Wolfe Copyright: 2012

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.