Difference between revisions of "Gitlab2"

From ArchWiki
Jump to: navigation, search
(Installation: It is out of date after Gitlab 5)
(Basic configuration: All of the configuration are straightforward. No need to explain.)
Line 9: Line 9:
  
 
==Gitlab==
 
==Gitlab==
 
===Basic configuration===
 
 
First we need to rename the example file.
 
 
# sudo -u gitlab cp config/gitlab.yml.example config/gitlab.yml
 
 
The options are pretty straightforward. You can skip this part as it is quite detailed. Open {{ic|/home/gitlab/gitlab/config/gitlab.yml}} with your favorite editor and check the settings below.
 
 
====Web application specific settings====
 
 
{{hc|/home/gitlab/gitlab/config/gitlab.yml|<nowiki>
 
host: myhost.example.com
 
port: 80
 
https: false
 
</nowiki>}}
 
 
*{{ic|host}}: Enter your [[Wikipedia:Fully_qualified_domain_name|Fully Qualified Domain Name]].
 
 
====Email used for notification====
 
 
{{hc|/home/gitlab/gitlab/config/gitlab.yml|<nowiki>
 
from: notify@example.com
 
</nowiki>}}
 
 
This is how the mail address will be shown for mail notifications. Gitlab needs the sendmail command in order to send emails (for things like lost password recovery, new user addition etc). This command is provided by packages such as [[msmtp]], [[postfix]], [[sendmail]] etc, but you can only have one of them installed. First, check whether you already have the sendmail command:
 
 
# ls /usr/sbin/sendmail
 
 
If you get a ‘cannot access /usr/bin/sendmail’ then install one of the above packages.
 
 
====Application specific settings====
 
 
{{hc|/home/gitlab/gitlab/config/gitlab.yml|<nowiki>
 
default_projects_limit: 10
 
# backup_path: "/vol/backups"  # default: Rails.root + backups/
 
# backup_keep_time: 604800      # default: 0 (forever) (in seconds)
 
</nowiki>}}
 
 
*{{ic|default_projects_limit}}: As the name suggests, this integer defines the default number of projects new users have. The number can change from within Gitlab by an administrator.
 
*{{ic|backup_path}}: The path where backups are stored. Default location is {{ic|/home/gitlab/gitlab/backups}}. The {{ic|backups}} folder is created automatically after first backup.
 
*{{ic|backup_keep_time}}: Time to preserve backups. The default option is to never be deleted.
 
 
Also check [[#Backup_and_restore| Backup and restore]].
 
 
====Git Hosting configuration====
 
 
{{hc|/home/gitlab/gitlab/config/gitlab.yml|<nowiki>
 
admin_uri: gitlab-git@localhost:gitolite-admin
 
base_path: /home/gitlab-git/repositories/
 
hooks_path: /home/gitlab-git/share/gitolite/hooks/
 
# host: localhost
 
git_user: gitlab-git
 
upload_pack: true
 
receive_pack: true
 
# port: 22
 
</nowiki>}}
 
 
*{{ic|admin_uri}}: Do not change it. Leave as is.
 
*{{ic|base_path}}: The path where gitolite's repositories reside. If the repositories directory is different than the default one, change it here.
 
*{{ic|hooks_path}}: change default setting to /home/gitlab-git/share/gitolite/hooks/
 
*{{ic|host}}: Should point to your FQDN.
 
*{{ic|git_user}}: Name of the git user we created.
 
*{{ic|upload_pack}}:
 
*{{ic|receive_pack}}:
 
 
*{{ic|port}}: ssh port which git should use. Default one is 22. If you want to change it for safety reasons, do not forget to also add the port number to {{ic|.ssh/config}}.
 
 
{{hc|/home/gitlab/gitlab/.ssh/config|<nowiki>
 
Host localhost
 
Port 5000
 
</nowiki>}}
 
 
====Git settings====
 
 
{{hc|/home/gitlab/gitlab/config/gitlab.yml|<nowiki>
 
path: /usr/bin/git
 
git_max_size: 5242880 # 5.megabytes
 
git_timeout: 10
 
</nowiki>}}
 
 
*{{ic|git_max_size}}: Max size of git objects like commits, in bytes,.This value can be increased if you have very large commits.
 
*{{ic|git_timeout}}: git timeout to read commit, in seconds.
 
  
 
===Install gems===
 
===Install gems===

Revision as of 10:31, 10 June 2013

Template:Article summary start Template:Article summary text Template:Article summary heading Template:Article summary wiki Template:Article summary wiki Template:Article summary end

Merge-arrows-2.pngThis article or section is a candidate for merging with Gitlab.Merge-arrows-2.png

Notes: Most of the text are the same. (Discuss in Talk:Gitlab2#)

Gitlab

Install gems

This could take a while as it installs all required libraries.

# cd /home/gitlab/gitlab
# source /home/gitlab/.bash_profile
# sudo -u gitlab -H bundle install --deployment
Note: Using "--without development test" in bundle command line will ignore required packages for database backup and restore


Fix for pygments.rb to work with our python2 (thanks to billyburly).

# sed -i "s/opts = {})/opts = {:python_exe => 'python'})/g" /home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/bundler/gems/pygments.rb-2cada028da50/lib/pygments/ffi.rb
# ln -s /usr/bin/python2 /usr/bin/python

Start redis server

Start the daemon. If you are using initscripts you might want to add redis to your DAEMONS array in rc.conf.

Note: redis might already be running, causing a FAIL message to appear. Check if it is already running with rc.d list redis.

If you have switched to systemd, there is a service file included in the official package. See daemon how to enable it.

Populate the database

# sudo -u gitlab bundle exec rake gitlab:app:setup RAILS_ENV=production

Setup gitlab hooks

# cp ./lib/hooks/post-receive /home/gitlab-git/share/gitolite/hooks/common/post-receive
# chown gitlab-git:gitlab-git /home/gitlab-git/share/gitolite/hooks/common/post-receive

Server testing and resque process

Resque is a Redis-backed library for creating background jobs, placing those jobs on multiple queues, and processing them later. For the backstory, philosophy, and history of Resque's beginnings, please see this blog post.

Run resque process for processing queue:

# sudo -u gitlab bundle exec rake environment resque:work QUEUE=* RAILS_ENV=production BACKGROUND=yes

or use Gitlab's start script:

# sudo -u gitlab ./resque.sh
Note: If you run this as root, /home/gitlab/gitlab/tmp/pids/resque_worker.pid will be owned by root causing the resque worker not to start via init script on next boot/service restart

Gitlab application can be started with the next command:

# sudo -u gitlab bundle exec rails s -e production

Open localhost:3000 with your favorite browser and you should see Gitlab's sign in page. In case you missed it, the default login/password are:

login.........admin@local.host
password......5iveL!fe

Since this is a thin web server, it is only for test purposes. You may close it with Template:Keypress. Follow instructions below to make Gitlab run with a real web server.