NS8 - Starting/Stopping Apps

Hoping it is useful to someone, as per some of the comments on the forum wondering how can be done, so we learn together (as long as it’s not implemented on cluster-admin side).

Usually there shall be no need for this, but if you have a reason to temporarily stop a specific app service or the whole app, here are some details.

Rootless Apps

Identify services ran by an app:
An easy way is to check the “Services” section on the status page of the app.
image

Control each service run by a rootless app:

runagent -m <moduleid> systemctl --user [status|start|stop|restart|try-reload-or-restart|(enable|disable --now)] <servicename>

Worth mentioning that services can depend upon other ones, so stopping one can lead to another app service to stop working until the required services are started (in some cases you have to restart all of them). Service start order can matter as well.

Examples:

# Avoid when possible. Must be use with caution because restarting Traefik might generate too much Acme requests, which leads to the API rate limit cap (thanks for the info to Davidep)
runagent -m traefik1 systemctl restart --user traefik.service
runagent -m nextcloud1 systemctl --user try-reload-or-restart nextcloud nextcloud-{redis,db,app,nginx}
# sftpgo will remain disabled even after a server reboot
runagent -m webserver1 systemctl --user disable --now sftpgo
runagent -m webserver1 systemctl --user enable sftpgo
runagent -m webserver1 systemctl --user start phpfpm@8.3 nginx sftpgo webserver

On the other hand, to control the status of a rootless app as a whole:

systemctl [status|start|stop|restart|try-reload-or-restart] user@$(id -u <moduleid>)

NOTE: This will cause warnings and errors when accessing the App configuration on cluster-admin. Service shall need to be restarted to be able to configure an App properly.

Examples:

systemctl stop user@$(id -u dokuwiki2)
systemctl try-reload-or-restart user@$(id -u nextcloud1)
systemctl restart user@$(id -u webserver1)

Rootful Apps

systemctl [status|start|stop|restart|try-reload-or-restart] <moduleid>

Example:

systemctl stop netdata1

  • There can be some services which cannot be disabled.
  • Most rootless apps have their own user account and /home folder.
  • Take note of orignal service status
  • If unsure of consequences, first try it on a disposable VM.
  • If you notice some inaccuracy, anything else worth mentioning or that needs and extra warning, please comment on it or edit the howto.
6 Likes

Thanks for your explainations, much appreciated!

And as a spoiled kid, I wish there were simply a few buttons next to the apps doing exactly that…

:slight_smile:

4 Likes