#!/sbin/openrc-run

description="Sigmah docker container"

depend() {
	need docker postfix postgres
}

start() {
	/usr/bin/docker run -d --rm \
	--name sigmah \
	-h sigmah \
	--link postfix \
	--link postgres \
	-v /srv/sigmah/data:/srv/sigmah/data \
	-v /srv/sigmah/conf/persistence.xml:/srv/tomcat/webapps/sigmah/WEB-INF/classes/META-INF/persistence.xml \
	-v /srv/sigmah/conf/sigmah.properties:/srv/tomcat/webapps/sigmah/WEB-INF/classes/sigmah.properties \
	sigmah
}

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

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

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