Add Sahana + SAMBRO IP refresh script

This commit is contained in:
Disassembler 2018-02-06 09:56:17 +01:00
parent c44951bc72
commit 0a152eb534
No known key found for this signature in database
GPG Key ID: 524BD33A0EE29499
8 changed files with 20 additions and 2 deletions

View File

@ -26,6 +26,7 @@ chown -R 8001:8001 /srv/sahana/data
export SAHANA_HMAC=$(head -c 18 /dev/urandom | base64)
envsubst <${SOURCE_DIR}/srv/sahana/conf/000_config.py >/srv/sahana/conf/000_config.py
cp ${SOURCE_DIR}/srv/sahana/conf/00_settings.py /srv/sahana/conf/00_settings.py
cp ${SOURCE_DIR}/srv/sahana/update-ip.sh /srv/sahana/update-ip.sh
export SAHANA_ADMIN_USER=admin@example.com
export SAHANA_ADMIN_PWD=$(head -c 12 /dev/urandom | base64)
envsubst <${SOURCE_DIR}/srv/sahana/data/Spotter/masterUsers.csv >/srv/sahana/data/Spotter/masterUsers.csv

View File

@ -7,6 +7,10 @@ depend() {
use dns logger netmount postfix
}
start_pre() {
/srv/sahana/update-ip.sh
}
start() {
/usr/bin/docker run -d --rm \
--name sahana \

View File

@ -50,7 +50,7 @@ settings.gis.spatialdb = True
#settings.base.system_name = T("Sahana Eden Humanitarian Management Platform")
#settings.base.system_name_short = T("Sahana Eden")
# Set this to the Public URL of the instance
#settings.base.public_url = "http://127.0.0.1:8000"
settings.base.public_url = "http://127.0.0.1"
# Switch to "False" in Production for a Performance gain
# (need to set to "True" again when Table definitions are changed)

4
sahana/srv/sahana/update-ip.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
URL=$(ip route get 1 | awk '{print $NF;exit}')
sed -i "s|^settings\.base\.public_url.*|settings.base.public_url = \"https://${URL}:8401\"|" /srv/sahana/conf/000_config.py

View File

@ -20,6 +20,7 @@ docker run --rm -v /srv/sambro/data/SAMBRO:/mnt/data sahana cp -rp /srv/web2py/a
# Configure SAMBRO
export SAMBRO_HMAC=$(head -c 18 /dev/urandom | base64)
envsubst <${SOURCE_DIR}/srv/sambro/conf/000_config.py >/srv/sambro/conf/000_config.py
cp ${SOURCE_DIR}/srv/sambro/update-ip.sh /srv/sambro/update-ip.sh
cp ${SOURCE_DIR}/srv/sambro/conf/00_settings.py /srv/sambro/conf/00_settings.py
cp ${SOURCE_DIR}/srv/sambro/data/SAMBRO/config.py /srv/sambro/data/SAMBRO/config.py
export SAMBRO_ADMIN_USER=admin@example.com

View File

@ -7,6 +7,10 @@ depend() {
use dns logger netmount postfix
}
start_pre() {
/srv/sambro/update-ip.sh
}
start() {
/usr/bin/docker run -d --rm \
--name sambro \

View File

@ -50,7 +50,7 @@ settings.gis.spatialdb = True
#settings.base.system_name = T("Sahana Eden Humanitarian Management Platform")
#settings.base.system_name_short = T("Sahana Eden")
# Set this to the Public URL of the instance
#settings.base.public_url = "http://127.0.0.1:8000"
settings.base.public_url = "http://127.0.0.1"
# Switch to "False" in Production for a Performance gain
# (need to set to "True" again when Table definitions are changed)

4
sambro/srv/sambro/update-ip.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
URL=$(ip route get 1 | awk '{print $NF;exit}')
sed -i "s|^settings\.base\.public_url.*|settings.base.public_url = \"https://${URL}:8499\"|" /srv/sambro/conf/000_config.py