Commit 6c500427c611ff9b8452e9351df9f55682910d15
1 parent
9ff3b444
Exists in
master
and in
17 other branches
Configure gitlab-shell
Showing
3 changed files
with
80 additions
and
0 deletions
Show diff stats
files/gitlab-cookbooks/gitlab/attributes/default.rb
... | ... | @@ -27,6 +27,11 @@ default['gitlab']['user']['shell'] = "/bin/sh" |
27 | 27 | # The home directory for the chef services user |
28 | 28 | default['gitlab']['user']['home'] = "/var/opt/gitlab" |
29 | 29 | |
30 | +default['gitlab']['gitlab-core']['repositories_path'] = "/var/opt/gitlab/repositories" | |
31 | +default['gitlab']['gitlab-core']['internal_api_url'] = "http://localhost:8080" | |
32 | + | |
33 | +default['gitlab']['gitlab-shell']['log_directory'] = "/var/log/gitlab/gitlab-shell/" | |
34 | + | |
30 | 35 | |
31 | 36 | ### |
32 | 37 | # PostgreSQL | ... | ... |
... | ... | @@ -0,0 +1,34 @@ |
1 | +git_user = node['gitlab']['user']['username'] | |
2 | +gitlab_shell_dir = "/opt/gitlab/embedded/service/gitlab-shell" | |
3 | +repositories_path = node['gitlab']['gitlab-core']['repositories_path'] | |
4 | +ssh_dir = File.join(node['gitlab']['user']['home'], ".ssh") | |
5 | + | |
6 | +# Create directories because the git_user does not own its home directory | |
7 | +directory repositories_path do | |
8 | + owner git_user | |
9 | +end | |
10 | + | |
11 | +directory ssh_dir do | |
12 | + owner git_user | |
13 | + mode "0700" | |
14 | +end | |
15 | + | |
16 | +template File.join(gitlab_shell_dir, "config.yml") do | |
17 | + source "gitlab-shell-config.yml.erb" | |
18 | + owner git_user | |
19 | + variables( | |
20 | + :user => git_user, | |
21 | + :api_url => node['gitlab']['gitlab-core']['internal_api_url'], | |
22 | + :repositories_path => repositories_path, | |
23 | + :ssh_dir => ssh_dir, | |
24 | + :redis_port => node['gitlab']['redis']['port'], | |
25 | + :log_directory => node['gitlab']['gitlab-shell']['log_directory'] | |
26 | + ) | |
27 | + notifies :run, "execute[bin/install]" | |
28 | +end | |
29 | + | |
30 | +execute "bin/install" do | |
31 | + cwd gitlab_shell_dir | |
32 | + user git_user | |
33 | + action :nothing | |
34 | +end | ... | ... |
files/gitlab-cookbooks/gitlab/templates/default/gitlab-shell-config.yml.erb
0 → 100644
... | ... | @@ -0,0 +1,41 @@ |
1 | +# GitLab user. git by default | |
2 | +user: <%= @user %> | |
3 | + | |
4 | +# Url to gitlab instance. Used for api calls. Should end with a slash. | |
5 | +gitlab_url: "<%= @api_url %>" | |
6 | + | |
7 | +http_settings: | |
8 | +# user: someone | |
9 | +# password: somepass | |
10 | +# ca_file: /etc/ssl/cert.pem | |
11 | +# ca_path: /etc/pki/tls/certs | |
12 | + self_signed_cert: false | |
13 | + | |
14 | +# Repositories path | |
15 | +# Give the canonicalized absolute pathname, | |
16 | +# REPOS_PATH MUST NOT CONTAIN ANY SYMLINK!!! | |
17 | +# Check twice that none of the components is a symlink, including "/home". | |
18 | +repos_path: "<%= @repositories_path %>" | |
19 | + | |
20 | +# File used as authorized_keys for gitlab user | |
21 | +auth_file: "<%= @ssh_dir %>/authorized_keys" | |
22 | + | |
23 | +# Redis settings used for pushing commit notices to gitlab | |
24 | +redis: | |
25 | + bin: /opt/gitlab/embedded/bin/redis-cli | |
26 | + host: 127.0.0.1 | |
27 | + port: <%= @redis_port %> | |
28 | + # socket: /tmp/redis.socket # Only define this if you want to use sockets | |
29 | + namespace: resque:gitlab | |
30 | + | |
31 | +# Log file. | |
32 | +# Default is gitlab-shell.log in the root directory. | |
33 | +log_file: "<%= @log_directory %>/gitlab-shell.log" | |
34 | + | |
35 | +# Log level. INFO by default | |
36 | +log_level: INFO | |
37 | + | |
38 | +# Audit usernames. | |
39 | +# Set to true to see real usernames in the logs instead of key ids, which is easier to follow, but | |
40 | +# incurs an extra API call on every gitlab-shell command. | |
41 | +audit_usernames: false | ... | ... |