Commit 8e70f0e3ddf2d2e302ff050a1a0f34c012a89729

Authored by Jacob Vosmaer
1 parent b6294738

Specify numeric user and group identifiers

  1 +7.0.0
  2 +- Specify numeric user / group identifiers
  3 +
1 6.9.0 4 6.9.0
2 - Make SSH port in clone URLs configurable (Julien Pivotto) 5 - Make SSH port in clone URLs configurable (Julien Pivotto)
3 - Fix default Postgres port for non-packaged DBMS (Drew Blessing) 6 - Fix default Postgres port for non-packaged DBMS (Drew Blessing)
@@ -412,6 +412,20 @@ sudo gitlab-rake gitlab:setup @@ -412,6 +412,20 @@ sudo gitlab-rake gitlab:setup
412 412
413 This is a destructive command; do not run it on an existing database! 413 This is a destructive command; do not run it on an existing database!
414 414
  415 +## Specify numeric user and group identifiers
  416 +
  417 +Omnibus-gitlab creates users for GitLab, PostgreSQL and Redis. You can specify
  418 +the numeric identifiers for these users in `/etc/gitlab/gitlab.rb` as follows.
  419 +
  420 +```ruby
  421 +user['uid'] = 1234
  422 +user['gid'] = 1234
  423 +postgresql['uid'] = 1235
  424 +postgresql['gid'] = 1235
  425 +redis['uid'] = 1236
  426 +redis['gid'] = 1236
  427 +```
  428 +
415 ## Building your own package 429 ## Building your own package
416 430
417 See [the separate build documentation](doc/build.md). 431 See [the separate build documentation](doc/build.md).
files/gitlab-cookbooks/gitlab/attributes/default.rb
@@ -28,6 +28,8 @@ default['gitlab']['bootstrap']['enable'] = true @@ -28,6 +28,8 @@ default['gitlab']['bootstrap']['enable'] = true
28 # The username for the chef services user 28 # The username for the chef services user
29 default['gitlab']['user']['username'] = "git" 29 default['gitlab']['user']['username'] = "git"
30 default['gitlab']['user']['group'] = "git" 30 default['gitlab']['user']['group'] = "git"
  31 +default['gitlab']['user']['uid'] = nil
  32 +default['gitlab']['user']['gid'] = nil
31 # The shell for the chef services user 33 # The shell for the chef services user
32 default['gitlab']['user']['shell'] = "/bin/sh" 34 default['gitlab']['user']['shell'] = "/bin/sh"
33 # The home directory for the chef services user 35 # The home directory for the chef services user
@@ -151,6 +153,8 @@ default['gitlab']['postgresql']['log_directory'] = "/var/log/gitlab/postgresql" @@ -151,6 +153,8 @@ default['gitlab']['postgresql']['log_directory'] = "/var/log/gitlab/postgresql"
151 default['gitlab']['postgresql']['svlogd_size'] = 1000000 153 default['gitlab']['postgresql']['svlogd_size'] = 1000000
152 default['gitlab']['postgresql']['svlogd_num'] = 10 154 default['gitlab']['postgresql']['svlogd_num'] = 10
153 default['gitlab']['postgresql']['username'] = "gitlab-psql" 155 default['gitlab']['postgresql']['username'] = "gitlab-psql"
  156 +default['gitlab']['postgresql']['uid'] = nil
  157 +default['gitlab']['postgresql']['gid'] = nil
154 default['gitlab']['postgresql']['shell'] = "/bin/sh" 158 default['gitlab']['postgresql']['shell'] = "/bin/sh"
155 default['gitlab']['postgresql']['home'] = "/var/opt/gitlab/postgresql" 159 default['gitlab']['postgresql']['home'] = "/var/opt/gitlab/postgresql"
156 default['gitlab']['postgresql']['user_path'] = "/opt/gitlab/embedded/bin:/opt/gitlab/bin:$PATH" 160 default['gitlab']['postgresql']['user_path'] = "/opt/gitlab/embedded/bin:/opt/gitlab/bin:$PATH"
@@ -191,6 +195,8 @@ default['gitlab']['redis']['log_directory'] = "/var/log/gitlab/redis" @@ -191,6 +195,8 @@ default['gitlab']['redis']['log_directory'] = "/var/log/gitlab/redis"
191 default['gitlab']['redis']['svlogd_size'] = 1000000 195 default['gitlab']['redis']['svlogd_size'] = 1000000
192 default['gitlab']['redis']['svlogd_num'] = 10 196 default['gitlab']['redis']['svlogd_num'] = 10
193 default['gitlab']['redis']['username'] = "gitlab-redis" 197 default['gitlab']['redis']['username'] = "gitlab-redis"
  198 +default['gitlab']['redis']['uid'] = nil
  199 +default['gitlab']['redis']['gid'] = nil
194 default['gitlab']['redis']['shell'] = "/bin/nologin" 200 default['gitlab']['redis']['shell'] = "/bin/nologin"
195 default['gitlab']['redis']['home'] = "/var/opt/gitlab/redis" 201 default['gitlab']['redis']['home'] = "/var/opt/gitlab/redis"
196 default['gitlab']['redis']['port'] = 6379 202 default['gitlab']['redis']['port'] = 6379
files/gitlab-cookbooks/gitlab/recipes/postgresql.rb
@@ -20,8 +20,15 @@ postgresql_dir = node['gitlab']['postgresql']['dir'] @@ -20,8 +20,15 @@ postgresql_dir = node['gitlab']['postgresql']['dir']
20 postgresql_data_dir = node['gitlab']['postgresql']['data_dir'] 20 postgresql_data_dir = node['gitlab']['postgresql']['data_dir']
21 postgresql_data_dir_symlink = File.join(postgresql_dir, "data") 21 postgresql_data_dir_symlink = File.join(postgresql_dir, "data")
22 postgresql_log_dir = node['gitlab']['postgresql']['log_directory'] 22 postgresql_log_dir = node['gitlab']['postgresql']['log_directory']
  23 +postgresql_user = node['gitlab']['postgresql']['username']
23 24
24 -user node['gitlab']['postgresql']['username'] do 25 +group postgresql_user do
  26 + gid node['gitlab']['postgresql']['gid']
  27 +end
  28 +
  29 +user postgresql_user do
  30 + uid node['gitlab']['postgresql']['uid']
  31 + gid postgresql_user
25 system true 32 system true
26 shell node['gitlab']['postgresql']['shell'] 33 shell node['gitlab']['postgresql']['shell']
27 home node['gitlab']['postgresql']['home'] 34 home node['gitlab']['postgresql']['home']
files/gitlab-cookbooks/gitlab/recipes/redis.rb
@@ -18,8 +18,15 @@ @@ -18,8 +18,15 @@
18 18
19 redis_dir = node['gitlab']['redis']['dir'] 19 redis_dir = node['gitlab']['redis']['dir']
20 redis_log_dir = node['gitlab']['redis']['log_directory'] 20 redis_log_dir = node['gitlab']['redis']['log_directory']
  21 +redis_user = node['gitlab']['redis']['username']
21 22
22 -user node['gitlab']['redis']['username'] do 23 +group redis_user do
  24 + gid node['gitlab']['redis']['gid']
  25 +end
  26 +
  27 +user do
  28 + uid node['gitlab']['redis']['uid']
  29 + gid redis_user
23 system true 30 system true
24 shell node['gitlab']['redis']['shell'] 31 shell node['gitlab']['redis']['shell']
25 home node['gitlab']['redis']['home'] 32 home node['gitlab']['redis']['home']
files/gitlab-cookbooks/gitlab/recipes/users.rb
@@ -21,12 +21,15 @@ gitlab_group = node['gitlab']['user']['group'] @@ -21,12 +21,15 @@ gitlab_group = node['gitlab']['user']['group']
21 gitlab_home = node['gitlab']['user']['home'] 21 gitlab_home = node['gitlab']['user']['home']
22 22
23 # Create the group for the GitLab user 23 # Create the group for the GitLab user
24 -group gitlab_group 24 +group gitlab_group do
  25 + gid node['gitlab']['user']['gid']
  26 +end
25 27
26 # Create the GitLab user 28 # Create the GitLab user
27 user gitlab_username do 29 user gitlab_username do
28 shell node['gitlab']['user']['shell'] 30 shell node['gitlab']['user']['shell']
29 home gitlab_home 31 home gitlab_home
  32 + uid node['gitlab']['user']['uid']
30 gid gitlab_group 33 gid gitlab_group
31 end 34 end
32 35