How to auto-start Girder using systemd?


#1

Dear all,

This is my first post on the Girder Discourse forum, so I will begin by greeting you all!

I have installed Girder on an Ubuntu 16.04 machine and was wondering if there is a way to auto-start -and auto-reload- Girder using systemd. I am able to auto-start apache2 and mongod using systemd, but I would like to do the same with Girder, to avoid having to reconnect and execute girder-serve manually every time.

I have followed Digital Ocean’s tutorial on systemd, which has been quite useful. I must admit that I am no expert in server configuration, so I apologise if my question is too basic.

Thanks in advance for your help!

Cheers,
Álvaro B.


#2

Welcome Álvaro,

This is an example systemd unit definition from our ansible role. You will need to change some values to match your installation.

[Unit]
Description=Girder
After=network.target

[Service]
User={{ girder_user }}
Group={{ girder_group }}
Restart=always
ExecStart={{ girder_virtualenv }}/bin/python -m girder

[Install]
WantedBy=multi-user.target

#3

Thanks Jonathan! Using your template I was able to make Girder start
automatically on my machine.

Cheers,
Álvaro B.