Permalink
Browse files

Switch systemd service from forking to simple

Forego daemonization and pidfile writing within the cherryd server,
and lean more heavily on systemd capabilities.

This alleviates systemd's complaints about the pidfile not being
found, and allows the server user and group to be set in a more
obvious way.
  • Loading branch information...
lovett committed Nov 13, 2018
1 parent 6d6a2a6 commit bd01d0b177359eae8a4b1600fa13fdaced3725a2
Showing with 3 additions and 16 deletions.
  1. +3 −3 ansible/roles/application/files/medley.service
  2. +0 −2 medley.conf.example
  3. +0 −11 medley.py
@@ -7,13 +7,13 @@ After=network.target
StartLimitIntervalSec=0
[Service]
User=medley
Group=medley
WorkingDirectory=/srv/medley
ExecStart=/srv/medley/venv/bin/python medley.py
Type=forking
PIDFile=/var/run/medley.pid
Type=simple
# Try to restart automatically in case of trouble.
Restart=on-abnormal
@@ -7,8 +7,6 @@ engine.autoreload.on: True
log.screen: False
server.socket_host: "0.0.0.0"
server.socket_port: 8085
server.daemonize: True
server.pid: "/var/run/medley.pid"
tools.conditional_auth.on: False
tools.conditional_auth.whitelist: "192.168.0"
users: {"medley":"medley"}
@@ -143,17 +143,6 @@ def main():
app_config
)
# Attempt to drop privileges if daemonized
if cherrypy.config.get("server.daemonize"):
cherrypy.process.plugins.Daemonizer(cherrypy.engine).subscribe()
pid_file = cherrypy.config.get("server.pid")
if pid_file:
cherrypy.process.plugins.PIDFile(
cherrypy.engine,
pid_file
).subscribe()
# Plugins
plugins.applog.Plugin(cherrypy.engine).subscribe()
plugins.scheduler.Plugin(cherrypy.engine).subscribe()

0 comments on commit bd01d0b

Please sign in to comment.