VPS Host Maintenance Shutdown: Difference between revisions

From VoIPmonitor.org
(Add guide for VPS host maintenance shutdown procedure)
 
(Rewrite: streamlined structure, reduced verbosity, simplified diagram)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{DISPLAYTITLE:VPS Host Maintenance - Shutdown Procedure}}
{{DISPLAYTITLE:VPS Host Maintenance - Shutdown Procedure}}
[[Category:Administration]]
[[Category:Administration]]
[[Category:Troubleshooting]]


'''This guide explains how to perform a planned graceful shutdown of a VoIPmonitor VPS from the HOST system for hardware maintenance. This is different from stopping the VoIPmonitor service from within the VPS (see [[Systemd_for_voipmonitor_service_management|Systemd Service Management]] for that procedure).'''
'''Guide for gracefully shutting down a VoIPmonitor VPS from the HOST system for planned hardware maintenance.'''


{{Note|1=This guide assumes VoIPmonitor is running inside an LXC container on a SolusVM-managed hypervisor. If you are stopping the VoIPmonitor service only (not the entire VPS), use <code>systemctl stop voipmonitor</code> inside the VPS instead.}}
{{Note|1=This applies to LXC containers on SolusVM hypervisors. For stopping only the VoIPmonitor service (not the VPS), use <code>systemctl stop voipmonitor</code> inside the VPS - see [[Systemd_for_voipmonitor_service_management|Systemd Service Management]].}}


== Overview: Service-Level vs. VPS-Level Shutdowns ==
== Overview ==


{| class="wikitable"
{| class="wikitable"
|-
|-
! Scenario !! What You Shutdown !! Commands Used !! Documentation
! Scenario !! Commands !! Documentation
|-
|-
| '''Stop VoIPmonitor application only''' || VoIPmonitor service inside VPS || <code>systemctl stop voipmonitor</code> (from within VPS) || [[Systemd_for_voipmonitor_service_management|Systemd Service Management]]
| Stop VoIPmonitor service only || <code>systemctl stop voipmonitor</code> (inside VPS) || [[Systemd_for_voipmonitor_service_management|Systemd Service Management]]
|-
|-
| '''Shut down entire VPS for maintenance''' || LXC container from host system || <code>lxc-stop</code>, <code>sw vps-detach</code>, <code>sw vps-start</code> (from HOST) || This guide
| Shutdown entire VPS for maintenance || <code>lxc-stop</code>, <code>sw vps-detach/attach/start</code> (from HOST) || This guide
|}
|}
<kroki lang="mermaid">
%%{init: {'flowchart': {'nodeSpacing': 15, 'rankSpacing': 30}}}%%
flowchart LR
    A[Stop MySQL] --> B[lxc-stop] --> C[sw vps-detach] --> D[Maintenance] --> E[sw vps-attach] --> F[sw vps-start] --> G[Start MySQL]
</kroki>


== Prerequisites ==
== Prerequisites ==


* SSH access to the HOST system (not the VPS)
* SSH root access to the HOST system (not the VPS)
* Root or sudo access on the HOST
* SolusVM tools (<code>sw</code>) and LXC tools installed
* SolusVM hypervisor commands (<code>sw</code>) available
* VPS container name (e.g., <code>sipMON</code>)
* LXC tools installed on host
* The VPS container name (e.g., <code>sipMON</code>)
 
== Graceful Shutdown Procedure for Planned Hardware Maintenance ==
 
Follow these steps from the HOST system to stop a VoIPmonitor VPS cluster for planned hardware maintenance:


=== Step 1: Stop the Database Service on the Host ===
== Shutdown Procedure ==


Stop the MySQL/MariaDB service running on the host system before stopping the VPS container.
=== Step 1: Stop MySQL on Host ===


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
# Stop MySQL/MariaDB on the HOST
service mysql stop
service mysql stop
 
ps ax | grep mysqld   # Verify stopped
# Verify it is stopped
ps ax | grep mysqld
</syntaxhighlight>
</syntaxhighlight>


{{Tip|1=If MySQL is running on a different host (not the same server as the VPS), skip this step and stop MySQL on the correct host.}}
{{Tip|1=Skip if MySQL runs on a different host.}}
 
=== Step 2: Stop the VPS Container ===


Stop the LXC container hosting VoIPmonitor using the container name.
=== Step 2: Stop and Detach the VPS ===


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
# Stop the VPS container
# Stop LXC container
lxc-stop -n sipMON
lxc-stop -n sipMON


# Verify it is stopped
# Detach from SolusVM
lxc-ls -f
</syntaxhighlight>
 
Replace <code>sipMON</code> with your actual VPS container name.
 
=== Step 3: Detach the VPS (SolusVM) ===
 
Detach the VPS from SolusVM using the <code>sw</code> command before proceeding with hardware maintenance.
 
<syntaxhighlight lang="bash">
# Detach the VPS
sw vps-detach -n sipMON
sw vps-detach -n sipMON
</syntaxhighlight>
</syntaxhighlight>


{{Warning|1=The VPS must be fully stopped before detaching. Do not proceed with <code>vps-detach</code> if <code>lxc-stop</code> returned errors.}}
{{Warning|1=Wait for <code>lxc-stop</code> to complete before running <code>vps-detach</code>.}}
 
=== Step 4: Perform Hardware Maintenance ===


At this point, you can safely perform hardware maintenance on the host system (e.g., replacing drives, upgrading RAM, power maintenance).
=== Step 3: Perform Hardware Maintenance ===


=== Step 5: Re-attach and Start the VPS (Post-Maintenance) ===
Proceed with hardware work (drive replacement, RAM upgrade, etc.).


After hardware maintenance is complete, start the VPS back up in the correct order:
== Startup Procedure ==


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
# Re-attach the VPS to SolusVM
# Re-attach and start VPS
sw vps-attach -n sipMON
sw vps-attach -n sipMON
# Start the VPS container
sw vps-start -n sipMON
sw vps-start -n sipMON


# Verify the VPS is running
# Verify running
lxc-ls -f
lxc-ls -f
# Start MySQL on host
service mysql start
</syntaxhighlight>
</syntaxhighlight>


{{Note|1=VoIPmonitor inside the VPS will start automatically if systemd is configured with <code>systemctl enable voipmonitor</code>. See [[Systemd_for_voipmonitor_service_management|Systemd Service Management]] for details.}}
{{Note|1=VoIPmonitor starts automatically if <code>systemctl enable voipmonitor</code> was configured. Any buffered SQL queries (<code>qoq</code> files) will be processed automatically.}}
 
== Verification Steps ==


After bringing the VPS back online, verify that everything is operational:
== Verification ==


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
# 1. Check VPS status
# Check VPS status
lxc-ls -f
lxc-ls -f


# 2. Start MySQL on host (if applicable)
# SSH into VPS and verify VoIPmonitor
service mysql start
 
# 3. Verify VoIPmonitor is running inside VPS
# SSH into the VPS:
ssh root@<VPS_IP>
ssh root@<VPS_IP>
systemctl status voipmonitor
systemctl status voipmonitor


# 4. Check for SQL queue backlog in the GUI
# Monitor SQL queue in GUI: Settings Sensors Status
# Navigate to Settings -> Sensors -> Status
# Wait for SQLq to return to 0
# Monitor SQLq until it returns to 0
</syntaxhighlight>
</syntaxhighlight>
{{Note|1=Any buffered SQL queries (<code>qoq</code> files in <code>/var/spool/voipmonitor</code>) will be automatically processed when the sensor starts. This may temporarily increase the SQL queue in the GUI.}}


== Troubleshooting ==
== Troubleshooting ==


=== VPS Will Not Stop ===
=== Container Unreachable After Host Power Cycle ===


If <code>lxc-stop</code> fails or hangs:
Run the full stop/detach/attach/start sequence:


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
# Force stop (last resort)
lxc-stop -n <container_name>
lxc-stop -n sipMON -k
sw vps-detach -n <container_name>
 
sw vps-attach -n <container_name>
# Or kill LXC processes directly
sw vps-start -n <container_name>
lxc-kill -n sipMON
</syntaxhighlight>
</syntaxhighlight>


=== MySQL Will Not Stop ===
{{Note|1=Allow each SolusVM command to complete before proceeding to the next.}}


If MySQL fails to stop:
=== VPS Will Not Stop ===


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
# Check for active connections
# Force stop (last resort)
netstat -tunap | grep :3306
lxc-stop -n sipMON -k
 
# Force stop if necessary (ensuring VoIPmonitor VPS is stopped first)
service mysql stop
pkill mysqld
</syntaxhighlight>
</syntaxhighlight>
{{Warning|1=Always stop VoIPmonitor VPS BEFORE stopping MySQL if they are on separate hosts, or use systemd dependency (see [[Systemd_for_voipmonitor_service_management|Systemd Service Management]]).}}


=== VPS Does Not Start After Re-attach ===
=== VPS Does Not Start After Re-attach ===
If the VPS fails to start after <code>vps-attach</code>:


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
# Check SolusVM logs
# Check logs
tail -f /var/log/solusvm.log
tail -f /var/log/solusvm.log
# Check LXC logs
tail -f /var/log/lxc/sipMON.log
tail -f /var/log/lxc/sipMON.log


# Manually start with LXC
# Manual start with foreground output
lxc-start -n sipMON -F
lxc-start -n sipMON -F
</syntaxhighlight>
</syntaxhighlight>
Line 159: Line 121:
== AI Summary for RAG ==
== AI Summary for RAG ==


'''Summary:''' This guide documents the host-level procedure for gracefully shutting down a VoIPmonitor VPS for planned hardware maintenance when the application runs inside an LXC container on a SolusVM hypervisor. The workflow from the HOST system includes: (1) stopping MySQL with <code>service mysql stop</code> and verifying with <code>ps ax|grep mysqld</code>, (2) stopping the VPS container using <code>lxc-stop -n <container_name></code>, (3) detaching from SolusVM with <code>sw vps-detach -n <container_name></code>, performing hardware maintenance, then (4) re-attaching with <code>sw vps-attach -n <container_name></code> and starting with <code>sw vps-start -n <container_name></code>. This procedure differs from service-level shutdown (<code>systemctl stop voipmonitor</code> inside VPS) which is documented separately. Post-start verification includes checking VPS status, starting MySQL on host, and monitoring SQL queue backlog in GUI as buffered qoq files are processed.
'''Summary:''' Host-level procedure for gracefully shutting down a VoIPmonitor VPS running in an LXC container on SolusVM hypervisor. Shutdown sequence from HOST: (1) <code>service mysql stop</code>, (2) <code>lxc-stop -n <name></code>, (3) <code>sw vps-detach -n <name></code>. Startup sequence: (1) <code>sw vps-attach -n <name></code>, (2) <code>sw vps-start -n <name></code>, (3) <code>service mysql start</code>. For unplanned host power cycles where container becomes unreachable, use the same stop/detach/attach/start sequence. Verify with <code>lxc-ls -f</code> and monitor SQL queue in GUI.


'''Keywords:''' VPS shutdown, host maintenance, LXC container, SolusVM, lxc-stop, lxc-start, sw vps-detach, sw vps-attach, sw vps-start, hardware maintenance, mysql stop, container management, hypervisor, graceful shutdown
'''Keywords:''' VPS shutdown, host maintenance, LXC container, SolusVM, lxc-stop, lxc-start, sw vps-detach, sw vps-attach, sw vps-start, hardware maintenance, mysql stop, graceful shutdown, host power cycle


'''Key Questions:'''
'''Key Questions:'''
* How do I shut down a VoIPmonitor VPS from the host system for hardware maintenance?
* How do I shut down a VoIPmonitor VPS from the host system?
* What is the difference between stopping the VoIPmonitor service and stopping the VPS container?
* What is the correct order for stopping VPS and MySQL?
* What SolusVM commands are used to stop and start a VPS for maintenance?
* How do I recover an LXC container unreachable after host power cycle?
* Should I stop MySQL before stopping the VPS container in a SolusVM environment?
* What SolusVM commands are used for VPS maintenance?
* How do I verify the VPS is stopped before performing hardware maintenance?
* How do I verify VoIPmonitor is running after VPS restart?
* What order should I follow when starting the VPS back up after maintenance?
* How do I detach and re-attach a VPS using SolusVM commands?
* What should I check after bringing the VPS back online?

Latest revision as of 16:47, 8 January 2026


Guide for gracefully shutting down a VoIPmonitor VPS from the HOST system for planned hardware maintenance.

ℹ️ Note: This applies to LXC containers on SolusVM hypervisors. For stopping only the VoIPmonitor service (not the VPS), use systemctl stop voipmonitor inside the VPS - see Systemd Service Management.

Overview

Scenario Commands Documentation
Stop VoIPmonitor service only systemctl stop voipmonitor (inside VPS) Systemd Service Management
Shutdown entire VPS for maintenance lxc-stop, sw vps-detach/attach/start (from HOST) This guide

Prerequisites

  • SSH root access to the HOST system (not the VPS)
  • SolusVM tools (sw) and LXC tools installed
  • VPS container name (e.g., sipMON)

Shutdown Procedure

Step 1: Stop MySQL on Host

service mysql stop
ps ax | grep mysqld   # Verify stopped

💡 Tip: Skip if MySQL runs on a different host.

Step 2: Stop and Detach the VPS

# Stop LXC container
lxc-stop -n sipMON

# Detach from SolusVM
sw vps-detach -n sipMON

⚠️ Warning: Wait for lxc-stop to complete before running vps-detach.

Step 3: Perform Hardware Maintenance

Proceed with hardware work (drive replacement, RAM upgrade, etc.).

Startup Procedure

# Re-attach and start VPS
sw vps-attach -n sipMON
sw vps-start -n sipMON

# Verify running
lxc-ls -f

# Start MySQL on host
service mysql start

ℹ️ Note: VoIPmonitor starts automatically if systemctl enable voipmonitor was configured. Any buffered SQL queries (qoq files) will be processed automatically.

Verification

# Check VPS status
lxc-ls -f

# SSH into VPS and verify VoIPmonitor
ssh root@<VPS_IP>
systemctl status voipmonitor

# Monitor SQL queue in GUI: Settings → Sensors → Status
# Wait for SQLq to return to 0

Troubleshooting

Container Unreachable After Host Power Cycle

Run the full stop/detach/attach/start sequence:

lxc-stop -n <container_name>
sw vps-detach -n <container_name>
sw vps-attach -n <container_name>
sw vps-start -n <container_name>

ℹ️ Note: Allow each SolusVM command to complete before proceeding to the next.

VPS Will Not Stop

# Force stop (last resort)
lxc-stop -n sipMON -k

VPS Does Not Start After Re-attach

# Check logs
tail -f /var/log/solusvm.log
tail -f /var/log/lxc/sipMON.log

# Manual start with foreground output
lxc-start -n sipMON -F

AI Summary for RAG

Summary: Host-level procedure for gracefully shutting down a VoIPmonitor VPS running in an LXC container on SolusVM hypervisor. Shutdown sequence from HOST: (1) service mysql stop, (2) lxc-stop -n <name>, (3) sw vps-detach -n <name>. Startup sequence: (1) sw vps-attach -n <name>, (2) sw vps-start -n <name>, (3) service mysql start. For unplanned host power cycles where container becomes unreachable, use the same stop/detach/attach/start sequence. Verify with lxc-ls -f and monitor SQL queue in GUI.

Keywords: VPS shutdown, host maintenance, LXC container, SolusVM, lxc-stop, lxc-start, sw vps-detach, sw vps-attach, sw vps-start, hardware maintenance, mysql stop, graceful shutdown, host power cycle

Key Questions:

  • How do I shut down a VoIPmonitor VPS from the host system?
  • What is the correct order for stopping VPS and MySQL?
  • How do I recover an LXC container unreachable after host power cycle?
  • What SolusVM commands are used for VPS maintenance?
  • How do I verify VoIPmonitor is running after VPS restart?