[DRE-commits] [gitlab] 12/17: configure ssl in nginx

Praveen Arimbrathodiyil praveen at moszumanska.debian.org
Sun Feb 7 10:36:05 UTC 2016


This is an automated email from the git hooks/post-receive script.

praveen pushed a commit to branch master
in repository gitlab.

commit e7b677721673163bad2b3427ca4ed67e9a6a79ec
Author: Praveen Arimbrathodiyil <praveen at debian.org>
Date:   Sun Feb 7 14:22:01 2016 +0530

    configure ssl in nginx
---
 debian/conf/gitlab-debian.conf |  1 +
 debian/postinst                | 44 +++++++++++++++++++++++++++---------------
 2 files changed, 29 insertions(+), 16 deletions(-)

diff --git a/debian/conf/gitlab-debian.conf b/debian/conf/gitlab-debian.conf
index 2e0e421..6b7c598 100644
--- a/debian/conf/gitlab-debian.conf
+++ b/debian/conf/gitlab-debian.conf
@@ -10,3 +10,4 @@ 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
+nginx_ssl_conf_example_gz=/usr/share/doc/gitlab/nginx.ssl.conf.example.gz
diff --git a/debian/postinst b/debian/postinst
index e9a5d81..e3e91bd 100755
--- a/debian/postinst
+++ b/debian/postinst
@@ -51,24 +51,36 @@ case "$1" in
 	su ${gitlab_user} -s /bin/sh -c 'git config --global core.autocrlf "input"'
 	cd ${gitlab_home}
 	db_get gitlab/fqdn
-            if [ "${RET}" != "" ]; then
-                if ! grep GITLAB_HOST ${gitlab_debian_conf}
-                then
-                    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}
+        if [ "${RET}" != "" ]; then
+            if ! grep GITLAB_HOST ${gitlab_debian_conf}
+            then
+		export GITLAB_HOST=${RET} # We need this to configure nginx below
+                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
+ 	    db_get gitlab/ssl
+	    if [ "${RET}" = "true" ]
+	    then
+	    	if [ -f "${nginx_ssl_conf_example_gz}" ]
 		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
+		    # undo dh_installdocs auto compress
+		    zcat ${nginx_ssl_conf_example_gz} >/tmp/gitlab-ssl
+	    	    export nginx_conf_example="/tmp/gitlab-ssl"
 		fi
+	    fi
+
+	    if test -f ${nginx_conf_example}
+	    then
+		sed -e "s/YOUR_SERVER_FQDN/${GITLAB_HOST}/"\
+		 ${nginx_conf_example} >/etc/nginx/sites-available/${GITLAB_HOST}
+		ln -fs /etc/nginx/sites-available/${RET} /etc/nginx/sites-enabled/
+		rm -f /tmp/gitlab-ssl
+	    else
+		echo "nginx.conf.example not found"
+		exit 1
+	    fi
 
 	    else
 	    	echo "Failed to retrieve fully qualified domain name"

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/gitlab.git



More information about the Pkg-ruby-extras-commits mailing list