#!/sbin/openrc-run

description="OpenDataKit Aggregate docker container"

depend() {
	need docker postfix postgres
}

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

start_post() {
	/usr/bin/vmmgr register-proxy opendatakit
}

stop_pre() {
	/usr/bin/vmmgr unregister-proxy opendatakit
}

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