Commit 4bd6f027ed05df72bdab94b296f3c20b48e2cb39
Exists in
master
and in
17 other branches
Merge branch 'git_data_dir' into 'master'
Git Data Dir
Showing
4 changed files
with
37 additions
and
13 deletions
Show diff stats
README.md
@@ -98,9 +98,20 @@ Omnibus-gitlab uses four different directories. | @@ -98,9 +98,20 @@ Omnibus-gitlab uses four different directories. | ||
98 | - `/var/log/gitlab` contains all log data generated by components of | 98 | - `/var/log/gitlab` contains all log data generated by components of |
99 | omnibus-gitlab. | 99 | omnibus-gitlab. |
100 | 100 | ||
101 | +### Storing Git data in an alternative directory | ||
102 | + | ||
103 | +By default, omnibus-gitlab stores Git repository data in `/var/opt/gitlab/git-data`. | ||
104 | +You can change this location by adding the following line to `/etc/gitlab/gitlab.rb`. | ||
105 | + | ||
106 | +```ruby | ||
107 | +git_data_dir "/mnt/nas/git-data" | ||
108 | +``` | ||
109 | + | ||
110 | +Run `sudo gitlab-ctl reconfigure` for the change to take effect. | ||
111 | + | ||
101 | ## Building your own package | 112 | ## Building your own package |
102 | 113 | ||
103 | See [the separate build documentation](doc/build.md). | 114 | See [the separate build documentation](doc/build.md). |
104 | 115 | ||
105 | [downloads]: https://www.gitlab.com/downloads | 116 | [downloads]: https://www.gitlab.com/downloads |
106 | -[CE README]: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/README.md | ||
107 | \ No newline at end of file | 117 | \ No newline at end of file |
118 | +[CE README]: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/README.md |
files/gitlab-cookbooks/gitlab/attributes/default.rb
@@ -86,10 +86,10 @@ default['gitlab']['gitlab-rails']['ldap_method'] = "ssl" | @@ -86,10 +86,10 @@ default['gitlab']['gitlab-rails']['ldap_method'] = "ssl" | ||
86 | default['gitlab']['gitlab-rails']['ldap_bind_dn'] = "_the_full_dn_of_the_user_you_will_bind_with" | 86 | default['gitlab']['gitlab-rails']['ldap_bind_dn'] = "_the_full_dn_of_the_user_you_will_bind_with" |
87 | default['gitlab']['gitlab-rails']['ldap_password'] = "_the_password_of_the_bind_user" | 87 | default['gitlab']['gitlab-rails']['ldap_password'] = "_the_password_of_the_bind_user" |
88 | default['gitlab']['gitlab-rails']['ldap_allow_username_or_email_login'] = true | 88 | default['gitlab']['gitlab-rails']['ldap_allow_username_or_email_login'] = true |
89 | -default['gitlab']['gitlab-rails']['satellites_path'] = "/var/opt/gitlab/gitlab-satellites" | 89 | +default['gitlab']['gitlab-rails']['satellites_path'] = "/var/opt/gitlab/git-data/gitlab-satellites" |
90 | default['gitlab']['gitlab-rails']['backup_path'] = "tmp/backups" | 90 | default['gitlab']['gitlab-rails']['backup_path'] = "tmp/backups" |
91 | default['gitlab']['gitlab-rails']['gitlab_shell_path'] = "/opt/gitlab/embedded/service/gitlab-shell/" | 91 | default['gitlab']['gitlab-rails']['gitlab_shell_path'] = "/opt/gitlab/embedded/service/gitlab-shell/" |
92 | -default['gitlab']['gitlab-rails']['gitlab_shell_repos_path'] = "/var/opt/gitlab/repositories" | 92 | +default['gitlab']['gitlab-rails']['gitlab_shell_repos_path'] = "/var/opt/gitlab/git-data/repositories" |
93 | default['gitlab']['gitlab-rails']['gitlab_shell_hooks_path'] = "/opt/gitlab/embedded/service/gitlab-shell/hooks/" | 93 | default['gitlab']['gitlab-rails']['gitlab_shell_hooks_path'] = "/opt/gitlab/embedded/service/gitlab-shell/hooks/" |
94 | default['gitlab']['gitlab-rails']['gitlab_shell_upload_pack'] = true | 94 | default['gitlab']['gitlab-rails']['gitlab_shell_upload_pack'] = true |
95 | default['gitlab']['gitlab-rails']['gitlab_shell_receive_pack'] = true | 95 | default['gitlab']['gitlab-rails']['gitlab_shell_receive_pack'] = true |
@@ -125,6 +125,7 @@ default['gitlab']['sidekiq']['log_directory'] = "/var/log/gitlab/sidekiq" | @@ -125,6 +125,7 @@ default['gitlab']['sidekiq']['log_directory'] = "/var/log/gitlab/sidekiq" | ||
125 | # gitlab-shell | 125 | # gitlab-shell |
126 | ### | 126 | ### |
127 | default['gitlab']['gitlab-shell']['log_directory'] = "/var/log/gitlab/gitlab-shell/" | 127 | default['gitlab']['gitlab-shell']['log_directory'] = "/var/log/gitlab/gitlab-shell/" |
128 | +default['gitlab']['gitlab-shell']['git_data_directory'] = "/var/opt/gitlab/git-data" | ||
128 | 129 | ||
129 | 130 | ||
130 | ### | 131 | ### |
files/gitlab-cookbooks/gitlab/libraries/gitlab.rb
@@ -31,11 +31,13 @@ module Gitlab | @@ -31,11 +31,13 @@ module Gitlab | ||
31 | postgresql Mash.new | 31 | postgresql Mash.new |
32 | redis Mash.new | 32 | redis Mash.new |
33 | gitlab_rails Mash.new | 33 | gitlab_rails Mash.new |
34 | + gitlab_shell Mash.new | ||
34 | unicorn Mash.new | 35 | unicorn Mash.new |
35 | sidekiq Mash.new | 36 | sidekiq Mash.new |
36 | nginx Mash.new | 37 | nginx Mash.new |
37 | node nil | 38 | node nil |
38 | external_url nil | 39 | external_url nil |
40 | + git_data_dir nil | ||
39 | 41 | ||
40 | class << self | 42 | class << self |
41 | 43 | ||
@@ -103,6 +105,14 @@ module Gitlab | @@ -103,6 +105,14 @@ module Gitlab | ||
103 | Gitlab['gitlab_rails']['gitlab_port'] = uri.port | 105 | Gitlab['gitlab_rails']['gitlab_port'] = uri.port |
104 | end | 106 | end |
105 | 107 | ||
108 | + def parse_git_data_dir | ||
109 | + return unless git_data_dir | ||
110 | + | ||
111 | + Gitlab['gitlab_shell']['git_data_directory'] ||= git_data_dir | ||
112 | + Gitlab['gitlab_rails']['gitlab_shell_repos_path'] ||= File.join(git_data_dir, "repositories") | ||
113 | + Gitlab['gitlab_rails']['satellites_path'] ||= File.join(git_data_dir, "gitlab-satellites") | ||
114 | + end | ||
115 | + | ||
106 | def generate_hash | 116 | def generate_hash |
107 | results = { "gitlab" => {} } | 117 | results = { "gitlab" => {} } |
108 | [ | 118 | [ |
@@ -110,6 +120,7 @@ module Gitlab | @@ -110,6 +120,7 @@ module Gitlab | ||
110 | "user", | 120 | "user", |
111 | "redis", | 121 | "redis", |
112 | "gitlab_rails", | 122 | "gitlab_rails", |
123 | + "gitlab_shell", | ||
113 | "unicorn", | 124 | "unicorn", |
114 | "sidekiq", | 125 | "sidekiq", |
115 | "nginx", | 126 | "nginx", |
@@ -125,6 +136,7 @@ module Gitlab | @@ -125,6 +136,7 @@ module Gitlab | ||
125 | def generate_config(node_name) | 136 | def generate_config(node_name) |
126 | generate_secrets(node_name) | 137 | generate_secrets(node_name) |
127 | parse_external_url | 138 | parse_external_url |
139 | + parse_git_data_dir | ||
128 | generate_hash | 140 | generate_hash |
129 | end | 141 | end |
130 | end | 142 | end |
files/gitlab-cookbooks/gitlab/recipes/gitlab-shell.rb
@@ -44,16 +44,16 @@ execute "chcon -t ssh_home_t #{ssh_dir}" do | @@ -44,16 +44,16 @@ execute "chcon -t ssh_home_t #{ssh_dir}" do | ||
44 | only_if "id -Z" | 44 | only_if "id -Z" |
45 | end | 45 | end |
46 | 46 | ||
47 | -directory log_directory do | ||
48 | - owner git_user | ||
49 | - mode "0700" | ||
50 | - recursive true | ||
51 | -end | ||
52 | - | ||
53 | -directory gitlab_shell_var_dir do | ||
54 | - owner git_user | ||
55 | - mode '0700' | ||
56 | - recursive true | 47 | +[ |
48 | + log_directory, | ||
49 | + gitlab_shell_var_dir, | ||
50 | + node['gitlab']['gitlab-shell']['git_data_directory'] | ||
51 | +].each do |dir| | ||
52 | + directory dir do | ||
53 | + owner git_user | ||
54 | + mode "0700" | ||
55 | + recursive true | ||
56 | + end | ||
57 | end | 57 | end |
58 | 58 | ||
59 | template_symlink File.join(gitlab_shell_var_dir, "config.yml") do | 59 | template_symlink File.join(gitlab_shell_var_dir, "config.yml") do |