From 83e478213741cde547d16fa3a92b31bfe308998f Mon Sep 17 00:00:00 2001 From: Praveen Arimbrathodiyil Date: Thu, 4 Feb 2016 13:31:45 +0530 Subject: [PATCH] remove export from gitlab-debian.conf for systemd - so we can use it as EnvironmentFile in systemd services --- debian/conf/gitlab | 6 +++--- debian/conf/gitlab-debian.conf | 24 ++++++++++++------------ debian/postinst | 10 ++++++---- debian/rake-tasks.sh | 3 +++ 4 files changed, 24 insertions(+), 19 deletions(-) diff --git a/debian/conf/gitlab b/debian/conf/gitlab index 7762273ac4..c9a4fa25fb 100755 --- a/debian/conf/gitlab +++ b/debian/conf/gitlab @@ -7,12 +7,12 @@ # Normal values are "production", "test" and "development". RAILS_ENV="production" -# Database selection -export DB="postgres" - # Read debian specific configuration . /etc/gitlab/gitlab-debian.conf +# DB needs to be exported for some commands +export DB=${DB} + # app_user defines the user that GitLab is run as. # The default is "git". app_user=${gitlab_user} diff --git a/debian/conf/gitlab-debian.conf b/debian/conf/gitlab-debian.conf index 287675254c..2e0e421b5f 100644 --- a/debian/conf/gitlab-debian.conf +++ b/debian/conf/gitlab-debian.conf @@ -1,12 +1,12 @@ -export RAILS_ENV=production -export DB=postgres -export gitlab_user=gitlab -export gitlab_conf=/etc/gitlab.conf -export gitlab_home=/usr/share/gitlab -export gitlab_data_dir=/var/lib/gitlab -export gitlab_scripts=/usr/lib/gitlab/scripts -export gitlab_nginx_log=/var/log/gitlab -export gitlab_ssl_path=/etc/gitlab/ssl -export gitlab_shell_root=/usr/share/gitlab-shell -export gitlab_shell_log=/var/log/gitlab-shell -export nginx_conf_example=/usr/share/doc/gitlab/nginx.conf.example +RAILS_ENV=production +DB=postgres +gitlab_user=gitlab +gitlab_conf=/etc/gitlab.conf +gitlab_home=/usr/share/gitlab +gitlab_data_dir=/var/lib/gitlab +gitlab_scripts=/usr/lib/gitlab/scripts +gitlab_nginx_log=/var/log/gitlab +gitlab_ssl_path=/etc/gitlab/ssl +gitlab_shell_root=/usr/share/gitlab-shell +gitlab_shell_log=/var/log/gitlab-shell +nginx_conf_example=/usr/share/doc/gitlab/nginx.conf.example diff --git a/debian/postinst b/debian/postinst index d8f4371b2b..383cdf468f 100755 --- a/debian/postinst +++ b/debian/postinst @@ -33,6 +33,8 @@ case "$1" in gitlab_debian_conf=/etc/gitlab/gitlab-debian.conf . ${gitlab_debian_conf} + # export DB for su command + export DB=${DB} . /usr/lib/gitlab/scripts/adduser.sh gitlab_repo_path=${gitlab_data_dir}/repositories mkdir -p ${gitlab_repo_path} @@ -52,10 +54,10 @@ case "$1" in if [ "${RET}" != "" ]; then if ! grep GITLAB_HOST ${gitlab_debian_conf} then - echo export GITLAB_HOST=${RET} >> ${gitlab_debian_conf} - echo export GITLAB_EMAIL_FROM="no-reply@${RET}" >> ${gitlab_debian_conf} - echo export GITLAB_EMAIL_DISPLAY_NAME="Gitlab" >> ${gitlab_debian_conf} - echo export GITLAB_EMAIL_REPLY_TO="no-reply@${RET}" >> ${gitlab_debian_conf} + echo GITLAB_HOST=${RET} >> ${gitlab_debian_conf} + echo GITLAB_EMAIL_FROM="no-reply@${RET}" >> ${gitlab_debian_conf} + echo GITLAB_EMAIL_DISPLAY_NAME="Gitlab" >> ${gitlab_debian_conf} + echo GITLAB_EMAIL_REPLY_TO="no-reply@${RET}" >> ${gitlab_debian_conf} fi if test -f ${nginx_conf_example} diff --git a/debian/rake-tasks.sh b/debian/rake-tasks.sh index e17090b407..12ec416f88 100755 --- a/debian/rake-tasks.sh +++ b/debian/rake-tasks.sh @@ -2,6 +2,9 @@ # Read configuration values . /etc/gitlab/gitlab-debian.conf +# export DB for su +export DB=${DB} + echo "Initializing database..." su ${gitlab_user} -s /bin/sh -c 'bundle exec rake gitlab:setup RAILS_ENV=production force=yes' su ${gitlab_user} -s /bin/sh -c 'bundle exec rake gitlab:shell:install \