Spotter-VM/lxc-apps/taarifa/install.sh

22 lines
828 B
Bash
Raw Normal View History

#!/bin/sh
set -ev
# Volumes
MONGODB_DATA="${VOLUMES_DIR}/taarifa/mongodb_data"
# Create MongoDB directory structure
install -o 100101 -g 100101 -m 700 -d ${MONGODB_DATA}
# TODO: Create MongoDB admin and secure the instance
# Populate database
spoc-container start taarifa-mongodb
spoc-container exec taarifa -- sh -c 'cd /srv/taarifa; MONGO_URI=mongodb://taarifa-mongodb/taarifa python manage.py create_facility'
spoc-container exec taarifa -- sh -c 'cd /srv/taarifa; MONGO_URI=mongodb://taarifa-mongodb/taarifa python manage.py create_service'
spoc-container exec taarifa -- sh -c 'cd /srv/taarifa; MONGO_URI=mongodb://taarifa-mongodb/taarifa python manage.py upload_waterpoints demodata.csv'
# Stop services required for setup
spoc-container stop taarifa-mongodb
# Register application
vmmgr register-app taarifa taarifa