Skip to content

Operations Runbook

This document is based on the Enterprise New offline application.

  1. Run the following commands from the deployment package root directory:
    Terminal window
    ./bin/verify.sh --site config/site.conf
    ./bin/smoke-business-emqx.sh --site config/site.conf
  2. Confirm the following items:
    • The 3 Swarm nodes are Ready.
    • APP VIP /healthz and /readyz return 200.
    • DB VIP:5432 is accessible.
    • The PostgreSQL primary, standby, and witness topology is normal.
    • backend, redis, emqx, sourceflow, eventflow, marimo, and opcua-server are all running on the active application node.
  1. Run the following commands on the active application node:

    Terminal window
    cd /opt/tier0-enterprise/tier0-deploy
    bash bin/compose.sh ps
    bash bin/compose.sh logs --tail=200 backend
    curl -fsS http://127.0.0.1:8088/healthz
    curl -fsS http://127.0.0.1:8088/readyz
  2. Health-check interpretation:

    • healthz failure: check the backend process, image, and container logs first.
    • readyz failure: also check DB VIP, Redis, and database migration logs.
    • Home page reachable but login unavailable: confirm ADMIN_INITIAL_PASSWORD in .env, then check backend IAM migration logs and user tables. Do not judge deployment success only from the HTTP port.
Terminal window
nc -vz <APP_VIP> 1883
nc -vz <APP_VIP> 8883
nc -vz <APP_VIP> 8083
nc -vz <APP_VIP> 8084
nc -vz <APP_VIP> 4840

Run the following on database nodes:

Terminal window
systemctl status tier0-postgresql
systemctl status tier0-repmgrd
sudo -iu postgres psql -Atqc 'select pg_is_in_recovery();'
sudo -iu postgres /usr/local/bin/repmgr -f /etc/repmgr.conf cluster show
  • pg_is_in_recovery=false means primary.
  • pg_is_in_recovery=true means standby.
  • DB VIP must only be located on the current primary.
  • If standby replication is interrupted or the witness reports upstream errors, preserve the site first. Do not rerun the full deployment directly.
  1. Before testing, record the node that currently owns the VIP and verify:

    Terminal window
    curl -fsS http://<APP_VIP>/healthz
    curl -fsS http://<APP_VIP>/readyz
  2. After stopping keepalived on the current VIP node, confirm VIP takeover on another application node, then retest both URLs. The HAProxy backend points to the active application node on 8088/TCP, so all three application nodes must be able to reach port 8088 on the active node.

  3. After restoring keepalived, run verify.sh and smoke checks again. Do not stop active application containers during the drill.

Before a failure drill, create a backup and confirm replication is healthy:

Terminal window
./bin/backup-db.sh --site config/site.conf

After stopping tier0-postgresql on the current primary, observe repmgr promoting the standby and DB VIP takeover. The target RTO is within 2 minutes. Historical tests on the same architecture were about 59-64 seconds.

  • Backup:

    Terminal window
    ./bin/backup-db.sh --site config/site.conf
  • Restore:

    Terminal window
    ./bin/restore-db.sh --site config/site.conf --restore-file /backup/tier0-db/postgres-YYYYmmddTHHMMSS.dump
Terminal window
./full-cleanup.sh --env install.env --yes
./install.sh --auto --yes
Terminal window
cd /opt/tier0-enterprise/tier0-deploy
bash bin/compose.sh logs --tail=300 backend
bash bin/compose.sh ps
Terminal window
cd /opt/tier0-enterprise/tier0-deploy
bash bin/compose.sh logs --tail=200 emqx
Terminal window
systemctl status tier0-repmgrd
tail -100 /var/log/repmgr/repmgr.log
sudo -iu postgres psql -Atqc 'show shared_preload_libraries;'
Terminal window
./bin/verify-materials.sh