Last active
March 10, 2018 20:26
-
-
Save metachris/03d1cc47df7cddfbc4009d5249bdfc6c to your computer and use it in GitHub Desktop.
Systemd config for python api-server setup. See also https://github.com/CityOfZion/neo-python/blob/development/api-server.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Systemd service config file for pyapi, to run as user 'node', group 'node' and in `/server/neo-python` | |
# https://www.freedesktop.org/software/systemd/man/systemd.exec.html | |
# | |
# Instructions: | |
# 1. Adapt this file if and as needed (directories, user, group) | |
# 2. Save this file in /etc/systemd/system/pyapi.service | |
# 3. Enable the service with `systemctl enable pyapi` | |
# | |
# Now you can use systemctl to check status, start stop and restart the service: | |
# `systemctl status|start|stop|restart pyapi` | |
# | |
# Watch the stdout/stderr output with journald: `journalctl -f -u pyapi` | |
# | |
# Notes | |
# * The name `pyapi` is used because this is defined in SyslogIdentifier. | |
# * If you change the config file, you need to run `systemctl daemon-reload` | |
# | |
After=network-online.target | |
Requires=network-online.target | |
[Service] | |
WorkingDirectory=/server/neo-python | |
ExecStart=/server/neo-python/venv/bin/python /server/neo-python/api-server.py --mainnet --port-rpc 10332 --port-rest 8080 --logfile /server/neo-python/api-server.log | |
ExecStop=/bin/kill `cat /tmp/neopython-api-server.pid` | |
Restart=always | |
StandardOutput=syslog | |
StandardError=syslog | |
SyslogIdentifier=pyapi | |
User=node | |
Group=node | |
[Install] | |
WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment