provisioning/taskservs/webhook/default/webhook.service.j2

26 lines
1.3 KiB
Plaintext
Raw Permalink Normal View History

{%- if server %}
[Unit]
Description=Small server for creating HTTP endpoints (hooks)
Documentation=https://github.com/adnanh/webhook/
ConditionPathExists=/etc/webhook
[Service]
RestartSec=2s
Type=simple
User={{taskserv.webhook_user}}
Group={{taskserv.webhook_group}}
WorkingDirectory={{taskserv.webhook_home}}
Restart=always
Environment=USER={{taskserv.webhook_user}} HOME={{taskserv.webhook_home}}
{% if taskserv.webhook_ip == "$network_private_ip" and server.ip_addresses.priv %}
ExecStart=/usr/local/bin/webhook -nopanic -hooks /etc/webhook/{{taskserv.webhook_conf}} -ip {{server.ip_addresses.priv}} -port {{taskserv.webhook_port}} -logfile {{taskserv.webhook_logs_path}} -verbose -urlprefix hooks
{% elif taskserv.webhook_ip == "$network_public_ip" and server.ip_addresses.pub %}
ExecStart=/usr/local/bin/webhook -nopanic -hooks /etc/webhook/{{taskserv.webhook_conf}} -ip {{server.ip_addresses.pub}} -port {{taskserv.webhook_port}} -logfile {{taskserv.webhook_logs_path}} -verbose -urlprefix hooks
{% else %}
ExecStart=/usr/local/bin/webhook -nopanic -hooks /etc/webhook/{{taskserv.webhook_conf}} -ip {{taskserv.webhook.ip}} -port {{taskserv.webhook_port}} -logfile {{taskserv.webhook_logs_path}} -verbose -urlprefix hooks
{% endif %}
[Install]
WantedBy=multi-user.target
{%- endif %}