1
0
mirror of https://github.com/etesync/server synced 2024-11-22 08:48:07 +00:00

Update to uvicorn

Simon Vandevelde 2020-12-29 19:28:27 +01:00
parent c21d9ca2c4
commit 6881f67c74

@ -1,12 +1,10 @@
Having to run Daphne manually is annoying and not maintainable.
Having to run uvicorn manually is annoying and not maintainable.
Instead, you should have `systemd` automatically start it at boot for you.
We can have `systemd` handle lauching Daphne by creating a unit file for it.
We can have `systemd` handle lauching uvicorn 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]
@ -14,12 +12,15 @@ Description=Execute the etebase server.
[Service]
WorkingDirectory=/path/to/etebase
ExecStart=/path/to/etebase/venv/bin/daphne -u /tmp/etebase_server.sock etebase_server.asgi:application
ExecStart=/path/to/etebase/venv/bin/uvicorn etebase_server.asgi:application --uds /tmp/etebase_server.sock
[Install]
WantedBy=multi-user.target
```
Note that we directly run the uvicorn which is located in our virtual environment (at `/path/to/etebase/venv`).
If your virtual environment is located elsewhere, be sure to update this.
Next, copy this to `/etc/systemd/system/`.
`systemd` should now be able to start it.
By also enabling it, it will launch at boot.