Skip to content

Commit 1ff47e6

Browse files
committed
Merge pull request #1 from gitlabhq/master
Sync with origin
2 parents 28d4905 + d3c44c9 commit 1ff47e6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+2333
-919
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "database/migrate-mysql-to-postgres/mysql-postgresql-converter"]
2+
path = database/migrate-mysql-to-postgres/mysql-postgresql-converter
3+
url = https://github.com/lanyrd/mysql-postgresql-converter.git

CONTRIBUTING.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Contribute to GitLab recipes
2+
3+
This guide details how to use issues and pull requests to improve GitLab recipes.
4+
5+
Please stick as close as possible to the guidelines. That way we ensure quality guides
6+
and easy to merge requests.
7+
8+
Your Pull Request will be reviewed by one of our devs/volunteers and you will be
9+
asked to reformat it if needed. We don't bite and we will try to be as flexible
10+
as possible, so don't get intimidated by the extent of the guidelines :)
11+
12+
For better maintainance and clarity, some naming guidelines should be followed.
13+
See details in each section below.
14+
15+
## Pull Request title
16+
17+
Try to be as more descriptive as you can in your Pull Request title.
18+
19+
Particularly if you are submitting a new script or guide, include in the title,
20+
information about GitLab version, OS tested on and any other relevant info.
21+
22+
For example some good titles would be:
23+
24+
* [Installation script] GitLab 6.x - Ubuntu 12.04 - Apache
25+
* [Guide] GitLab 6.1 - FreeBSD - postgres, rvm
26+
27+
## Guides
28+
29+
Each installation guide has its own namespace and it should be provided in a
30+
`README` file so that it renders first when viewing the repository. Submit a new
31+
one in `install/platform/README.md` (it doesn't have to be strictly in markdown though).
32+
33+
## Scripts
34+
35+
Installation scripts reside in `install/platform/scripts/`, so if you have one,
36+
submit it there. They should named after the following scheme: `platform-platform_version`.
37+
38+
Example: `ubuntu-server-12.04.sh`
39+
40+
You are strongly encouraged to also provide a `README` file that describes
41+
how to use the script. You may have included all the needed info in the script
42+
itself (recommended), so you could simply write something between the lines:
43+
44+
> This script installs GitLab 6.0 on Archlinux. Run it with `./archlinux.sh your_domain_name`
45+
>
46+
> For more info and variables you can change, read the comments in the script.
47+
48+
49+
### Scripts doing similar things
50+
51+
There is a strong possibility that your script will do similar things to what a
52+
script already in this repo do. In that case, please work on the existing script
53+
and enhance it with your changes. No need to duplicate things.
54+
55+
## What information to put on your guide/script etc (mandatory)
56+
57+
If you have an installation guide to provide, fill in the template and place it on top
58+
of it or include it in your installation script (commented), again on top. Try to
59+
include as many items of this template as you can.
60+
61+
### Template
62+
63+
```
64+
Distribution :
65+
GitLab version :
66+
Web Server :
67+
Init system :
68+
Database :
69+
Contributors :
70+
Additional Notes :
71+
```
72+
73+
### Explanation
74+
75+
| Label | Explanation |
76+
| ---------------- | ------------------------- |
77+
| Distribution | The official name and version of the platform/distribution, case sensitive. |
78+
| GitLab version | GitLab version on which the guide/script was tested. |
79+
| Web Server | The web server used to serve GitLab. May be two-fold, eg. apache with mod_passenger. |
80+
| Init system | (Optional but recommended) The init system used by the platform if any. Examples: `sysvinit`, `systemd`, `upstart`, `openrc`, etc |
81+
| Database | The database used for installation. Examples: `mysql`, `postrgres`, `mariadb`.
82+
| Contributors | Your github username (recommended in order to track you and give credits) or your real name or both. Example of the latter: **thedude (Jeffrey Lebowski)** |
83+
| Additional Notes | Anything else you want to add. Any deviations form the official guide can be reported here. Eg. using rvm for ruby install, storing in different locations, etc.|
84+
85+
86+
### Example
87+
88+
```
89+
Distribution : Fedora 19
90+
GitLab version : 5.4
91+
Web Server : apache with mod_passenger
92+
Init system : systemd
93+
Database : mariadb
94+
Contributors : thedude
95+
Additional Notes : the script uses rvm to install ruby
96+
```

README.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1-
gitlab-recipes
2-
==============
1+
## GitLab recipes: unofficial guides for using GitLab with different software
32

4-
GitLab recipes for setup on different platforms, update etc...
3+
Here you will find unofficial guides for using GitLab with different software (operating systems, web servers, etc.)
4+
provided by the community, for systems other than the officially supported (Debian/Ubuntu).
55

6-
### Every file should have section with maintainer name & gitlab version:
6+
Bare in mind that this repository is co-maintained by volunteers/contributors like you.
77

8-
# GITLAB
9-
# Maintainer: @randx
10-
# App Version: 5.0
8+
## Contributing
9+
10+
See [contributing.md](CONTRIBUTING.md) for contribution guidelines.
11+
12+
## Notes on the reliability of guides/scripts
13+
14+
* We will try to test everything before accepting PRs, in a clean, newly installed platform.
15+
* You should read a script and understand what it does prior to running it.
16+
* If something goes wrong during installation and you think the guide/script needs fixing, file a bug report or a submit a Pull Request.

apache/gitlab

Lines changed: 0 additions & 33 deletions
This file was deleted.

app-server/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
In this section there are provided additional configuration files for various application servers.
2+
3+
If you have something to contribute please read the [contributing guidelines](../CONTRIBUTING.md).
4+

app-server/puma/README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
Alternative configuration file for the `puma` application server. Copy it under `/home/git/gitlab/config/`.
2+
3+
## How to replace unicorn with puma
4+
5+
The easiest solution is to create a separate branch from the latest stable release
6+
and work from there. Then, with every release we can merge the stable branch into ours.
7+
Replace `latest-stable` with the latest stable branch.
8+
9+
```
10+
su
11+
service gitlab stop
12+
su - git
13+
cd gitlab/
14+
git checkout latest-stable
15+
git checkout -b puma
16+
sed -i 's/unicorn/puma/' Gemfile
17+
18+
# For mysql
19+
bundle install --without development test postgres --path vendor/bundle --no-deployment
20+
21+
# For postgres
22+
bundle install --without development test mysql --path vendor/bundle --no-deployment
23+
```
24+
25+
### Update GitLab version
26+
27+
When a new release is out all you have to do is merge it in puma branch.
28+
29+
```
30+
# As git user
31+
32+
cd /home/git/gitlab/
33+
git checkout master
34+
git fetch
35+
git checkout puma
36+
git merge latest-stable
37+
```
38+
39+
Then follow the official update instructions about migrations and the bundle install command.

app-server/puma/puma.rb

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
#!/usr/bin/env puma
2+
3+
# Start Puma with next command:
4+
# RAILS_ENV=production bundle exec puma -C ./config/puma.rb
5+
6+
# uncomment and customize to run in non-root path
7+
# note that config/gitlab.yml web path should also be changed
8+
# ENV['RAILS_RELATIVE_URL_ROOT'] = "/gitlab"
9+
10+
application_path = '/home/git/gitlab'
11+
directory application_path
12+
environment 'production'
13+
daemonize true
14+
pidfile "#{application_path}/tmp/pids/puma.pid"
15+
state_path "#{application_path}/tmp/pids/puma.state"
16+
stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log"
17+
18+
# Configure “min” to be the minimum number of threads to use to answer
19+
# requests and “max” the maximum.
20+
#
21+
# The default is “0, 16”.
22+
#
23+
# threads 0, 16
24+
25+
# Bind the server to “url”. “tcp://”, “unix://” and “ssl://” are the only
26+
# accepted protocols.
27+
#
28+
#
29+
# The default is “tcp://0.0.0.0:9292”.
30+
#
31+
# bind 'tcp://0.0.0.0:9292'
32+
# bind 'unix:///var/run/puma.sock'
33+
# bind 'unix:///var/run/puma.sock?umask=0777'
34+
# bind 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert'
35+
#
36+
## Comment the next line if you use apache.
37+
bind "unix://#{application_path}/tmp/sockets/gitlab.socket"
38+
39+
# Instead of “bind 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert'” you
40+
# can also use the “ssl_bind” option.
41+
#
42+
# ssl_bind '127.0.0.1', '9292', { key: path_to_key, cert: path_to_cert }
43+
44+
# Code to run before doing a restart. This code should
45+
# close log files, database connections, etc.
46+
#
47+
# This can be called multiple times to add code each time.
48+
#
49+
# on_restart do
50+
# puts 'On restart...'
51+
# end
52+
53+
# Command to use to restart puma. This should be just how to
54+
# load puma itself (ie. 'ruby -Ilib bin/puma'), not the arguments
55+
# to puma, as those are the same as the original process.
56+
#
57+
# restart_command '/u/app/lolcat/bin/restart_puma'
58+
59+
# === Cluster mode ===
60+
61+
# How many worker processes to run.
62+
#
63+
# The default is “0”.
64+
#
65+
# workers 2
66+
67+
# GitLab cluster mode recommendations
68+
# If you have more than 1 GB RAM, uncomment one of the following lines:
69+
#
70+
# workers 2 # if you have at least 1.5 GB RAM
71+
# workers 3 # if you have at least 2 GB RAM
72+
# workers 4 # if you have at least 2.5 GB RAM
73+
74+
# Code to run when a worker boots to setup the process before booting
75+
# the app.
76+
#
77+
# This can be called multiple times to add hooks.
78+
#
79+
# on_worker_boot do
80+
# puts 'On worker boot...'
81+
# end
82+
83+
# === Puma control rack application ===
84+
85+
# Start the puma control rack application on “url”. This application can
86+
# be communicated with to control the main server. Additionally, you can
87+
# provide an authentication token, so all requests to the control server
88+
# will need to include that token as a query parameter. This allows for
89+
# simple authentication.
90+
#
91+
# Check out https://github.com/puma/puma/blob/master/lib/puma/app/status.rb
92+
# to see what the app has available.
93+
#
94+
# activate_control_app 'unix:///var/run/pumactl.sock'
95+
# activate_control_app 'unix:///var/run/pumactl.sock', { auth_token: '12345' }
96+
# activate_control_app 'unix:///var/run/pumactl.sock', { no_token: true }
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
***The following howto assumes that you are running Debian 7 (wheezy)***
2+
3+
# Stop Gitlab
4+
5+
```bash
6+
service gitlab stop
7+
```
8+
9+
# Install postgresql
10+
11+
```bash
12+
sudo apt-get install -y postgresql-9.1 postgresql-client libpq-dev
13+
```
14+
15+
# Initial Setup
16+
17+
The following initial setup was taken from installation.md from the main installtion doc
18+
19+
```bash
20+
# Login to PostgreSQL
21+
sudo -u postgres psql -d template1
22+
23+
# Create a user for GitLab.
24+
template1=# CREATE USER git;
25+
26+
# Create the GitLab production database & grant all privileges on database
27+
template1=# CREATE DATABASE gitlabhq_production OWNER git;
28+
29+
# Quit the database session
30+
template1=# \q
31+
32+
# Try connecting to the new database with the new user
33+
sudo -u git -H psql -d gitlabhq_production
34+
```
35+
36+
# Install postgres gem
37+
38+
```bash
39+
cd ~git/gitlab
40+
sudo -u git -H bundle install --deployment --without development test mysql aws
41+
```
42+
43+
# Dump the mysql database
44+
45+
Make sure you do this as root, and therefore you will also need the root password for mysql as well
46+
47+
```bash
48+
mysqldump --compatible=postgresql --default-character-set=utf8 -r /tmp/gitlabhq_production.mysql -u root -p gitlabhq_production
49+
```
50+
51+
# Convert the mysql to postgres import
52+
53+
```bash
54+
wget https://raw.github.com/lanyrd/mysql-postgresql-converter/master/db_converter.py -O /tmp/db_converter.py
55+
python /tmp/db_converter.py /tmp/gitlab_production.mysql /tmp/gitlab_production.psql
56+
```
57+
58+
***Note:*** This was tested using debian 7, with python 2.7.3
59+
60+
# Import the database
61+
62+
```bash
63+
sudo -u git -H psql -d gitlabhq_production -f /tmp/gitlab_production.psql
64+
```
65+
66+
# Update database config
67+
68+
```bash
69+
cd ~git/gitlab/config
70+
sudo -u git -H cp database.yml database.yml.backup
71+
sudo -u git -H cp database.yml.postgresql database.yml
72+
```
73+
74+
The defaults from the database.yml should work if you have not made any modifications to the postgres authentication. You may need to change database.yml to suite your config.
75+
76+
# Start Gitlab service
77+
78+
```bash
79+
service gitlab start
80+
service nginx restart
81+
```
82+
83+
# Check application Status
84+
85+
Check if GitLab and its environment are configured correctly:
86+
87+
```bash
88+
cd ~git/gitlab
89+
sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production
90+
```
91+
92+
To make sure you didn't miss anything run a more thorough check with:
93+
94+
```bash
95+
cd ~git/gitlab
96+
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
97+
```
98+

0 commit comments

Comments
 (0)