From e57c0f6ce783167e95bfd669e74d523ce8d97a64 Mon Sep 17 00:00:00 2001 From: Praveen Arimbrathodiyil Date: Sun, 24 Jan 2016 09:47:27 +0530 Subject: [PATCH] configure nginx --- debian/conf/gitlab-debian.conf | 1 + debian/gitlab.docs | 1 + debian/postinst | 24 ++++++++++++++++++------ 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/debian/conf/gitlab-debian.conf b/debian/conf/gitlab-debian.conf index b18291a2e5..287675254c 100644 --- a/debian/conf/gitlab-debian.conf +++ b/debian/conf/gitlab-debian.conf @@ -9,3 +9,4 @@ 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 diff --git a/debian/gitlab.docs b/debian/gitlab.docs index 389dbb95e0..d782b1f3c1 100644 --- a/debian/gitlab.docs +++ b/debian/gitlab.docs @@ -1,2 +1,3 @@ README.md debian/README.Debian +debian/conf/nginx.conf.example diff --git a/debian/postinst b/debian/postinst index f3a9b0e61c..686db77e2c 100755 --- a/debian/postinst +++ b/debian/postinst @@ -31,7 +31,8 @@ case "$1" in # Show debconf questions . /usr/share/debconf/confmodule - . /etc/gitlab/gitlab-debian.conf + gitlab_debian_conf=/etc/gitlab/gitlab-debian.conf + . ${gitlab_debian_conf} . /usr/lib/gitlab/scripts/adduser.sh gitlab_repo_path=${gitlab_data_dir}/repositories mkdir -p ${gitlab_repo_path} @@ -50,13 +51,24 @@ case "$1" in db_get gitlab/fqdn if [ "${RET}" != "" ]; then db_go - if ! grep GITLAB_HOST /etc/gitlab/gitlab-debian.conf + if ! grep GITLAB_HOST ${gitlab_debian_conf} then - echo export GITLAB_HOST=${RET} >> /etc/gitlab/gitlab-debian.conf - echo export GITLAB_EMAIL_FROM="no-reply@${RET}" >> /etc/gitlab/gitlab-debian.conf - echo export GITLAB_EMAIL_DISPLAY_NAME="Gitlab" >> /etc/gitlab/gitlab-debian.conf - echo export GITLAB_EMAIL_REPLY_TO="no-reply@${RET}" >> /etc/gitlab/gitlab-debian.conf + 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} fi + + if test -f ${nginx_conf_example} + then + sed -e "s/YOUR_SERVER_FQDN/${RET}/"\ + ${nginx_conf_example} >/etc/nginx/sites-available/${RET} + ln -fs /etc/nginx/sites-available/${RET} /etc/nginx/sites-enabled/ + else + echo "nginx.conf.example not found" + exit 1 + fi + else echo "Failed to retrieve fully qualified domain name" exit 1