From 757cee6e009186269c2e3d1655d30012f689d194 Mon Sep 17 00:00:00 2001 From: Praveen Arimbrathodiyil Date: Sat, 16 Jan 2016 15:43:30 +0530 Subject: [PATCH] add debconf option --- debian/config | 9 +++++++++ debian/gitlab.templates | 19 +++++++++++++------ debian/postinst | 34 ++++++++++++++++++++++++++++++---- 3 files changed, 52 insertions(+), 10 deletions(-) mode change 100644 => 100755 debian/config diff --git a/debian/config b/debian/config old mode 100644 new mode 100755 index 8db43ff59f..e79929677d --- a/debian/config +++ b/debian/config @@ -6,3 +6,12 @@ set -e echo "Call debconf to configure gitlab" # source debconf stuffs . /usr/share/debconf/confmodule + +# What is your fqdn? +db_input high gitlab/fqdn || true +db_go + +# Do you want https? +db_input high gitlab/ssl || true +db_go + diff --git a/debian/gitlab.templates b/debian/gitlab.templates index 326bc72f7e..df17d6c2c1 100644 --- a/debian/gitlab.templates +++ b/debian/gitlab.templates @@ -1,9 +1,15 @@ -Template: gitlab/dbpass -Type: note -_Description: PostgreSQL application password - You can leave the PostgreSQL application password blank, as the "ident" - authentication method is used, allowing the gitlab user on the system - to connect to the gitlab database without a password. +Template: gitlab/fqdn +Type: string +Default: localhost +_Description: Fully qualified domain name for this instance of Gitlab: + Please choose the domain name which should be used to access this + instance of Gitlab. + . + This should be the fully qualified name as seen from the Internet, with + the domain name that will be used to access the pod. + . + If a reverse proxy is used, give the hostname that the proxy server + responds to. Template: gitlab/ssl Type: boolean @@ -21,3 +27,4 @@ _Description: Enable https? You can disable https if you want to access Gitlab only locally, via Unicorn on port 3000. If you disable https, Nginx configuration will be skipped. + diff --git a/debian/postinst b/debian/postinst index 1fb0332ac4..ce691c8383 100755 --- a/debian/postinst +++ b/debian/postinst @@ -28,6 +28,10 @@ set -e case "$1" in configure) + echo "I'm here............................" + # Show debconf questions + . /usr/share/debconf/confmodule + . /etc/gitlab/gitlab-debian.conf . /usr/lib/gitlab/scripts/adduser.sh gitlab_repo_path=${gitlab_data_dir}/repositories @@ -42,12 +46,10 @@ case "$1" in su ${gitlab_user} -s /bin/sh -c "mkdir -p -m 750 ${gitlab_home}/public/uploads" su ${gitlab_user} -s /bin/sh -c 'git config --global core.autocrlf "input"' cd ${gitlab_home} - # Show debconf questions - . /usr/share/debconf/confmodule echo "Create database if not present" - if ! su postgres -s /bin/sh -c "psql gitlab_production -c ''" + if ! su postgres -s /bin/sh -c "psql gitlab_production -c ''" then - su postgres -c 'createdb gitlab_production' + su postgres -c 'createdb gitlab_production' fi # Adjust database privileges @@ -62,6 +64,30 @@ case "$1" in echo "Running final rake tasks..." # Move these to rails-common . /usr/lib/gitlab/scripts/rake-tasks.sh + + # Get ssl choice + db_get gitlab/ssl + if [ "${RET}" = "true" ]; then + db_go + # Configure instance address. + db_get gitlab/fqdn + echo "SSL enabled, configuring nginx for ${RET}..." + #/usr/lib/diaspora-common/scripts/set-env-nginx.sh ${RET} + db_go + else + db_go + # Configure instance address. + db_get gitlab/fqdn + echo "SSL disabled, skip nginx configuration for ${RET}..." + #if ! grep SERVERNAME /etc/diaspora.conf + #then + # echo export SERVERNAME=${RET} >> /etc/diaspora.conf + # export SERVERNAME=${RET} + # echo export ENVIRONMENT_URL="http://$SERVERNAME:3000" >> /etc/diaspora.conf + #fi + fi + db_stop + ;; abort-upgrade|abort-remove|abort-deconfigure)