Make Sahana SPOC-compatible, cont'd

This commit is contained in:
Disassembler 2020-03-22 20:04:46 +01:00
parent b804987254
commit 9f8571f622
Signed by: Disassembler
GPG Key ID: 524BD33A0EE29499
3 changed files with 7 additions and 6 deletions

View File

@ -22,7 +22,7 @@
"sahana-postgres": { "sahana-postgres": {
"image": "postgis_3.0.0-200313", "image": "postgis_3.0.0-200313",
"mounts": { "mounts": {
"sahana/postgres_data": "/var/lib/postgresql" "sahana/postgres_data": "var/lib/postgresql"
} }
} }
} }

View File

@ -3,7 +3,7 @@ FROM alpine3.11-python3.8_3.8.2-200313
RUN EOF RUN EOF
# Install runtime dependencies # Install runtime dependencies
apk --no-cache add geos nginx py3-gdal py3-dateutil py3-lxml py3-numpy py3-pillow py3-psycopg2 py3-requests py3-sgmllib3k uwsgi-python3 apk --no-cache add geos nginx py3-dateutil py3-gdal py3-lxml py3-numpy py3-pillow py3-psycopg2 py3-requests py3-sgmllib3k uwsgi-python3
# Install build dependencies # Install build dependencies
apk --no-cache add --virtual .deps build-base freetype-dev git py3-numpy-dev py3-pip python3-dev ttf-dejavu apk --no-cache add --virtual .deps build-base freetype-dev git py3-numpy-dev py3-pip python3-dev ttf-dejavu
@ -25,6 +25,7 @@ RUN EOF
sed -i 's/^boto/#boto/' /srv/web2py/applications/eden/optional_requirements.txt # Needed for setup on AWS sed -i 's/^boto/#boto/' /srv/web2py/applications/eden/optional_requirements.txt # Needed for setup on AWS
sed -i 's/^PyRTF/#PyRTF/' /srv/web2py/applications/eden/optional_requirements.txt # Ceased to exist sed -i 's/^PyRTF/#PyRTF/' /srv/web2py/applications/eden/optional_requirements.txt # Ceased to exist
sed -i 's/^PyYAML/#PyYAML/' /srv/web2py/applications/eden/optional_requirements.txt # Needed for setup sed -i 's/^PyYAML/#PyYAML/' /srv/web2py/applications/eden/optional_requirements.txt # Needed for setup
sed -i 's/^openst/#openst/' /srv/web2py/applications/eden/optional_requirements.txt # Needed for setup on OpenStack
pip3 install -r /srv/web2py/applications/eden/optional_requirements.txt pip3 install -r /srv/web2py/applications/eden/optional_requirements.txt
pip3 install translate-toolkit pip3 install translate-toolkit

View File

@ -20,8 +20,8 @@ spoc-container start sahana-postgres
envsubst <createdb.sql | spoc-container exec sahana-postgres -- psql envsubst <createdb.sql | spoc-container exec sahana-postgres -- psql
# Prepare persistent directory structure # Prepare persistent directory structure
install -u 108080 -g 108080 -m 750 -d ${SAHANA_DATA}/databases install -o 108080 -g 108080 -m 750 -d ${SAHANA_DATA}/databases
install -u 108080 -g 108080 -m 750 -d ${SAHANA_DATA}/uploads install -o 108080 -g 108080 -m 750 -d ${SAHANA_DATA}/uploads
cp -rp ${LAYERS_DIR}/sahana_0.0.1-200313/srv/web2py/applications/eden/models ${SAHANA_CONF} cp -rp ${LAYERS_DIR}/sahana_0.0.1-200313/srv/web2py/applications/eden/models ${SAHANA_CONF}
# Copy Spotter template # Copy Spotter template
@ -33,8 +33,8 @@ export SAHANA_HMAC=$(head -c 18 /dev/urandom | base64 | tr -d '+/=')
export SAHANA_ADMIN_USER=admin@example.com export SAHANA_ADMIN_USER=admin@example.com
export SAHANA_ADMIN_PWD=$(head -c 12 /dev/urandom | base64 | tr -d '+/=') export SAHANA_ADMIN_PWD=$(head -c 12 /dev/urandom | base64 | tr -d '+/=')
envsubst <sahana_conf/000_config.py | install -o 108080 -g 108080 -m 640 /dev/stdin ${SAHANA_CONF}/000_config.py envsubst <sahana_conf/000_config.py | install -o 108080 -g 108080 -m 640 /dev/stdin ${SAHANA_CONF}/000_config.py
envsubst <sahana_data/Spotter/masterUsers.csv | install -o 108080 -g 108080 -m 640 /dev/stdin ${VOLUME_DIR}/sahana_data/Spotter/masterUsers.csv envsubst <sahana_data/Spotter/masterUsers.csv | install -o 108080 -g 108080 -m 640 /dev/stdin ${SAHANA_DATA}/Spotter/masterUsers.csv
| install -o 108080 -g 108080 -m 640 /dev/stdin sahana_conf/00_settings.py ${SAHANA_CONF}/00_settings.py install -o 108080 -g 108080 -m 640 sahana_conf/00_settings.py ${SAHANA_CONF}/00_settings.py
# Populate database # Populate database
spoc-container exec -u sahana sahana -- sh -c 'cd /srv/web2py; ./web2py.py -S eden -M -R applications/eden/static/scripts/tools/noop.py' spoc-container exec -u sahana sahana -- sh -c 'cd /srv/web2py; ./web2py.py -S eden -M -R applications/eden/static/scripts/tools/noop.py'