diff --git a/debian/gitlab-debian.conf b/debian/gitlab-debian.conf new file mode 100644 index 0000000000..ab33ad871b --- /dev/null +++ b/debian/gitlab-debian.conf @@ -0,0 +1,7 @@ +export gitlab_user=gitlab +export gitlab_conf=/etc/gitlab.conf +export gitlab_home=/usr/share/gitlab +export gitlab_scripts=/usr/lib/gitlab/scripts +export gitlab_nginx_log=/var/log/gitlab +export gitlab_ssl_path=/etc/gitlab/ssl + diff --git a/debian/postinst b/debian/postinst new file mode 100755 index 0000000000..80c794d531 --- /dev/null +++ b/debian/postinst @@ -0,0 +1,59 @@ +#! /bin/sh +# postinst script for gitlab +# copied from postinst script for hplip +# $Id: hplip.postinst,v 1.1 2005/10/15 21:39:04 hmh Exp $ +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package +# +# quoting from the policy: +# Any necessary prompting should almost always be confined to the +# post-installation script, and should be protected with a conditional +# so that unnecessary prompting doesn't happen if a package's +# installation fails and the `postinst' is called with `abort-upgrade', +# `abort-remove' or `abort-deconfigure'. + + +case "$1" in + configure) + + . /etc/gitlab/gitlab-debian.conf + chown -R ${gitlab_user}: ${gitlab_home} + cd ${diaspora_home} + + echo "Setting up environment varibales..." + export RAILS_ENV=production + export DB=postgres + + echo "Verifying we have all required libraries..." + sudo -u diaspora -E bundle install --local + + echo "Running final rake tasks..." + # Move these to rails-common + #. /usr/lib/diaspora-common/scripts/rake-tasks.sh + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# + +exit 0 diff --git a/debian/rake-tasks.sh b/debian/rake-tasks.sh new file mode 100755 index 0000000000..832c224f72 --- /dev/null +++ b/debian/rake-tasks.sh @@ -0,0 +1,25 @@ +#! /bin/sh +# Read configuration values +. /etc/diaspora/diaspora-common.conf + +echo "Initializing database..." +su diaspora -s /bin/sh -c 'bundle exec rake db:create db:schema:load' +echo "Precompiling assets..." +su diaspora -s /bin/sh -c 'bundle exec rake assets:precompile' +su diaspora -s /bin/sh -c 'touch public/source.tar.gz' + +#Starting diaspora service... +invoke-rc.d diaspora start + +if grep https ${diaspora_conf} +then + mkdir -p ${diaspora_ssl_path} + echo "Copy $SERVERNAME-bundle.pem and $SERVERNAME.key to /etc/diaspora/ssl" + echo "And reload nginx, run # /etc/init.d/nginx reload" +fi + +echo "To stop diaspora, run # /etc/init.d/diaspora stop" +echo "To see the service status, run # /etc/init.d/diaspora status" +echo "To start diaspora service, run # /etc/init.d/diaspora start" + +echo "Visit your pod at $ENVIRONMENT_URL"