How to safely shutdown NextCloud and GitLab VMs running on XCP-ng

There are some very sprecific instructions on how to safely shut down a computer that is running active live services such as NextCloud and GitLab, where there may be many users actively connected, interacting with services and files on these systems.

In our case, we are running these two virtual machines with minimal number of users, however it could well be tht the systems are in the process doing some sort of maintenance or simply having a clearour. For this reason, we should take a first order safety proceedure and here it is;

For Gitlab – there is a built in shutdown command that stops vairous services and database activities

$ gitlab-stl shutdown

For NextCloud…. I am not sure of any specific command but there is a way of logging in to web portal and placing the system into Maintenance Mode.

Now. I am not sure if we were to power down our NC server after placing it in Maintenance Mode, how easy it is to get it out of Maintence Mode from a rebooted unit state. Will the web UI come back up. Will it still be in MM? I am not sure…

I have found the following simple CLI command to work. It shuts down services running the OS and then I can power-down the VM from XCP-ng Manager app; I have used this method several times and I have been able to boot it up later and it all seems to come back alive – as desired.

$ sudo halt..

Apr 2021 Mattias2 Jun 2017

** How to shutdown NextcloudPi without Risk of data loss **

Is there any risk of data loss (database corruption), when I shutdown a NextcloudPi Server the hard way (Power down)?

If yes, what is the graceful and data safe way to shutdown a NextcloudPi Server?

  • just the command ‘sudo shutdown -h’
  • using somehow nextcloud occ command console to put Nextcloud server first in maintance mode prior to shutdown command? If yes how?
  • something else ?

nachoparkerNextcloudPi developer

Jun 2017

In any computer there is ALWAYS risk of data loss if you just power down, as you already suspect.

The Raspberry Pi is no different, or maybe even worse because doing that is a recipe for SD card corruption.

Always sudo halt

That is enough to orderly shutdown your database, web server and everything else 🙂

Originally published here

Leave a Reply