From 8e70f0e3ddf2d2e302ff050a1a0f34c012a89729 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Fri, 23 May 2014 11:38:14 +0200 Subject: [PATCH] Specify numeric user and group identifiers --- CHANGELOG | 3 +++ README.md | 14 ++++++++++++++ files/gitlab-cookbooks/gitlab/attributes/default.rb | 6 ++++++ files/gitlab-cookbooks/gitlab/recipes/postgresql.rb | 9 ++++++++- files/gitlab-cookbooks/gitlab/recipes/redis.rb | 9 ++++++++- files/gitlab-cookbooks/gitlab/recipes/users.rb | 5 ++++- 6 files changed, 43 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 5a5849c..d82f91b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +7.0.0 +- Specify numeric user / group identifiers + 6.9.0 - Make SSH port in clone URLs configurable (Julien Pivotto) - Fix default Postgres port for non-packaged DBMS (Drew Blessing) diff --git a/README.md b/README.md index 58280a0..cd4322a 100644 --- a/README.md +++ b/README.md @@ -412,6 +412,20 @@ sudo gitlab-rake gitlab:setup This is a destructive command; do not run it on an existing database! +## Specify numeric user and group identifiers + +Omnibus-gitlab creates users for GitLab, PostgreSQL and Redis. You can specify +the numeric identifiers for these users in `/etc/gitlab/gitlab.rb` as follows. + +```ruby +user['uid'] = 1234 +user['gid'] = 1234 +postgresql['uid'] = 1235 +postgresql['gid'] = 1235 +redis['uid'] = 1236 +redis['gid'] = 1236 +``` + ## Building your own package See [the separate build documentation](doc/build.md). diff --git a/files/gitlab-cookbooks/gitlab/attributes/default.rb b/files/gitlab-cookbooks/gitlab/attributes/default.rb index a98acd7..0637413 100644 --- a/files/gitlab-cookbooks/gitlab/attributes/default.rb +++ b/files/gitlab-cookbooks/gitlab/attributes/default.rb @@ -28,6 +28,8 @@ default['gitlab']['bootstrap']['enable'] = true # The username for the chef services user default['gitlab']['user']['username'] = "git" default['gitlab']['user']['group'] = "git" +default['gitlab']['user']['uid'] = nil +default['gitlab']['user']['gid'] = nil # The shell for the chef services user default['gitlab']['user']['shell'] = "/bin/sh" # The home directory for the chef services user @@ -151,6 +153,8 @@ default['gitlab']['postgresql']['log_directory'] = "/var/log/gitlab/postgresql" default['gitlab']['postgresql']['svlogd_size'] = 1000000 default['gitlab']['postgresql']['svlogd_num'] = 10 default['gitlab']['postgresql']['username'] = "gitlab-psql" +default['gitlab']['postgresql']['uid'] = nil +default['gitlab']['postgresql']['gid'] = nil default['gitlab']['postgresql']['shell'] = "/bin/sh" default['gitlab']['postgresql']['home'] = "/var/opt/gitlab/postgresql" 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" default['gitlab']['redis']['svlogd_size'] = 1000000 default['gitlab']['redis']['svlogd_num'] = 10 default['gitlab']['redis']['username'] = "gitlab-redis" +default['gitlab']['redis']['uid'] = nil +default['gitlab']['redis']['gid'] = nil default['gitlab']['redis']['shell'] = "/bin/nologin" default['gitlab']['redis']['home'] = "/var/opt/gitlab/redis" default['gitlab']['redis']['port'] = 6379 diff --git a/files/gitlab-cookbooks/gitlab/recipes/postgresql.rb b/files/gitlab-cookbooks/gitlab/recipes/postgresql.rb index a753e46..8a58b20 100644 --- a/files/gitlab-cookbooks/gitlab/recipes/postgresql.rb +++ b/files/gitlab-cookbooks/gitlab/recipes/postgresql.rb @@ -20,8 +20,15 @@ postgresql_dir = node['gitlab']['postgresql']['dir'] postgresql_data_dir = node['gitlab']['postgresql']['data_dir'] postgresql_data_dir_symlink = File.join(postgresql_dir, "data") postgresql_log_dir = node['gitlab']['postgresql']['log_directory'] +postgresql_user = node['gitlab']['postgresql']['username'] -user node['gitlab']['postgresql']['username'] do +group postgresql_user do + gid node['gitlab']['postgresql']['gid'] +end + +user postgresql_user do + uid node['gitlab']['postgresql']['uid'] + gid postgresql_user system true shell node['gitlab']['postgresql']['shell'] home node['gitlab']['postgresql']['home'] diff --git a/files/gitlab-cookbooks/gitlab/recipes/redis.rb b/files/gitlab-cookbooks/gitlab/recipes/redis.rb index 318d6f4..94545a1 100644 --- a/files/gitlab-cookbooks/gitlab/recipes/redis.rb +++ b/files/gitlab-cookbooks/gitlab/recipes/redis.rb @@ -18,8 +18,15 @@ redis_dir = node['gitlab']['redis']['dir'] redis_log_dir = node['gitlab']['redis']['log_directory'] +redis_user = node['gitlab']['redis']['username'] -user node['gitlab']['redis']['username'] do +group redis_user do + gid node['gitlab']['redis']['gid'] +end + +user do + uid node['gitlab']['redis']['uid'] + gid redis_user system true shell node['gitlab']['redis']['shell'] home node['gitlab']['redis']['home'] diff --git a/files/gitlab-cookbooks/gitlab/recipes/users.rb b/files/gitlab-cookbooks/gitlab/recipes/users.rb index c354b4f..6d9cc08 100644 --- a/files/gitlab-cookbooks/gitlab/recipes/users.rb +++ b/files/gitlab-cookbooks/gitlab/recipes/users.rb @@ -21,12 +21,15 @@ gitlab_group = node['gitlab']['user']['group'] gitlab_home = node['gitlab']['user']['home'] # Create the group for the GitLab user -group gitlab_group +group gitlab_group do + gid node['gitlab']['user']['gid'] +end # Create the GitLab user user gitlab_username do shell node['gitlab']['user']['shell'] home gitlab_home + uid node['gitlab']['user']['uid'] gid gitlab_group end -- libgit2 0.21.2