Use new installer feature from packager.io

Postinstall for openproject is now in its own addon at https://github.com/pkgr/addon-openproject.
This commit is contained in:
Cyril Rohr
2014-10-08 08:32:55 +00:00
parent 4a409d9b98
commit fe072de37a
5 changed files with 25 additions and 98 deletions
+13 -10
View File
@@ -5,18 +5,21 @@ targets:
build_dependencies:
- libmagickwand-dev
- libsqlite3-dev
dependencies:
- debconf
- memcached
fedora-20:
build_dependencies:
- ImageMagick-devel
before_precompile: "packaging/setup"
after_install: "packaging/debian/postinst"
addons:
- mysql
- apache2
- svn-dav
- smtp
crons:
- packaging/cron/openproject-clear-old-sessions
- packaging/cron/openproject-create-svn-repositories
services:
- postgres
installer: true
wizards:
- https://github.com/pkgr/addon-mysql.git#installer
- https://github.com/pkgr/addon-apache2.git#installer
- https://github.com/pkgr/addon-svn-dav.git#installer
- https://github.com/pkgr/addon-smtp.git#installer
- https://github.com/pkgr/addon-memcached.git#installer
- https://github.com/pkgr/addon-openproject.git#installer
buildpack: https://github.com/ddollar/heroku-buildpack-multi.git
-75
View File
@@ -1,75 +0,0 @@
#!/bin/sh
set -e
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <postinst> `abort-remove'
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
APP_NAME="_APP_NAME_"
CLI="${APP_NAME}"
APP_USER=$(${CLI} config:get APP_USER)
APP_GROUP=$(${CLI} config:get APP_GROUP)
# source debconf library
. /usr/share/debconf/confmodule
case "$1" in
configure)
# create attachments folder
attachments_path=$(${CLI} config:get ATTACHMENTS_STORAGE_PATH || echo "/var/db/${APP_NAME}/files")
mkdir -p "${attachments_path}"
chown ${APP_USER}.${APP_GROUP} "${attachments_path}"
${CLI} config:set ATTACHMENTS_STORAGE_PATH="${attachments_path}"
# set web concurrency
web_concurrency=$(${CLI} config:get WEB_CONCURRENCY || echo "2")
${CLI} config:set WEB_CONCURRENCY=${web_concurrency}
# set web timeout
web_timeout=$(${CLI} config:get WEB_TIMEOUT || echo "15")
${CLI} config:set WEB_TIMEOUT=${web_timeout}
# set SECRET_TOKEN env variable
secret_token=$(${CLI} config:get SECRET_TOKEN || ${CLI} run rake -s secret | tail -1)
${CLI} config:set SECRET_TOKEN="$secret_token"
# migrate
rake_commands="db:migrate db:seed"
${CLI} run rake ${rake_commands} || true
sys_api_key=$(${CLI} config:get SYS_API_KEY)
# set various settings
db_get ${APP_NAME}/server/hostname
if [ -z "$RET" ]; then web_hostname=$(hostname -f); else web_hostname="$RET"; fi
db_get ${APP_NAME}/server/ssl
if [ "$RET" = "true" ]; then web_protocol="https"; else web_protocol="http"; fi
${CLI} run rake setting:set[host_name=${web_hostname},protocol=${web_protocol},sys_api_enabled=1,sys_api_key=${sys_api_key}] 1>/dev/null
# scale
${CLI} scale web=1 worker=1 || true
# let the admin reboot when he's ready
;;
abort-upgrade|abort-remove|abort-deconfigure)
exit 0
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
+3 -3
View File
@@ -17,10 +17,10 @@ else
log_ko "MySQL connection is NOT working"
fi
if /etc/init.d/apache2 status &>/dev/null; then
log_ok "Apache2 is running"
if ps -u "$SERVER_USER" &>/dev/null ; then
log_ok "Web server is running"
else
log_ko "Apache2 is NOT running"
log_ko "Web server is NOT running"
fi
if ps -u "$APP_USER" -f | grep -q "unicorn worker" ; then
+9 -6
View File
@@ -2,14 +2,18 @@
APP_NAME="_APP_NAME_"
CLI="${APP_NAME}"
SVN_REPOSITORIES=$(${CLI} config:get SVN_REPOSITORIES)
APP_HOME="$(${CLI} config:get APP_HOME)"
SVN_REPOSITORIES="$(${CLI} config:get SVN_REPOSITORIES)"
PORT=$(${CLI} config:get PORT)
SYS_API_KEY=$(${CLI} config:get SYS_API_KEY)
APP_GROUP=$(${CLI} config:get APP_GROUP)
SYS_API_KEY="$(${CLI} config:get SYS_API_KEY)"
APP_GROUP="$(${CLI} config:get APP_GROUP)"
SERVER_USER="$(${CLI} config:get SERVER_USER)"
SERVER_HOSTNAME="$(${CLI} config:get SERVER_HOSTNAME)"
SERVER_PROTOCOL="$(${CLI} config:get SERVER_PROTOCOL)"
/opt/${APP_NAME}/bin/ruby /opt/${APP_NAME}/extra/svn/reposman.rb \
${APP_HOME}/bin/ruby ${APP_HOME}/extra/svn/reposman.rb \
--openproject-host "http://127.0.0.1:${PORT}" \
--owner "www-data" \
--owner "${SERVER_USER}" \
--group "${APP_GROUP}" \
--public-mode '2750' \
--private-mode '2750' \
@@ -18,4 +22,3 @@ APP_GROUP=$(${CLI} config:get APP_GROUP)
--key "${SYS_API_KEY}" \
--scm Subversion \
--verbose
-4
View File
@@ -1,9 +1,5 @@
#!/usr/bin/env bash
# we need postgresql for asset precompilation
# see: https://packager.io/documentation
sudo service postgresql start
cp -f packaging/conf/configuration.yml config/configuration.yml
sed -i "s|config.serve_static_assets = false|config.serve_static_assets = true|" config/environments/production.rb