#!/bin/sh
set -ev

# Start service containers
spoc-container start pandora-postgres
spoc-container start pandora-rabbitmq

# Run database migration
spoc-container exec pandora -- /srv/pandora/pandora/manage.py migrate --noinput
spoc-container exec pandora -- /srv/pandora/pandora/manage.py sqlfindindex
spoc-container exec pandora -- /srv/pandora/pandora/manage.py sync_itemsort
spoc-container exec pandora -- /srv/pandora/pandora/manage.py sync_documentsort

# Stop service containers
spoc-container stop pandora-rabbitmq
spoc-container stop pandora-postgres
