From db5e3a4021707fc0a4acd40d547e857a1574b925 Mon Sep 17 00:00:00 2001 From: Simon Vandevelde Date: Sun, 27 Sep 2020 14:00:25 +0200 Subject: [PATCH] Clone v1 page --- Run-Daphne-at-boot.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Run-Daphne-at-boot.md diff --git a/Run-Daphne-at-boot.md b/Run-Daphne-at-boot.md new file mode 100644 index 0000000..ec3cac4 --- /dev/null +++ b/Run-Daphne-at-boot.md @@ -0,0 +1,31 @@ +Having to run uWSGI 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. + +``` +[Unit] +Description=Execute the etesync server. + +[Service] +ExecStart=/usr/local/bin/uwsgi --ini /path/to/server-skeleton/uwsgi.ini + +[Install] +WantedBy=multi-user.target +``` + +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 +``` + +Check to see if it worked! +If it didn't work, use the command `sudo systemd status etesync_server` to see what went wrong.