2020-03-07 19:37:10 +00:00
|
|
|
[Unit]
|
|
|
|
|
Description=Mistborn Syncthing Service
|
|
|
|
|
Requires=Mistborn-base.service
|
|
|
|
|
After=Mistborn-base.service
|
|
|
|
|
|
|
|
|
|
[Service]
|
|
|
|
|
Restart=always
|
|
|
|
|
User=root
|
|
|
|
|
Group=docker
|
|
|
|
|
PermissionsStartOnly=true
|
|
|
|
|
# Shutdown container (if running) when unit is stopped
|
|
|
|
|
ExecStartPre=/usr/local/bin/docker-compose -f /opt/mistborn/extra/syncthing.yml down
|
2020-03-10 03:07:36 +00:00
|
|
|
|
2020-03-07 19:37:10 +00:00
|
|
|
ExecStartPre=/sbin/iptables -I DOCKER-USER -i DIFACE -p udp --dport 21027 -j MISTBORN_LOG_DROP
|
|
|
|
|
ExecStartPre=/sbin/iptables -I DOCKER-USER -i DIFACE -p tcp --dport 22000 -j MISTBORN_LOG_DROP
|
|
|
|
|
# Start container when unit is started
|
|
|
|
|
ExecStart=/usr/local/bin/docker-compose -f /opt/mistborn/extra/syncthing.yml up --build
|
|
|
|
|
# Stop container when unit is stopped
|
|
|
|
|
ExecStop=/usr/local/bin/docker-compose -f /opt/mistborn/extra/syncthing.yml down
|
|
|
|
|
# Post stop
|
2020-03-24 19:15:47 +00:00
|
|
|
ExecStopPost=-/sbin/iptables -D DOCKER-USER -i DIFACE -p udp --dport 21027 -j MISTBORN_LOG_DROP
|
|
|
|
|
ExecStopPost=-/sbin/iptables -D DOCKER-USER -i DIFACE -p tcp --dport 22000 -j MISTBORN_LOG_DROP
|
2020-03-07 19:37:10 +00:00
|
|
|
|
|
|
|
|
[Install]
|
|
|
|
|
WantedBy=multi-user.target
|