#!/sbin/openrc-run

description="OpenDataKit docker container"

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

start_pre() {
	/srv/opendatakit/update-ip.sh
}

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

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