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
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

View file

@ -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.

33
debian/postinst vendored
View file

@ -28,6 +28,9 @@ set -e
case "$1" in
configure)
# 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
@ -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 '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
@ -61,6 +62,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)