#!/sbin/openrc-run

description="OpenDataKit Aggregate docker container"

depend() {
	need docker net postgres
	use dns logger netmount postfix
}

start() {
	/usr/bin/docker run -d --rm \
	--name odk \
	-h odk \
	--link postfix \
	--link postgres \
	-v /srv/odk/conf/server.xml:/srv/tomcat/conf/server.xml \
	-v /srv/odk/conf/jdbc.properties:/srv/tomcat/webapps/aggregate/WEB-INF/classes/jdbc.properties \
	-v /srv/odk/conf/security.properties:/srv/tomcat/webapps/aggregate/WEB-INF/classes/security.properties \
	odk
}

start_post() {
	/usr/local/bin/spotter-appmgr update-proxy odk
}

stop() {
	/usr/bin/docker stop odk
}
