Commit 9b3c64cbb6e99ace7a0498e82e559065dcc087f7
Exists in
master
and in
17 other branches
Merge branch 'configure_gitlab_core' into 'master'
Configure Gitlab Core
Showing
13 changed files
with
607 additions
and
4 deletions
Show diff stats
config/software/gitlab-core.rb
@@ -16,7 +16,7 @@ | @@ -16,7 +16,7 @@ | ||
16 | # | 16 | # |
17 | 17 | ||
18 | name "gitlab-core" | 18 | name "gitlab-core" |
19 | -version "6-5-stable" | 19 | +version "omnibus" |
20 | 20 | ||
21 | dependency "ruby" | 21 | dependency "ruby" |
22 | dependency "bundler" | 22 | dependency "bundler" |
@@ -30,6 +30,12 @@ dependency "postgresql" | @@ -30,6 +30,12 @@ dependency "postgresql" | ||
30 | source :git => "https://gitlab.com/gitlab-org/gitlab-ce.git" | 30 | source :git => "https://gitlab.com/gitlab-org/gitlab-ce.git" |
31 | 31 | ||
32 | build do | 32 | build do |
33 | + # GitLab assumes it can extract the Git revision of the currently version | ||
34 | + # from the Git repo the code lives in at boot. Because of our rsync later on, | ||
35 | + # this assumption does not hold. The sed command below patches the GitLab | ||
36 | + # source code to include the Git revision of the code included in the omnibus | ||
37 | + # build. | ||
38 | + command "sed -i 's/.*REVISION.*/REVISION = \"#{version_guid.split(':').last[0,10]}\"/' config/initializers/2_app.rb" | ||
33 | bundle "install --without mysql development test --path=#{install_dir}/embedded/service/gem" | 39 | bundle "install --without mysql development test --path=#{install_dir}/embedded/service/gem" |
34 | command "mkdir -p #{install_dir}/embedded/service/gitlab-core" | 40 | command "mkdir -p #{install_dir}/embedded/service/gitlab-core" |
35 | command "#{install_dir}/embedded/bin/rsync -a --delete --exclude=.git/*** --exclude=.gitignore ./ #{install_dir}/embedded/service/gitlab-core/" | 41 | command "#{install_dir}/embedded/bin/rsync -a --delete --exclude=.git/*** --exclude=.gitignore ./ #{install_dir}/embedded/service/gitlab-core/" |
files/gitlab-cookbooks/gitlab/attributes/default.rb
@@ -15,8 +15,12 @@ | @@ -15,8 +15,12 @@ | ||
15 | # limitations under the License. | 15 | # limitations under the License. |
16 | # | 16 | # |
17 | 17 | ||
18 | +#### | ||
19 | +# omnibus options | ||
20 | +#### | ||
18 | default['gitlab']['bootstrap']['enable'] = true | 21 | default['gitlab']['bootstrap']['enable'] = true |
19 | 22 | ||
23 | + | ||
20 | #### | 24 | #### |
21 | # The Git User that services run as | 25 | # The Git User that services run as |
22 | #### | 26 | #### |
@@ -28,9 +32,37 @@ default['gitlab']['user']['shell'] = "/bin/sh" | @@ -28,9 +32,37 @@ default['gitlab']['user']['shell'] = "/bin/sh" | ||
28 | # The home directory for the chef services user | 32 | # The home directory for the chef services user |
29 | default['gitlab']['user']['home'] = "/var/opt/gitlab" | 33 | default['gitlab']['user']['home'] = "/var/opt/gitlab" |
30 | 34 | ||
35 | + | ||
36 | +#### | ||
37 | +# GitLab core | ||
38 | +#### | ||
39 | +default['gitlab']['gitlab-core']['enable'] = true | ||
40 | +default['gitlab']['gitlab-core']['ha'] = false | ||
41 | +default['gitlab']['gitlab-core']['dir'] = "/var/opt/gitlab/gitlab-core" | ||
42 | +default['gitlab']['gitlab-core']['log_directory'] = "/var/log/gitlab/gitlab-core" | ||
43 | +default['gitlab']['gitlab-core']['environment'] = 'production' | ||
44 | +default['gitlab']['gitlab-core']['listen'] = '127.0.0.1' | ||
45 | +default['gitlab']['gitlab-core']['port'] = 8080 | ||
46 | +default['gitlab']['gitlab-core']['unicorn_socket'] = '/var/opt/gitlab/gitlab-core/tmp/sockets/gitlab.socket' | ||
47 | +default['gitlab']['gitlab-core']['tcp_nopush'] = true | ||
48 | +default['gitlab']['gitlab-core']['backlog_socket'] = 64 | ||
49 | +default['gitlab']['gitlab-core']['worker_timeout'] = 30 | ||
50 | +default['gitlab']['gitlab-core']['umask'] = "0022" | ||
51 | +default['gitlab']['gitlab-core']['worker_processes'] = 2 | ||
52 | + | ||
31 | default['gitlab']['gitlab-core']['repositories_path'] = "/var/opt/gitlab/repositories" | 53 | default['gitlab']['gitlab-core']['repositories_path'] = "/var/opt/gitlab/repositories" |
54 | +default['gitlab']['gitlab-core']['satellites_path'] = "/var/opt/gitlab/gitlab-satellites" | ||
32 | default['gitlab']['gitlab-core']['internal_api_url'] = "http://localhost:8080" | 55 | default['gitlab']['gitlab-core']['internal_api_url'] = "http://localhost:8080" |
56 | +default['gitlab']['gitlab-core']['external_fqdn'] = node['fqdn'] | ||
57 | +default['gitlab']['gitlab-core']['external_port'] = 80 | ||
58 | +default['gitlab']['gitlab-core']['external_https'] = false | ||
59 | +default['gitlab']['gitlab-core']['notification_email'] = "gitlab@#{node['fqdn']}" | ||
60 | +default['gitlab']['gitlab-core']['support_email'] = "support@example.com" | ||
61 | + | ||
33 | 62 | ||
63 | +### | ||
64 | +# gitlab-shell | ||
65 | +### | ||
34 | default['gitlab']['gitlab-shell']['log_directory'] = "/var/log/gitlab/gitlab-shell/" | 66 | default['gitlab']['gitlab-shell']['log_directory'] = "/var/log/gitlab/gitlab-shell/" |
35 | 67 | ||
36 | 68 | ||
@@ -50,7 +82,6 @@ default['gitlab']['postgresql']['home'] = "/var/opt/gitlab/postgresql" | @@ -50,7 +82,6 @@ default['gitlab']['postgresql']['home'] = "/var/opt/gitlab/postgresql" | ||
50 | default['gitlab']['postgresql']['user_path'] = "/opt/gitlab/embedded/bin:/opt/gitlab/bin:$PATH" | 82 | default['gitlab']['postgresql']['user_path'] = "/opt/gitlab/embedded/bin:/opt/gitlab/bin:$PATH" |
51 | default['gitlab']['postgresql']['sql_user'] = "gitlab" | 83 | default['gitlab']['postgresql']['sql_user'] = "gitlab" |
52 | default['gitlab']['postgresql']['sql_password'] = "snakepliskin" | 84 | default['gitlab']['postgresql']['sql_password'] = "snakepliskin" |
53 | -default['gitlab']['postgresql']['vip'] = "127.0.0.1" | ||
54 | default['gitlab']['postgresql']['port'] = 5432 | 85 | default['gitlab']['postgresql']['port'] = 5432 |
55 | default['gitlab']['postgresql']['listen_address'] = 'localhost' | 86 | default['gitlab']['postgresql']['listen_address'] = 'localhost' |
56 | default['gitlab']['postgresql']['max_connections'] = 200 | 87 | default['gitlab']['postgresql']['max_connections'] = 200 |
@@ -75,9 +106,10 @@ default['gitlab']['postgresql']['checkpoint_timeout'] = "5min" | @@ -75,9 +106,10 @@ default['gitlab']['postgresql']['checkpoint_timeout'] = "5min" | ||
75 | default['gitlab']['postgresql']['checkpoint_completion_target'] = 0.9 | 106 | default['gitlab']['postgresql']['checkpoint_completion_target'] = 0.9 |
76 | default['gitlab']['postgresql']['checkpoint_warning'] = "30s" | 107 | default['gitlab']['postgresql']['checkpoint_warning'] = "30s" |
77 | 108 | ||
78 | -### | 109 | + |
110 | +#### | ||
79 | # Redis | 111 | # Redis |
80 | -### | 112 | +#### |
81 | default['gitlab']['redis']['enable'] = true | 113 | default['gitlab']['redis']['enable'] = true |
82 | default['gitlab']['redis']['ha'] = false | 114 | default['gitlab']['redis']['ha'] = false |
83 | default['gitlab']['redis']['dir'] = "/var/opt/gitlab/redis" | 115 | default['gitlab']['redis']['dir'] = "/var/opt/gitlab/redis" |
files/gitlab-cookbooks/gitlab/definitions/unicorn_config.rb
0 → 100644
@@ -0,0 +1,45 @@ | @@ -0,0 +1,45 @@ | ||
1 | +# | ||
2 | +# Copyright:: Copyright (c) 2012 Opscode, Inc. | ||
3 | +# License:: Apache License, Version 2.0 | ||
4 | +# | ||
5 | +# Licensed under the Apache License, Version 2.0 (the "License"); | ||
6 | +# you may not use this file except in compliance with the License. | ||
7 | +# You may obtain a copy of the License at | ||
8 | +# | ||
9 | +# http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | +# | ||
11 | +# Unless required by applicable law or agreed to in writing, software | ||
12 | +# distributed under the License is distributed on an "AS IS" BASIS, | ||
13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14 | +# See the License for the specific language governing permissions and | ||
15 | +# limitations under the License. | ||
16 | +# | ||
17 | + | ||
18 | +define :unicorn_config, :listen => nil, :working_directory => nil, :worker_timeout => 60, :preload_app => false, :worker_processes => 4, :before_fork => nil, :after_fork => nil, :pid => nil, :stderr_path => nil, :stdout_path => nil, :notifies => nil, :owner => nil, :group => nil, :mode => nil do | ||
19 | + config_dir = File.dirname(params[:name]) | ||
20 | + | ||
21 | + directory config_dir do | ||
22 | + recursive true | ||
23 | + action :create | ||
24 | + end | ||
25 | + | ||
26 | + tvars = params.clone | ||
27 | + params[:listen].each do |port, options| | ||
28 | + oarray = Array.new | ||
29 | + options.each do |k, v| | ||
30 | + oarray << ":#{k} => #{v}" | ||
31 | + end | ||
32 | + tvars[:listen][port] = oarray.join(", ") | ||
33 | + end | ||
34 | + | ||
35 | + template params[:name] do | ||
36 | + source "unicorn.rb.erb" | ||
37 | + mode "0644" | ||
38 | + owner params[:owner] if params[:owner] | ||
39 | + group params[:group] if params[:group] | ||
40 | + mode params[:mode] if params[:mode] | ||
41 | + variables params | ||
42 | + notifies *params[:notifies] if params[:notifies] | ||
43 | + end | ||
44 | + | ||
45 | +end |
files/gitlab-cookbooks/gitlab/libraries/gitlab.rb
@@ -27,6 +27,7 @@ module Gitlab | @@ -27,6 +27,7 @@ module Gitlab | ||
27 | bootstrap Mash.new | 27 | bootstrap Mash.new |
28 | postgresql Mash.new | 28 | postgresql Mash.new |
29 | redis Mash.new | 29 | redis Mash.new |
30 | + gitlab_core Mash.new | ||
30 | node nil | 31 | node nil |
31 | 32 | ||
32 | class << self | 33 | class << self |
@@ -48,6 +49,7 @@ module Gitlab | @@ -48,6 +49,7 @@ module Gitlab | ||
48 | end | 49 | end |
49 | 50 | ||
50 | Gitlab['postgresql']['sql_password'] ||= generate_hex(50) | 51 | Gitlab['postgresql']['sql_password'] ||= generate_hex(50) |
52 | + Gitlab['gitlab_core']['secret_token'] ||= generate_hex(64) | ||
51 | 53 | ||
52 | if File.directory?("/etc/gitlab") | 54 | if File.directory?("/etc/gitlab") |
53 | File.open("/etc/gitlab/gitlab-secrets.json", "w") do |f| | 55 | File.open("/etc/gitlab/gitlab-secrets.json", "w") do |f| |
@@ -56,6 +58,9 @@ module Gitlab | @@ -56,6 +58,9 @@ module Gitlab | ||
56 | 'postgresql' => { | 58 | 'postgresql' => { |
57 | 'sql_password' => Gitlab['postgresql']['sql_password'], | 59 | 'sql_password' => Gitlab['postgresql']['sql_password'], |
58 | }, | 60 | }, |
61 | + 'gitlab_core' => { | ||
62 | + 'secret_token' => Gitlab['gitlab_core']['secret_token'], | ||
63 | + } | ||
59 | }) | 64 | }) |
60 | ) | 65 | ) |
61 | system("chmod 0600 /etc/gitlab/gitlab-secrets.json") | 66 | system("chmod 0600 /etc/gitlab/gitlab-secrets.json") |
@@ -68,6 +73,7 @@ module Gitlab | @@ -68,6 +73,7 @@ module Gitlab | ||
68 | [ | 73 | [ |
69 | "bootstrap", | 74 | "bootstrap", |
70 | "redis", | 75 | "redis", |
76 | + "gitlab_core", | ||
71 | "postgresql" | 77 | "postgresql" |
72 | ].each do |key| | 78 | ].each do |key| |
73 | rkey = key.gsub('_', '-') | 79 | rkey = key.gsub('_', '-') |
files/gitlab-cookbooks/gitlab/recipes/default.rb
@@ -54,6 +54,7 @@ include_recipe "runit" | @@ -54,6 +54,7 @@ include_recipe "runit" | ||
54 | [ | 54 | [ |
55 | "postgresql", | 55 | "postgresql", |
56 | "redis", | 56 | "redis", |
57 | + "gitlab-core", | ||
57 | "bootstrap", | 58 | "bootstrap", |
58 | ].each do |service| | 59 | ].each do |service| |
59 | if node["gitlab"][service]["enable"] | 60 | if node["gitlab"][service]["enable"] |
@@ -0,0 +1,143 @@ | @@ -0,0 +1,143 @@ | ||
1 | +# | ||
2 | +# Copyright:: Copyright (c) 2012 Opscode, Inc. | ||
3 | +# License:: Apache License, Version 2.0 | ||
4 | +# | ||
5 | +# Licensed under the Apache License, Version 2.0 (the "License"); | ||
6 | +# you may not use this file except in compliance with the License. | ||
7 | +# You may obtain a copy of the License at | ||
8 | +# | ||
9 | +# http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | +# | ||
11 | +# Unless required by applicable law or agreed to in writing, software | ||
12 | +# distributed under the License is distributed on an "AS IS" BASIS, | ||
13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14 | +# See the License for the specific language governing permissions and | ||
15 | +# limitations under the License. | ||
16 | +# | ||
17 | + | ||
18 | +gitlab_core_dir = node['gitlab']['gitlab-core']['dir'] | ||
19 | +gitlab_core_etc_dir = File.join(gitlab_core_dir, "etc") | ||
20 | +gitlab_core_working_dir = File.join(gitlab_core_dir, "working") | ||
21 | +gitlab_core_tmp_dir = File.join(gitlab_core_dir, "tmp") | ||
22 | +gitlab_core_log_dir = node['gitlab']['gitlab-core']['log_directory'] | ||
23 | + | ||
24 | +[ | ||
25 | + gitlab_core_dir, | ||
26 | + gitlab_core_etc_dir, | ||
27 | + gitlab_core_working_dir, | ||
28 | + gitlab_core_tmp_dir, | ||
29 | + gitlab_core_log_dir | ||
30 | +].each do |dir_name| | ||
31 | + directory dir_name do | ||
32 | + owner node['gitlab']['user']['username'] | ||
33 | + mode '0700' | ||
34 | + recursive true | ||
35 | + end | ||
36 | +end | ||
37 | + | ||
38 | +should_notify = OmnibusHelper.should_notify?("gitlab-core") | ||
39 | + | ||
40 | +secret_token_config = File.join(gitlab_core_etc_dir, "secret") | ||
41 | + | ||
42 | +file secret_token_config do | ||
43 | + content node['gitlab']['gitlab-core']['secret_token'] | ||
44 | + owner "root" | ||
45 | + group "root" | ||
46 | + mode "0644" | ||
47 | + notifies :restart, 'service[gitlab-core]' if should_notify | ||
48 | +end | ||
49 | + | ||
50 | +link "/opt/gitlab/embedded/service/gitlab-core/.secret" do | ||
51 | + to secret_token_config | ||
52 | +end | ||
53 | + | ||
54 | +database_yml = File.join(gitlab_core_etc_dir, "database.yml") | ||
55 | + | ||
56 | +template database_yml do | ||
57 | + source "database.yml.postgresql.erb" | ||
58 | + owner "root" | ||
59 | + group "root" | ||
60 | + mode "0644" | ||
61 | + variables(node['gitlab']['postgresql'].to_hash) | ||
62 | + notifies :restart, 'service[gitlab-core]' if should_notify | ||
63 | +end | ||
64 | + | ||
65 | +link "/opt/gitlab/embedded/service/gitlab-core/config/database.yml" do | ||
66 | + to database_yml | ||
67 | +end | ||
68 | + | ||
69 | +gitlab_yml = File.join(gitlab_core_etc_dir, "gitlab.yml") | ||
70 | + | ||
71 | +template gitlab_yml do | ||
72 | + source "gitlab.yml.erb" | ||
73 | + owner "root" | ||
74 | + group "root" | ||
75 | + mode "0644" | ||
76 | + variables(node['gitlab']['gitlab-core'].to_hash) | ||
77 | + notifies :restart, 'service[gitlab-core]' if should_notify | ||
78 | +end | ||
79 | + | ||
80 | +link "/opt/gitlab/embedded/service/gitlab-core/config/gitlab.yml" do | ||
81 | + to gitlab_yml | ||
82 | +end | ||
83 | + | ||
84 | +directory node['gitlab']['gitlab-core']['satellites_path'] do | ||
85 | + owner node['gitlab']['user']['username'] | ||
86 | + group node['gitlab']['user']['group'] | ||
87 | + recursive true | ||
88 | +end | ||
89 | + | ||
90 | + | ||
91 | +unicorn_listen_tcp = node['gitlab']['gitlab-core']['listen'] | ||
92 | +unicorn_listen_tcp << ":#{node['gitlab']['gitlab-core']['port']}" | ||
93 | +unicorn_listen_socket = node['gitlab']['gitlab-core']['unicorn_socket'] | ||
94 | + | ||
95 | +unicorn_config File.join(gitlab_core_etc_dir, "unicorn.rb") do | ||
96 | + listen( | ||
97 | + unicorn_listen_tcp => { | ||
98 | + :tcp_nopush => node['gitlab']['gitlab-core']['tcp_nopush'] | ||
99 | + }, | ||
100 | + unicorn_listen_socket => { | ||
101 | + :backlog => node['gitlab']['gitlab-core']['backlog_socket'], | ||
102 | + } | ||
103 | + ) | ||
104 | + worker_timeout node['gitlab']['gitlab-core']['worker_timeout'] | ||
105 | + working_directory gitlab_core_working_dir | ||
106 | + worker_processes node['gitlab']['gitlab-core']['worker_processes'] | ||
107 | + preload_app true | ||
108 | + owner "root" | ||
109 | + group "root" | ||
110 | + mode "0644" | ||
111 | + notifies :restart, 'service[gitlab-core]' if should_notify | ||
112 | +end | ||
113 | + | ||
114 | +# replace empty directories in the Git repo with symlinks to /var/opt/gitlab | ||
115 | +{ | ||
116 | + "/opt/gitlab/embedded/service/gitlab-core/tmp" => gitlab_core_tmp_dir, | ||
117 | + "/opt/gitlab/embedded/service/gitlab-core/log" => gitlab_core_log_dir | ||
118 | +}.each do |link_dir, target_dir| | ||
119 | + directory link_dir do | ||
120 | + action :delete | ||
121 | + recursive true | ||
122 | + end | ||
123 | + | ||
124 | + link link_dir do | ||
125 | + to target_dir | ||
126 | + end | ||
127 | +end | ||
128 | + | ||
129 | +execute "chown -R #{node['gitlab']['user']['username']} /opt/gitlab/embedded/service/gitlab-core/public" | ||
130 | + | ||
131 | +runit_service "gitlab-core" do | ||
132 | + down node['gitlab']['gitlab-core']['ha'] | ||
133 | + options({ | ||
134 | + :log_directory => gitlab_core_log_dir | ||
135 | + }.merge(params)) | ||
136 | +end | ||
137 | + | ||
138 | +if node['gitlab']['bootstrap']['enable'] | ||
139 | + execute "/opt/gitlab/bin/gitlab-ctl start gitlab-core" do | ||
140 | + retries 20 | ||
141 | + end | ||
142 | +end | ||
143 | + |
files/gitlab-cookbooks/gitlab/recipes/gitlab-core_disable.rb
0 → 100644
@@ -0,0 +1,20 @@ | @@ -0,0 +1,20 @@ | ||
1 | +# | ||
2 | +# Copyright:: Copyright (c) 2012 Opscode, Inc. | ||
3 | +# License:: Apache License, Version 2.0 | ||
4 | +# | ||
5 | +# Licensed under the Apache License, Version 2.0 (the "License"); | ||
6 | +# you may not use this file except in compliance with the License. | ||
7 | +# You may obtain a copy of the License at | ||
8 | +# | ||
9 | +# http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | +# | ||
11 | +# Unless required by applicable law or agreed to in writing, software | ||
12 | +# distributed under the License is distributed on an "AS IS" BASIS, | ||
13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14 | +# See the License for the specific language governing permissions and | ||
15 | +# limitations under the License. | ||
16 | +# | ||
17 | + | ||
18 | +runit_service "gitlab-core" do | ||
19 | + action :disable | ||
20 | +end |
files/gitlab-cookbooks/gitlab/recipes/gitlab-shell.rb
@@ -9,16 +9,19 @@ log_directory = node['gitlab']['gitlab-shell']['log_directory'] | @@ -9,16 +9,19 @@ log_directory = node['gitlab']['gitlab-shell']['log_directory'] | ||
9 | directory repositories_path do | 9 | directory repositories_path do |
10 | owner git_user | 10 | owner git_user |
11 | group git_group | 11 | group git_group |
12 | + recursive true | ||
12 | end | 13 | end |
13 | 14 | ||
14 | directory ssh_dir do | 15 | directory ssh_dir do |
15 | owner git_user | 16 | owner git_user |
16 | group git_group | 17 | group git_group |
17 | mode "0700" | 18 | mode "0700" |
19 | + recursive true | ||
18 | end | 20 | end |
19 | 21 | ||
20 | directory log_directory do | 22 | directory log_directory do |
21 | owner git_user | 23 | owner git_user |
24 | + recursive true | ||
22 | end | 25 | end |
23 | 26 | ||
24 | template File.join(gitlab_shell_dir, "config.yml") do | 27 | template File.join(gitlab_shell_dir, "config.yml") do |
files/gitlab-cookbooks/gitlab/templates/default/database.yml.postgresql.erb
0 → 100644
@@ -0,0 +1,49 @@ | @@ -0,0 +1,49 @@ | ||
1 | +# | ||
2 | +# PRODUCTION | ||
3 | +# | ||
4 | +production: | ||
5 | + adapter: postgresql | ||
6 | + encoding: unicode | ||
7 | + database: gitlabhq_production | ||
8 | + pool: 10 | ||
9 | + username: <%= node['gitlab']['postgresql']['sql_user'] %> | ||
10 | + password: <%= node['gitlab']['postgresql']['sql_password'] %> | ||
11 | + host: <%= node['gitlab']['postgresql']['listen_address'] %> | ||
12 | + port: <%= node['gitlab']['postgresql']['port'] %> | ||
13 | +# socket: /tmp/postgresql.sock | ||
14 | + | ||
15 | +# | ||
16 | +# Development specific | ||
17 | +# | ||
18 | +development: | ||
19 | + adapter: postgresql | ||
20 | + encoding: unicode | ||
21 | + database: gitlabhq_development | ||
22 | + pool: 5 | ||
23 | + username: postgres | ||
24 | + password: | ||
25 | + # socket: /tmp/postgresql.sock | ||
26 | + | ||
27 | +# | ||
28 | +# Staging specific | ||
29 | +# | ||
30 | +staging: | ||
31 | + adapter: postgresql | ||
32 | + encoding: unicode | ||
33 | + database: gitlabhq_staging | ||
34 | + pool: 5 | ||
35 | + username: postgres | ||
36 | + password: | ||
37 | + # socket: /tmp/postgresql.sock | ||
38 | + | ||
39 | +# Warning: The database defined as "test" will be erased and | ||
40 | +# re-generated from your development database when you run "rake". | ||
41 | +# Do not set this db to the same as development or production. | ||
42 | +test: &test | ||
43 | + adapter: postgresql | ||
44 | + encoding: unicode | ||
45 | + database: gitlabhq_test | ||
46 | + pool: 5 | ||
47 | + username: postgres | ||
48 | + password: | ||
49 | + # socket: /tmp/postgresql.sock |
files/gitlab-cookbooks/gitlab/templates/default/gitlab.yml.erb
0 → 100644
@@ -0,0 +1,238 @@ | @@ -0,0 +1,238 @@ | ||
1 | +# # # # # # # # # # # # # # # # # # | ||
2 | +# GitLab application config file # | ||
3 | +# # # # # # # # # # # # # # # # # # | ||
4 | +# | ||
5 | +# How to use: | ||
6 | +# 1. copy file as gitlab.yml | ||
7 | +# 2. Replace gitlab -> host with your domain | ||
8 | +# 3. Replace gitlab -> email_from | ||
9 | + | ||
10 | +production: &base | ||
11 | + # | ||
12 | + # 1. GitLab app settings | ||
13 | + # ========================== | ||
14 | + | ||
15 | + ## GitLab settings | ||
16 | + gitlab: | ||
17 | + ## Web server settings (note: host is the FQDN, do not include http://) | ||
18 | + host: <%= node['gitlab']['gitlab-core']['external_fqdn'] %> | ||
19 | + port: <%= node['gitlab']['gitlab-core']['external_port'] %> | ||
20 | + https: <%= node['gitlab']['gitlab-core']['external_https'] %> | ||
21 | + | ||
22 | + # Uncomment and customize the last line to run in a non-root path | ||
23 | + # WARNING: We recommend creating a FQDN to host GitLab in a root path instead of this. | ||
24 | + # Note that four settings need to be changed for this to work. | ||
25 | + # 1) In your application.rb file: config.relative_url_root = "/gitlab" | ||
26 | + # 2) In your gitlab.yml file: relative_url_root: /gitlab | ||
27 | + # 3) In your unicorn.rb: ENV['RAILS_RELATIVE_URL_ROOT'] = "/gitlab" | ||
28 | + # 4) In ../gitlab-shell/config.yml: gitlab_url: "http://127.0.0.1/gitlab" | ||
29 | + # To update the path, run: sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production | ||
30 | + # | ||
31 | + # relative_url_root: /gitlab | ||
32 | + | ||
33 | + # Uncomment and customize if you can't use the default user to run GitLab (default: 'git') | ||
34 | + # user: git | ||
35 | + | ||
36 | + ## Email settings | ||
37 | + # Email address used in the "From" field in mails sent by GitLab | ||
38 | + email_from: <%= node['gitlab']['gitlab-core']['notification_email'] %> | ||
39 | + | ||
40 | + # Email address of your support contact (default: same as email_from) | ||
41 | + support_email: <%= node['gitlab']['gitlab-core']['support_email'] %> | ||
42 | + | ||
43 | + ## User settings | ||
44 | + default_projects_limit: 10 | ||
45 | + # default_can_create_group: false # default: true | ||
46 | + # username_changing_enabled: false # default: true - User can change her username/namespace | ||
47 | + ## Default theme | ||
48 | + ## BASIC = 1 | ||
49 | + ## MARS = 2 | ||
50 | + ## MODERN = 3 | ||
51 | + ## GRAY = 4 | ||
52 | + ## COLOR = 5 | ||
53 | + # default_theme: 2 # default: 2 | ||
54 | + | ||
55 | + | ||
56 | + ## Users management | ||
57 | + # default: false - Account passwords are not sent via the email if signup is enabled. | ||
58 | + # signup_enabled: true | ||
59 | + | ||
60 | + # Restrict setting visibility levels for non-admin users. | ||
61 | + # The default is to allow all levels. | ||
62 | + #restricted_visibility_levels: [ "public" ] | ||
63 | + | ||
64 | + ## Automatic issue closing | ||
65 | + # If a commit message matches this regular expression, all issues referenced from the matched text will be closed. | ||
66 | + # This happens when the commit is pushed or merged into the default branch of a project. | ||
67 | + # When not specified the default issue_closing_pattern as specified below will be used. | ||
68 | + # issue_closing_pattern: '([Cc]lose[sd]|[Ff]ixe[sd]) +#\d+' | ||
69 | + | ||
70 | + ## Default project features settings | ||
71 | + default_projects_features: | ||
72 | + issues: true | ||
73 | + merge_requests: true | ||
74 | + wiki: true | ||
75 | + wall: false | ||
76 | + snippets: false | ||
77 | + visibility_level: "private" # can be "private" | "internal" | "public" | ||
78 | + | ||
79 | + ## External issues trackers | ||
80 | + issues_tracker: | ||
81 | + # redmine: | ||
82 | + # title: "Redmine" | ||
83 | + # ## If not nil, link 'Issues' on project page will be replaced with this | ||
84 | + # ## Use placeholders: | ||
85 | + # ## :project_id - GitLab project identifier | ||
86 | + # ## :issues_tracker_id - Project Name or Id in external issue tracker | ||
87 | + # project_url: "http://redmine.sample/projects/:issues_tracker_id" | ||
88 | + # | ||
89 | + # ## If not nil, links from /#\d/ entities from commit messages will replaced with this | ||
90 | + # ## Use placeholders: | ||
91 | + # ## :project_id - GitLab project identifier | ||
92 | + # ## :issues_tracker_id - Project Name or Id in external issue tracker | ||
93 | + # ## :id - Issue id (from commit messages) | ||
94 | + # issues_url: "http://redmine.sample/issues/:id" | ||
95 | + # | ||
96 | + # ## If not nil, linkis to creating new issues will be replaced with this | ||
97 | + # ## Use placeholders: | ||
98 | + # ## :project_id - GitLab project identifier | ||
99 | + # ## :issues_tracker_id - Project Name or Id in external issue tracker | ||
100 | + # new_issue_url: "http://redmine.sample/projects/:issues_tracker_id/issues/new" | ||
101 | + # | ||
102 | + # jira: | ||
103 | + # title: "Atlassian Jira" | ||
104 | + # project_url: "http://jira.sample/issues/?jql=project=:issues_tracker_id" | ||
105 | + # issues_url: "http://jira.sample/browse/:id" | ||
106 | + # new_issue_url: "http://jira.sample/secure/CreateIssue.jspa" | ||
107 | + | ||
108 | + ## Gravatar | ||
109 | + gravatar: | ||
110 | + enabled: true # Use user avatar image from Gravatar.com (default: true) | ||
111 | + # plain_url: "http://..." # default: http://www.gravatar.com/avatar/%{hash}?s=%{size}&d=mm | ||
112 | + # ssl_url: "https://..." # default: https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=mm | ||
113 | + | ||
114 | + # | ||
115 | + # 2. Auth settings | ||
116 | + # ========================== | ||
117 | + | ||
118 | + ## LDAP settings | ||
119 | + # You can inspect a sample of the LDAP users with login access by running: | ||
120 | + # bundle exec rake gitlab:ldap:check RAILS_ENV=production | ||
121 | + ldap: | ||
122 | + enabled: false | ||
123 | + host: '_your_ldap_server' | ||
124 | + base: '_the_base_where_you_search_for_users' | ||
125 | + port: 636 | ||
126 | + uid: 'sAMAccountName' | ||
127 | + method: 'ssl' # "tls" or "ssl" or "plain" | ||
128 | + bind_dn: '_the_full_dn_of_the_user_you_will_bind_with' | ||
129 | + password: '_the_password_of_the_bind_user' | ||
130 | + # If allow_username_or_email_login is enabled, GitLab will ignore everything | ||
131 | + # after the first '@' in the LDAP username submitted by the user on login. | ||
132 | + # | ||
133 | + # Example: | ||
134 | + # - the user enters 'jane.doe@example.com' and 'p@ssw0rd' as LDAP credentials; | ||
135 | + # - GitLab queries the LDAP server with 'jane.doe' and 'p@ssw0rd'. | ||
136 | + # | ||
137 | + # If you are using "uid: 'userPrincipalName'" on ActiveDirectory you need to | ||
138 | + # disable this setting, because the userPrincipalName contains an '@'. | ||
139 | + allow_username_or_email_login: true | ||
140 | + | ||
141 | + ## OmniAuth settings | ||
142 | + omniauth: | ||
143 | + # Allow login via Twitter, Google, etc. using OmniAuth providers | ||
144 | + enabled: false | ||
145 | + | ||
146 | + # CAUTION! | ||
147 | + # This allows users to login without having a user account first (default: false). | ||
148 | + # User accounts will be created automatically when authentication was successful. | ||
149 | + allow_single_sign_on: false | ||
150 | + # Locks down those users until they have been cleared by the admin (default: true). | ||
151 | + block_auto_created_users: true | ||
152 | + | ||
153 | + ## Auth providers | ||
154 | + # Uncomment the following lines and fill in the data of the auth provider you want to use | ||
155 | + # If your favorite auth provider is not listed you can use others: | ||
156 | + # see https://github.com/gitlabhq/gitlab-public-wiki/wiki/Working-custom-omniauth-provider-configurations | ||
157 | + # The 'app_id' and 'app_secret' parameters are always passed as the first two | ||
158 | + # arguments, followed by optional 'args' which can be either a hash or an array. | ||
159 | + providers: | ||
160 | + # - { name: 'google_oauth2', app_id: 'YOUR APP ID', | ||
161 | + # app_secret: 'YOUR APP SECRET', | ||
162 | + # args: { access_type: 'offline', approval_prompt: '' } } | ||
163 | + # - { name: 'twitter', app_id: 'YOUR APP ID', | ||
164 | + # app_secret: 'YOUR APP SECRET'} | ||
165 | + # - { name: 'github', app_id: 'YOUR APP ID', | ||
166 | + # app_secret: 'YOUR APP SECRET', | ||
167 | + # args: { scope: 'user:email' } } | ||
168 | + | ||
169 | + | ||
170 | + | ||
171 | + # | ||
172 | + # 3. Advanced settings | ||
173 | + # ========================== | ||
174 | + | ||
175 | + # GitLab Satellites | ||
176 | + satellites: | ||
177 | + # Relative paths are relative to Rails.root (default: tmp/repo_satellites/) | ||
178 | + path: <%= node['gitlab']['gitlab-core']['satellites_path'] %> | ||
179 | + | ||
180 | + ## Backup settings | ||
181 | + backup: | ||
182 | + path: "tmp/backups" # Relative paths are relative to Rails.root (default: tmp/backups/) | ||
183 | + # keep_time: 604800 # default: 0 (forever) (in seconds) | ||
184 | + | ||
185 | + ## GitLab Shell settings | ||
186 | + gitlab_shell: | ||
187 | + path: /opt/gitlab/embedded/service/gitlab-shell/ | ||
188 | + | ||
189 | + # REPOS_PATH MUST NOT BE A SYMLINK!!! | ||
190 | + repos_path: <%= node['gitlab']['gitlab-core']['repositories_path'] %> | ||
191 | + hooks_path: /opt/gitlab/embedded/service/gitlab-shell/hooks/ | ||
192 | + | ||
193 | + # Git over HTTP | ||
194 | + upload_pack: true | ||
195 | + receive_pack: true | ||
196 | + | ||
197 | + # If you use non-standard ssh port you need to specify it | ||
198 | + # ssh_port: 22 | ||
199 | + | ||
200 | + ## Git settings | ||
201 | + # CAUTION! | ||
202 | + # Use the default values unless you really know what you are doing | ||
203 | + git: | ||
204 | + bin_path: /opt/gitlab/embedded/bin/git | ||
205 | + # The next value is the maximum memory size grit can use | ||
206 | + # Given in number of bytes per git object (e.g. a commit) | ||
207 | + # This value can be increased if you have very large commits | ||
208 | + max_size: 5242880 # 5.megabytes | ||
209 | + # Git timeout to read a commit, in seconds | ||
210 | + timeout: 10 | ||
211 | + | ||
212 | + # | ||
213 | + # 4. Extra customization | ||
214 | + # ========================== | ||
215 | + | ||
216 | + extra: | ||
217 | + ## Google analytics. Uncomment if you want it | ||
218 | + # google_analytics_id: '_your_tracking_id' | ||
219 | + | ||
220 | + ## Text under sign-in page (Markdown enabled) | ||
221 | + # sign_in_text: | | ||
222 | + #  | ||
223 | + # [Learn more about CompanyName](http://www.companydomain.com/) | ||
224 | + | ||
225 | +development: | ||
226 | + <<: *base | ||
227 | + | ||
228 | +test: | ||
229 | + <<: *base | ||
230 | + issues_tracker: | ||
231 | + redmine: | ||
232 | + title: "Redmine" | ||
233 | + project_url: "http://redmine/projects/:issues_tracker_id" | ||
234 | + issues_url: "http://redmine/:project_id/:issues_tracker_id/:id" | ||
235 | + new_issue_url: "http://redmine/projects/:issues_tracker_id/issues/new" | ||
236 | + | ||
237 | +staging: | ||
238 | + <<: *base |
files/gitlab-cookbooks/gitlab/templates/default/sv-gitlab-core-log-run.erb
0 → 100644
files/gitlab-cookbooks/gitlab/templates/default/sv-gitlab-core-run.erb
0 → 100644
@@ -0,0 +1,6 @@ | @@ -0,0 +1,6 @@ | ||
1 | +#!/bin/sh | ||
2 | + | ||
3 | +cd /opt/gitlab/embedded/service/gitlab-core | ||
4 | + | ||
5 | +exec 2>&1 | ||
6 | +exec chpst -P -U <%= node['gitlab']['user']['username'] %> -u <%= node['gitlab']['user']['username'] %> /usr/bin/env HOME="<%= node['gitlab']['gitlab-core']['dir'] %>" /opt/gitlab/embedded/bin/bundle exec unicorn -E <%= node['gitlab']['gitlab-core']['environment'] %> -c <%= File.join(node['gitlab']['gitlab-core']['dir'], "etc", "unicorn.rb") %> /opt/gitlab/embedded/service/gitlab-core/config.ru |
files/gitlab-cookbooks/gitlab/templates/default/unicorn.rb.erb
0 → 100644
@@ -0,0 +1,52 @@ | @@ -0,0 +1,52 @@ | ||
1 | +## | ||
2 | +# Unicorn config at <%= @name %> | ||
3 | +# Managed by Chef - Local Changes will be Nuked from Orbit (just to be sure) | ||
4 | +## | ||
5 | + | ||
6 | +# What ports/sockets to listen on, and what options for them. | ||
7 | +<%- @listen.each do |port, options| %> | ||
8 | +listen "<%= port %>", <%= options %> | ||
9 | +<%- end %> | ||
10 | + | ||
11 | +<%- if @working_directory %> | ||
12 | +working_directory '<%= @working_directory %>' | ||
13 | +<%- end %> | ||
14 | + | ||
15 | +# What the timeout for killing busy workers is, in seconds | ||
16 | +timeout <%= @worker_timeout %> | ||
17 | + | ||
18 | +# Whether the app should be pre-loaded | ||
19 | +preload_app <%= @preload_app %> | ||
20 | + | ||
21 | +# How many worker processes | ||
22 | +worker_processes <%= @worker_processes %> | ||
23 | + | ||
24 | +<%- if @before_fork %> | ||
25 | +# What to do before we fork a worker | ||
26 | +before_fork do |server, worker| | ||
27 | + <%= @before_fork %> | ||
28 | +end | ||
29 | + | ||
30 | +<%- end %> | ||
31 | +<%- if @after_fork %> | ||
32 | +# What to do after we fork a worker | ||
33 | +after_fork do |server, worker| | ||
34 | + <%= @after_fork %> | ||
35 | +end | ||
36 | + | ||
37 | +<%- end %> | ||
38 | +<%- if @pid %> | ||
39 | +# Where to drop a pidfile | ||
40 | +pid '<%= @pid %>' | ||
41 | + | ||
42 | +<%- end %> | ||
43 | +<%- if @stderr_path %> | ||
44 | +# Where stderr gets logged | ||
45 | +stderr_path '<%= @stderr_path %>' | ||
46 | + | ||
47 | +<%- end %> | ||
48 | +<%- if @stdout_path %> | ||
49 | +# Where stdout gets logged | ||
50 | +stdout_path '<%= @stdout_path %>' | ||
51 | + | ||
52 | +<%- end %> |