{# Copyright (C) 2011-2017 Etherpad Contributors <https://etherpad.org/>
 # Copyright (C) 2014-2017 Maciej Delmanowski <drybjed@gmail.com>
 # Copyright (C) 2015      Hartmut Goebel <h.goebel@crazy-compilers.com>
 # Copyright (C) 2015      Robin Schneider <ypid@riseup.net>
 # Copyright (C) 2014-2017 DebOps <https://debops.org/>
 # SPDX-License-Identifier: Apache-2.0
 # Source: https://github.com/ether/etherpad-lite/wiki/How-to-deploy-Etherpad-Lite-as-a-service
 #}
# {{ ansible_managed }}

[Unit]
Description=Etherpad-lite, the collaborative editor.
After=syslog.target network-online.target mysql.service postgresql.service
Conflicts=shutdown.target

[Service]
Type=simple
User={{ etherpad_user }}
Group={{ etherpad_group }}
WorkingDirectory={{ etherpad_home + "/" + etherpad_repository }}
ExecStart=/usr/bin/nodejs {{ etherpad_home + "/" + etherpad_repository }}/node_modules/ep_etherpad-lite/node/server.js
Restart=always
{% if etherpad_log_to_file is defined and etherpad_log_to_file %}
StandardOutput=append:{{ etherpad_log_dir }}/production.log
StandardError=inherit
{% endif %}

[Install]
WantedBy=multi-user.target
