Allow to parametrize Sahana Demo template deployment
This commit is contained in:
parent
1d3b7b9d8b
commit
7f0190e6ab
@ -1,6 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
SOURCE_DIR=$(realpath $(dirname "${0}"))/sahana-demo
|
||||
export TEMPLATE=${TEMPLATE:-"default"}
|
||||
|
||||
# Check prerequisites
|
||||
docker image ls | grep -q postfix || $(realpath $(dirname "${0}"))/postfix.sh
|
||||
@ -12,10 +13,10 @@ export SAHANADEMO_PWD=$(head -c 18 /dev/urandom | base64)
|
||||
envsubst <${SOURCE_DIR}/createdb.sql | docker exec -i postgres psql
|
||||
|
||||
# Prepare persistent directory structure
|
||||
mkdir -p /srv/sahana-demo/conf /srv/sahana-demo/data/databases /srv/sahana-demo/data/uploads /srv/sahana-demo/data/default
|
||||
mkdir -p /srv/sahana-demo/conf /srv/sahana-demo/data/databases /srv/sahana-demo/data/uploads /srv/sahana-demo/data/${TEMPLATE}
|
||||
chown -R 8001:8001 /srv/sahana-demo/conf /srv/sahana-demo/data
|
||||
docker run --rm -v /srv/sahana-demo/conf:/mnt/conf sahana cp -rp /srv/web2py/applications/eden/models/. /mnt/conf
|
||||
docker run --rm -v /srv/sahana-demo/data/default:/mnt/data sahana cp -rp /srv/web2py/applications/eden/modules/templates/default/. /mnt/data
|
||||
docker run --rm -v /srv/sahana-demo/data/${TEMPLATE}:/mnt/data sahana cp -rp /srv/web2py/applications/eden/modules/templates/${TEMPLATE}/. /mnt/data
|
||||
|
||||
# Configure Sahana
|
||||
export SAHANADEMO_HMAC=$(head -c 18 /dev/urandom | base64)
|
||||
@ -30,7 +31,8 @@ docker run --rm -h sahana-demo --link postgres -v /srv/sahana-demo/conf:/srv/web
|
||||
rm /tmp/masterUsers.csv
|
||||
|
||||
# Create Sahana service
|
||||
cp ${SOURCE_DIR}/etc/init.d/sahana-demo /etc/init.d/sahana-demo
|
||||
envsubst <${SOURCE_DIR}/etc/init.d/sahana-demo >/etc/init.d/sahana-demo
|
||||
chmod +x /etc/init.d/sahana-demo
|
||||
rc-update add sahana-demo
|
||||
service sahana-demo start
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/sbin/openrc-run
|
||||
|
||||
description="Sahana Eden Development docker container"
|
||||
description="Sahana Eden Demo docker container"
|
||||
|
||||
depend() {
|
||||
need docker net postgres
|
||||
@ -19,7 +19,7 @@ start() {
|
||||
--link postgres \
|
||||
-p 127.0.0.1:8098:8001 \
|
||||
-v /srv/sahana-demo/conf:/srv/web2py/applications/eden/models \
|
||||
-v /srv/sahana-demo/data/default:/srv/web2py/applications/eden/modules/templates/default \
|
||||
-v /srv/sahana-demo/data/${TEMPLATE}:/srv/web2py/applications/eden/modules/templates/${TEMPLATE} \
|
||||
-v /srv/sahana-demo/data/databases:/srv/web2py/applications/eden/databases \
|
||||
-v /srv/sahana-demo/data/uploads:/srv/web2py/applications/eden/uploads \
|
||||
sahana
|
||||
|
@ -23,7 +23,7 @@ FINISHED_EDITING_CONFIG_FILE = True
|
||||
# - Workflows
|
||||
# - Theme
|
||||
# - note that you should restart your web2py after changing this setting
|
||||
settings.base.template = "default"
|
||||
settings.base.template = "${TEMPLATE}"
|
||||
|
||||
# Database settings
|
||||
# Uncomment to use a different database, other than sqlite
|
||||
@ -236,7 +236,7 @@ settings.import_template()
|
||||
# e.g.
|
||||
#settings.base.system_name = T("Sahana TEST")
|
||||
#settings.base.prepopulate = ("MY_TEMPLATE_ONLY")
|
||||
settings.base.prepopulate += ("default", "default/users")
|
||||
settings.base.prepopulate += ("${TEMPLATE}", "default/users")
|
||||
#settings.base.theme = "default"
|
||||
#settings.L10n.default_language = "en"
|
||||
#settings.security.policy = 7 # Organisation-ACLs
|
||||
|
Loading…
Reference in New Issue
Block a user