From b7d4e95a396238b28d1db2acee900287913154c4 Mon Sep 17 00:00:00 2001 From: Simon Vandevelde Date: Sun, 27 Sep 2020 14:54:10 +0200 Subject: [PATCH] Update to Etebase and Daphne --- Run-Daphne-at-boot.md | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/Run-Daphne-at-boot.md b/Run-Daphne-at-boot.md index ec3cac4..6c12134 100644 --- a/Run-Daphne-at-boot.md +++ b/Run-Daphne-at-boot.md @@ -1,30 +1,33 @@ -Having to run uWSGI manually is annoying and not maintainable. +Having to run Daphne manually is annoying and not maintainable. Instead, you should have `systemd` automatically start it at boot for you. -We can have `systemd` handle lauching uWSGI by creating a unit file for it. -Create a new file called `etesync_server.service` and paste in the following. -Don't forget to set the correct path to your installation. -If you don't use a `.ini` file, pass flags here to your uWSGI. +We can have `systemd` handle lauching Daphne by creating a unit file for it. +Create a new file called `etebase_server.service` and paste in the following. +Don't forget to set the correct path to your installation and to your venv. + +Note that we directly run the Daphne which is located in our virtual environment (at `/path/to/etebase/venv`). +If your virtual environment is located elsewhere, be sure to update this. ``` [Unit] -Description=Execute the etesync server. +Description=Execute the etebase server. [Service] -ExecStart=/usr/local/bin/uwsgi --ini /path/to/server-skeleton/uwsgi.ini +WorkingDirectory=/path/to/etebase +ExecStart=/path/to/etebase/venv/bin/daphne -u /tmp/etebase_server.sock etebase_server.asgi:application [Install] WantedBy=multi-user.target ``` -Next, copy this to `/etc/systemd/system`. +Next, copy this to `/etc/systemd/system/`. `systemd` should now be able to start it. By also enabling it, it will launch at boot. ``` -sudo cp etesync_server.service /etc/systemd/system -sudo systemctl start etesync_server -sudo systemctl enable etesync_server +$ sudo cp etesync_server.service /etc/systemd/system +$ sudo systemctl start etesync_server +$ sudo systemctl enable etesync_server ``` Check to see if it worked!