Merge branch 'debconf'

This commit is contained in:
Praveen Arimbrathodiyil 2016-01-23 22:15:53 +05:30
commit f6579beb52
3 changed files with 51 additions and 11 deletions

10
debian/config vendored Normal file → Executable file
View file

@ -3,6 +3,14 @@
set -e set -e
echo "Call debconf to configure gitlab"
# source debconf stuffs # source debconf stuffs
. /usr/share/debconf/confmodule . /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

View file

@ -1,9 +1,15 @@
Template: gitlab/dbpass Template: gitlab/fqdn
Type: note Type: string
_Description: PostgreSQL application password Default: localhost
You can leave the PostgreSQL application password blank, as the "ident" _Description: Fully qualified domain name for this instance of Gitlab:
authentication method is used, allowing the gitlab user on the system Please choose the domain name which should be used to access this
to connect to the gitlab database without a password. 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 Template: gitlab/ssl
Type: boolean Type: boolean
@ -21,3 +27,4 @@ _Description: Enable https?
You can disable https if you want to access Gitlab only locally, via 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 Unicorn on port 3000. If you disable https, Nginx configuration will be
skipped. skipped.

33
debian/postinst vendored
View file

@ -28,6 +28,9 @@ set -e
case "$1" in case "$1" in
configure) configure)
# Show debconf questions
. /usr/share/debconf/confmodule
. /etc/gitlab/gitlab-debian.conf . /etc/gitlab/gitlab-debian.conf
. /usr/lib/gitlab/scripts/adduser.sh . /usr/lib/gitlab/scripts/adduser.sh
gitlab_repo_path=${gitlab_data_dir}/repositories gitlab_repo_path=${gitlab_data_dir}/repositories
@ -44,12 +47,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 "mkdir -p -m 750 ${gitlab_home}/public/uploads"
su ${gitlab_user} -s /bin/sh -c 'git config --global core.autocrlf "input"' su ${gitlab_user} -s /bin/sh -c 'git config --global core.autocrlf "input"'
cd ${gitlab_home} cd ${gitlab_home}
# Show debconf questions
. /usr/share/debconf/confmodule
echo "Create database if not present" 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 then
su postgres -c 'createdb gitlab_production' su postgres -c 'createdb gitlab_production'
fi fi
# Adjust database privileges # Adjust database privileges
@ -61,6 +62,30 @@ case "$1" in
echo "Running final rake tasks..." echo "Running final rake tasks..."
# Move these to rails-common # Move these to rails-common
. /usr/lib/gitlab/scripts/rake-tasks.sh . /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) abort-upgrade|abort-remove|abort-deconfigure)