diff --git a/Run-uWSGI-at-boot.md b/Run-uWSGI-at-boot.md new file mode 100644 index 0000000..5e6e01f --- /dev/null +++ b/Run-uWSGI-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. + +``` +cp etesync_server.service /etc/systemd/system +sudo systemd start etesync_server +sudo systemd 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.