diff --git a/Run-Daphne-at-boot.md b/Run-uvicorn-at-boot.md similarity index 69% rename from Run-Daphne-at-boot.md rename to Run-uvicorn-at-boot.md index 661ed81..d092a40 100644 --- a/Run-Daphne-at-boot.md +++ b/Run-uvicorn-at-boot.md @@ -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.