diff --git a/README.lwsws.md b/README.lwsws.md index 82227fdf..28cf5c14 100644 --- a/README.lwsws.md +++ b/README.lwsws.md @@ -310,3 +310,49 @@ And map the provided HTML into the vhost in the mounts section You might choose to put it on its own vhost which has "interface": "lo", so it's not externally visible. + +Integration with Systemd +------------------------ + +lwsws needs a service file like this as `/usr/lib/systemd/system/lwsws.service` + +``` +[Unit] +Description=Libwebsockets Web Server +After=syslog.target + +[Service] +ExecStart=/usr/local/bin/lwsws +StandardError=null + +[Install] +WantedBy=multi-user.target + +``` + +You can find this prepared in `./lwsws/usr-lib-systemd-system-lwsws.service` + + +Integration with logrotate +-------------------------- + +For correct operation with logrotate, `/etc/logrotate.d/lwsws` (if that's +where we're putting the logs) should contain + +``` +/var/log/lwsws/*log { + copytruncate + missingok + notifempty + delaycompress +} +``` + +You can find this prepared in `/lwsws/etc-logrotate.d-lwsws` + +Prepare the log directory like this + +``` +sudo mkdir /var/log/lwsws +sudo chmod 700 /var/log/lwsws +``` diff --git a/lwsws/etc-logrotate.d-lwsws b/lwsws/etc-logrotate.d-lwsws new file mode 100644 index 00000000..cc92a9ac --- /dev/null +++ b/lwsws/etc-logrotate.d-lwsws @@ -0,0 +1,10 @@ +/var/log/lwsws/*log { + copytruncate + missingok + notifempty + delaycompress + postrotate + /bin/systemctl reload lwsws.service > /dev/null 2>/dev/null || true + endscript +} + diff --git a/lwsws/usr-lib-systemd-system-lwsws.service b/lwsws/usr-lib-systemd-system-lwsws.service new file mode 100644 index 00000000..dfa36de3 --- /dev/null +++ b/lwsws/usr-lib-systemd-system-lwsws.service @@ -0,0 +1,11 @@ +[Unit] +Description=Libwebsockets Web Server +After=syslog.target + +[Service] +ExecStart=/usr/local/bin/lwsws +StandardError=null + +[Install] +WantedBy=multi-user.target +