remove hard coded gitlab user
This commit is contained in:
parent
585d4a4df2
commit
a93ae2eb50
7 changed files with 27 additions and 15 deletions
2
debian/conf/gitlab.yml.example
vendored
2
debian/conf/gitlab.yml.example
vendored
|
@ -46,7 +46,7 @@ production: &base
|
|||
# relative_url_root: /gitlab
|
||||
|
||||
# Uncomment and customize if you can't use the default user to run GitLab (default: 'git')
|
||||
user: gitlab
|
||||
user: GITLAB_USER
|
||||
user_home: /var/lib/gitlab
|
||||
|
||||
## Date & Time settings
|
||||
|
|
1
debian/gitlab.gitlab-mailroom.service
vendored
1
debian/gitlab.gitlab-mailroom.service
vendored
|
@ -9,7 +9,6 @@ ReloadPropagatedFrom=gitlab-unicorn.service
|
|||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=gitlab
|
||||
WorkingDirectory=/usr/share/gitlab
|
||||
EnvironmentFile=/etc/gitlab/gitlab-debian.conf
|
||||
SyslogIdentifier=gitlab-mailroom
|
||||
|
|
1
debian/gitlab.gitlab-sidekiq.service
vendored
1
debian/gitlab.gitlab-sidekiq.service
vendored
|
@ -9,7 +9,6 @@ ReloadPropagatedFrom=gitlab.service
|
|||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=gitlab
|
||||
WorkingDirectory=/usr/share/gitlab
|
||||
EnvironmentFile=/etc/gitlab/gitlab-debian.conf
|
||||
SyslogIdentifier=gitlab-sidekiq
|
||||
|
|
1
debian/gitlab.gitlab-unicorn.service
vendored
1
debian/gitlab.gitlab-unicorn.service
vendored
|
@ -9,7 +9,6 @@ ReloadPropagatedFrom=gitlab.service
|
|||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=gitlab
|
||||
WorkingDirectory=/usr/share/gitlab
|
||||
EnvironmentFile=/etc/gitlab/gitlab-debian.conf
|
||||
EnvironmentFile=-/etc/default/gitlab
|
||||
|
|
1
debian/gitlab.gitlab-workhorse.service
vendored
1
debian/gitlab.gitlab-workhorse.service
vendored
|
@ -9,7 +9,6 @@ ReloadPropagatedFrom=gitlab-unicorn.service
|
|||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=gitlab
|
||||
WorkingDirectory=/usr/share/gitlab
|
||||
EnvironmentFile=/etc/gitlab/gitlab-debian.conf
|
||||
SyslogIdentifier=gitlab-workhorse
|
||||
|
|
9
debian/postinst
vendored
9
debian/postinst
vendored
|
@ -143,6 +143,8 @@ EOF
|
|||
test -f ${gitlab_shell_config_private} || \
|
||||
cp ${gitlab_shell_config_example} ${gitlab_shell_config_private}
|
||||
|
||||
sed -i "s/GITLAB_USER/${gitlab_user}/" ${gitlab_yml_private}
|
||||
|
||||
if [ "${RET}" = "true" ]; then
|
||||
echo "Configuring nginx with HTTPS..."
|
||||
if ! grep GITLAB_HTTPS ${gitlab_debian_conf_private}; then
|
||||
|
@ -203,6 +205,13 @@ EOF
|
|||
ucf --debconf-ok --three-way ${gitlab_tmpfiles_private} ${gitlab_tmpfiles}
|
||||
ucfr gitlab ${gitlab_tmpfiles}
|
||||
|
||||
# Override User for systemd services
|
||||
for service in mailroom unicorn sidekiq workhorse; do
|
||||
path=/etc/systemd/system/gitlab-${service}.service.d
|
||||
mkdir -p $path
|
||||
printf "[Service]\nUser=${gitlab_user}\n" > $path/override.conf
|
||||
done
|
||||
|
||||
# Manage gitlab-shell's config.yml via ucf
|
||||
mkdir -p /etc/gitlab-shell
|
||||
echo "Registering ${gitlab_shell_config} via ucf"
|
||||
|
|
27
debian/postrm
vendored
27
debian/postrm
vendored
|
@ -44,16 +44,17 @@ case "$1" in
|
|||
# Check if we should remove data?
|
||||
db_get gitlab/purge
|
||||
if [ "${RET}" = "true" ]; then
|
||||
rm -rf /var/lib/gitlab/shared
|
||||
rm -rf /var/lib/gitlab/public
|
||||
rm -rf /var/lib/gitlab/db
|
||||
rm -rf /var/lib/gitlab/repositories
|
||||
rm -rf /var/lib/gitlab/secrets.yml
|
||||
rm -rf /var/lib/gitlab/Gemfile.lock
|
||||
rm -rf /var/log/gitlab
|
||||
rm -rf /var/cache/gitlab
|
||||
rm -rf /run/gitlab
|
||||
rm -rf ${gitlab_data_dir}/shared
|
||||
rm -rf ${gitlab_data_dir}/public
|
||||
rm -rf ${gitlab_data_dir}/db
|
||||
rm -rf ${gitlab_data_dir}/repositories
|
||||
rm -rf ${gitlab_data_dir}/secrets.yml
|
||||
rm -rf ${gitlab_data_dir}/Gemfile.lock
|
||||
rm -rf ${gitlab_log_dir}
|
||||
rm -rf ${gitlab_cache_path}
|
||||
rm -rf ${gitlab_pid_path}
|
||||
userdel -r ${gitlab_user}
|
||||
rm -rf ${gitlab_data_dir}
|
||||
su postgres -c "dropdb gitlab_production"
|
||||
fi
|
||||
|
||||
|
@ -102,7 +103,7 @@ case "$1" in
|
|||
fi
|
||||
|
||||
# remove generated assets
|
||||
rm -rf /var/lib/gitlab/public/assets
|
||||
rm -rf ${gitlab_data_dir}/public/assets
|
||||
|
||||
# Remove private copies of configuration files
|
||||
rm -f ${nginx_site_private}
|
||||
|
@ -111,6 +112,12 @@ case "$1" in
|
|||
rm -f ${gitlab_tmpfiles_private}
|
||||
rm -f ${gitlab_shell_config_private}
|
||||
|
||||
# Remove systemd service overrides
|
||||
for service in mailroom unicorn sidekiq workhorse; do
|
||||
path=/etc/systemd/system/gitlab-${service}.service.d
|
||||
rm -rf $path
|
||||
done
|
||||
|
||||
# cleanup complete
|
||||
exit 0
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue