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
|
# relative_url_root: /gitlab
|
||||||
|
|
||||||
# Uncomment and customize if you can't use the default user to run GitLab (default: 'git')
|
# 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
|
user_home: /var/lib/gitlab
|
||||||
|
|
||||||
## Date & Time settings
|
## 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]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
User=gitlab
|
|
||||||
WorkingDirectory=/usr/share/gitlab
|
WorkingDirectory=/usr/share/gitlab
|
||||||
EnvironmentFile=/etc/gitlab/gitlab-debian.conf
|
EnvironmentFile=/etc/gitlab/gitlab-debian.conf
|
||||||
SyslogIdentifier=gitlab-mailroom
|
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]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
User=gitlab
|
|
||||||
WorkingDirectory=/usr/share/gitlab
|
WorkingDirectory=/usr/share/gitlab
|
||||||
EnvironmentFile=/etc/gitlab/gitlab-debian.conf
|
EnvironmentFile=/etc/gitlab/gitlab-debian.conf
|
||||||
SyslogIdentifier=gitlab-sidekiq
|
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]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
User=gitlab
|
|
||||||
WorkingDirectory=/usr/share/gitlab
|
WorkingDirectory=/usr/share/gitlab
|
||||||
EnvironmentFile=/etc/gitlab/gitlab-debian.conf
|
EnvironmentFile=/etc/gitlab/gitlab-debian.conf
|
||||||
EnvironmentFile=-/etc/default/gitlab
|
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]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
User=gitlab
|
|
||||||
WorkingDirectory=/usr/share/gitlab
|
WorkingDirectory=/usr/share/gitlab
|
||||||
EnvironmentFile=/etc/gitlab/gitlab-debian.conf
|
EnvironmentFile=/etc/gitlab/gitlab-debian.conf
|
||||||
SyslogIdentifier=gitlab-workhorse
|
SyslogIdentifier=gitlab-workhorse
|
||||||
|
|
9
debian/postinst
vendored
9
debian/postinst
vendored
|
@ -143,6 +143,8 @@ EOF
|
||||||
test -f ${gitlab_shell_config_private} || \
|
test -f ${gitlab_shell_config_private} || \
|
||||||
cp ${gitlab_shell_config_example} ${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
|
if [ "${RET}" = "true" ]; then
|
||||||
echo "Configuring nginx with HTTPS..."
|
echo "Configuring nginx with HTTPS..."
|
||||||
if ! grep GITLAB_HTTPS ${gitlab_debian_conf_private}; then
|
if ! grep GITLAB_HTTPS ${gitlab_debian_conf_private}; then
|
||||||
|
@ -203,6 +205,13 @@ EOF
|
||||||
ucf --debconf-ok --three-way ${gitlab_tmpfiles_private} ${gitlab_tmpfiles}
|
ucf --debconf-ok --three-way ${gitlab_tmpfiles_private} ${gitlab_tmpfiles}
|
||||||
ucfr gitlab ${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
|
# Manage gitlab-shell's config.yml via ucf
|
||||||
mkdir -p /etc/gitlab-shell
|
mkdir -p /etc/gitlab-shell
|
||||||
echo "Registering ${gitlab_shell_config} via ucf"
|
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?
|
# Check if we should remove data?
|
||||||
db_get gitlab/purge
|
db_get gitlab/purge
|
||||||
if [ "${RET}" = "true" ]; then
|
if [ "${RET}" = "true" ]; then
|
||||||
rm -rf /var/lib/gitlab/shared
|
rm -rf ${gitlab_data_dir}/shared
|
||||||
rm -rf /var/lib/gitlab/public
|
rm -rf ${gitlab_data_dir}/public
|
||||||
rm -rf /var/lib/gitlab/db
|
rm -rf ${gitlab_data_dir}/db
|
||||||
rm -rf /var/lib/gitlab/repositories
|
rm -rf ${gitlab_data_dir}/repositories
|
||||||
rm -rf /var/lib/gitlab/secrets.yml
|
rm -rf ${gitlab_data_dir}/secrets.yml
|
||||||
rm -rf /var/lib/gitlab/Gemfile.lock
|
rm -rf ${gitlab_data_dir}/Gemfile.lock
|
||||||
rm -rf /var/log/gitlab
|
rm -rf ${gitlab_log_dir}
|
||||||
rm -rf /var/cache/gitlab
|
rm -rf ${gitlab_cache_path}
|
||||||
rm -rf /run/gitlab
|
rm -rf ${gitlab_pid_path}
|
||||||
userdel -r ${gitlab_user}
|
userdel -r ${gitlab_user}
|
||||||
|
rm -rf ${gitlab_data_dir}
|
||||||
su postgres -c "dropdb gitlab_production"
|
su postgres -c "dropdb gitlab_production"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -102,7 +103,7 @@ case "$1" in
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# remove generated assets
|
# remove generated assets
|
||||||
rm -rf /var/lib/gitlab/public/assets
|
rm -rf ${gitlab_data_dir}/public/assets
|
||||||
|
|
||||||
# Remove private copies of configuration files
|
# Remove private copies of configuration files
|
||||||
rm -f ${nginx_site_private}
|
rm -f ${nginx_site_private}
|
||||||
|
@ -111,6 +112,12 @@ case "$1" in
|
||||||
rm -f ${gitlab_tmpfiles_private}
|
rm -f ${gitlab_tmpfiles_private}
|
||||||
rm -f ${gitlab_shell_config_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
|
# cleanup complete
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue