Skip to content
Discussion options

You must be logged in to vote

I've actually just been playing with this myself, and was about to add documentation on how to serve with systemd.

Do you have a reverse proxy? We highly recommend using a reverse proxy, at which point it is recommended to use a Unix socket for the application.

It should then look roughly along the lines of:

# /etc/systemd/system/myapp.socket
[Unit]
Description=myapp HTTP socket

[Socket]
ListenStream=/run/myapp/http.sock
SocketGroup=www-data
SocketMode=0660

[Install]
WantedBy=sockets.target
# /etc/systemd/system/myapp.service
[Unit]
Description=myapp
Requires=myapp.socket

[Service]
User=myapp
ExecStart=python -m myapp
Restart=on-failure

[Install]
WantedBy=multi-user.target
# myapp/__m…

Replies: 3 comments 4 replies

This comment was marked as low quality.

This comment was marked as low quality.

Comment options

You must be logged in to vote
4 replies
@Lonami
Comment options

@Lonami
Comment options

@Dreamsorcerer
Comment options

@Dreamsorcerer
Comment options

Answer selected by Lonami
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants