Trying Openedoo on self-hosted server, running as systemd service

openedoo logo

Openedoo is open source platform for education that is built with python flask.

This article will guide you to setup openedoo on self-hosted deployment server. It will cover how to run Openedoo as systemd service. The server uses Debian 8.6, and openedoo.antaraksi.com as demo.

Openedoo Project Setup

:~$ virtualenv openedoo.antaraksi.com
:~$ cd openedoo.antaraksi.com && source bin/activate
:~$ pip install openedoo
:~$ openedoo install

Run as systemd service

To make starting and stopping openedoo easy, we can use systemd. It can help openedoo restart automatically on script crash too.

:-$ sudo nano /etc/systemd/system/openedoo.service

Write the service script inside

[Unit] 
Description=Openedoo command line
After=network.target

[Service]
User=www-data
Group=www-data
WorkingDirectory=/home/dwi/openedoo.antaraksi.com/openedoo_project
Environment="PATH=/home/dwi/openedoo.antaraksi.com/bin"
ExecStart=/home/dwi/openedoo.antaraksi.com/bin/python /home/dwi/openedoo.antaraksi.com/openedoo_project/manage.py run -h 0.0.0.0 -p 2367
Restart=always
RestartSec=3

[Install]
Wantedby=multi-user.target

(Configure with your own environment setup) Save and close. Then reload the systemd daemon.

:-$ sudo systemctl daemon-reload

Now, you can start/stop openedoo with

:-$ sudo systemctl start openedoo
:-$ sudo systemctl stop openedoo
:-$ sudo systemctl restart openedoo

Note:

I use custom port because my server port 5000 is blocked.

ExecStart=/home/dwi/openedoo.antaraksi.com/bin/python /home/dwi/openedoo.antaraksi.com/openedoo_project/manage.py run -h 0.0.0.0 -p 2367