Self-Hosted Operations
Self-Hosted Operations¶
This page covers day-2 operations of a deployment installed with install.sh
(Connected installation). The install directory is
/opt/huitzo unless you passed --prefix, and the compose project is
huitzo-customer. Run the commands below from the install directory, or add
--project-directory /opt/huitzo to each docker compose call.
| Service | Role |
|---|---|
backend |
API, sign-in, license verification. Not published on the host. |
worker (2 replicas) |
Runs Pack commands |
beat |
Schedules periodic work; exactly one |
dashboard |
Web interface on 127.0.0.1:3000; forwards /api/ and /health to the backend |
caddy |
HTTPS on ports 80 and 443 (https profile only) |
postgres, redis |
Database and queue, never published outside the host |
migrate |
One-shot: database migrations and the runtime role password |
backup |
Encrypted, signed database backups and huitzo-db (releases with Hub-managed backups); never published |
Service management¶
# pseudocode: from /opt/huitzo
docker compose ps # state and health of every service
docker compose restart backend worker # restart services
docker compose stop # stop everything, keep containers and data
docker compose start # start the stopped services again
docker stats # live CPU and memory per container
Never run docker compose down -v: it deletes the data volumes. Every service
restarts by itself after a host reboot (restart: unless-stopped); after a
manual stop, docker compose start brings the same containers back. If the
containers were removed (docker compose down), re-run the installed
/opt/huitzo/install.sh with no flags: it recreates them in the order the
first-admin and HTTPS steps rely on, and needs no registry credentials while
the verified images are still on the host.
Health checks¶
# pseudocode
curl -s https://<host>/health # status, version, license status; 503 if the database is unreachable
curl -s https://<host>/health/integrations # per-integration health (LLM, HTTP, email)
curl -s https://<host>/api/v1/setup/status # readiness: database, migrations, Redis, beat, license, file storage
None of these needs sign-in, and they answer even when the license has
stopped the platform. Monitor /health and the ready flag of setup/status
from your monitoring system, and the free disk space of the host. Metrics for
Prometheus are on Observability.
Logs¶
# pseudocode
docker compose logs -f # all services, follow
docker compose logs --tail=200 backend # one service
docker compose logs --since=1h worker
Every service logs to Docker's json-file driver with rotation built into the
compose file (10 MB per file, 5 files per container), so container logs cannot
fill the disk. To ship logs to a central system, point your collector at the
Docker logs of the huitzo-customer project.
Database migrations¶
install.sh runs the migrations on every install and upgrade through the
one-shot migrate service: alembic upgrade head, then it sets the runtime
database role's password from .env. To run it by hand, for example after
restoring a database dump:
# pseudocode: from /opt/huitzo
docker compose run --rm migrate # apply pending migrations, set the role password
docker compose run --rm migrate python -m alembic current # show the current revision
Migrations only move forward. Going back to an older release means restoring a backup taken before the upgrade (Roll back).
Database maintenance¶
# pseudocode: from /opt/huitzo
docker compose exec postgres pg_isready -U huitzo
docker compose exec postgres psql -U huitzo -d huitzo -c "SELECT pg_size_pretty(pg_database_size('huitzo'));"
docker compose exec postgres psql -U huitzo -d huitzo -c "VACUUM ANALYZE;"
PostgreSQL's autovacuum runs by default; a manual VACUUM ANALYZE helps after a
large deletion. Run logs are kept 90 days. Plan disk growth with
Disk planning.
Cache and queue¶
Redis holds the task queue and caches. It requires the password from .env
(HUITZO_REDIS_PASSWORD):
# pseudocode: from /opt/huitzo
docker compose exec redis sh -c 'REDISCLI_AUTH="$HUITZO_REDIS_PASSWORD" redis-cli ping'
docker compose exec redis sh -c 'REDISCLI_AUTH="$HUITZO_REDIS_PASSWORD" redis-cli info memory'
Do not flush Redis on a running deployment: it holds queued work.
Backup and restore¶
Database backups are managed by the Hub's backup service
(Backups): encrypted to your age recipients
before they touch the disk, signed, checked as they are written, and listed on
/admin/backups. Turn the schedule on there; .env sets the retention floors
and the encryption recipients.
# pseudocode: from /opt/huitzo
docker compose exec -T backup huitzo-db db-backup-list # catalog and states
docker compose exec -T backup huitzo-db db-backup-create --trigger manual
docker compose exec -T backup huitzo-db db-backup-verify <id> # checksum + signature
/opt/huitzo/backup.sh --output /mnt/backups # database backup + files and volumes
Every backup is refused until HUITZO_BACKUP_AGE_RECIPIENTS holds an age
public key created off the host
(Quick start: turn on backups).
backup.sh still archives the files, volumes, .env and the license; its
--db-only mode takes a Hub database backup and nothing else. Run the full
backup.sh daily and before every upgrade, for example from cron:
# pseudocode: /etc/cron.d/huitzo-backup
0 2 * * * huitzo-admin /opt/huitzo/backup.sh --output /mnt/backups
- Keep the age private key off this host. Without it no backup can be
restored; without
.env, encrypted data such as stored API keys cannot be recovered. - Backups stay on this host unless you copy them (Copying backups off the host). Losing the host without a copy loses every backup.
huitzo-dbis the command inside thebackupservice. The images are compiled, sopython -mforms do not work; use the commands as shown.- Restore with
huitzo-db db-restore <id> --prepare, then--applywith the decrypted backup on its input, both in the run-onlybackup-restoreservice (Restore). It checks the signature, checksum, deployment ID and versions first, and signs every user out afterwards. Test a restore on a separate host before go-live. Restoring the database and thehuitzo-license-datavolume keeps the deployment ID, so the license stays valid (Deployment ID on restore).
Updates and upgrades¶
An upgrade installs a newer release with its own install.sh, after a backup
and the pre-run check of the new assets. docker compose pull is not an upgrade
path: the compose file pins every image by digest. The full sequence, and the
rollback, are on Upgrade.
# pseudocode
curl -s https://<host>/health # "version" is the installed release
License management¶
The license is license/license.json in the install directory.
- Status: the dashboard's admin settings license card, or
GET https://<host>/api/v1/setup/statuswithout sign-in (Check status). - Renew: request the renewal in the partner portal at least 30 days before
expiry, then install the new file with
huitzo license installorinstall.sh --license(Renew). - Reload:
POST /api/v1/license/reloadwith an admin or owner token applies a new file without a restart (Reload).
Licensing works offline: the platform never contacts a Huitzo license server.
Pack management¶
Packs are managed through the API, from a machine with the Huitzo CLI logged in to the deployment. Publishing registers a pack and installs its build server-side; there is no pack directory to copy files into.
# pseudocode
huitzo login --url https://<host> --email [email protected]
huitzo pack publish # publish a pack, or a new version of one
huitzo pack list # the packs your tenant can see
huitzo pack delete my-pack # delete a pack with all its versions (owner or admin, developer mode)
Packs that install Python dependencies need outbound access to PyPI (Outbound HTTPS).
Troubleshooting¶
| Symptom | Check | Fix |
|---|---|---|
A service is unhealthy or restarting |
docker compose ps, then docker compose logs --tail=200 <service> |
Fix the cause the log names; docker compose restart <service> |
backend does not start, log mentions the license |
curl -s https://<host>/api/v1/setup/status |
License troubleshooting |
backend does not start, log mentions the database |
docker compose exec postgres pg_isready -U huitzo; docker compose logs postgres |
Check disk space and the HUITZO_DB_SUPERUSER_PASSWORD and HUITZO_DB_APP_PASSWORD in .env (roles); then docker compose run --rm migrate |
| Commands stay queued | docker compose logs worker; the beat check in setup/status |
docker compose restart worker beat; check Redis with ping above |
| A Studio mission shows no progress for a long time | docker compose logs worker \| grep studio_mission_stalled |
The Mission Steward logs every stalled mission with its class and what it did. HUITZO_STUDIO_STEWARD_REMEDIATE=false makes it detect-only, HUITZO_STUDIO_STEWARD_ENABLED=false turns it off (Studio settings) |
setup/status reports beat not ok |
docker compose ps beat; docker compose logs beat |
docker compose restart beat; keep exactly one beat |
| Sign-in fails for every user with 402 | The license is INVALID | Renew, then restart the backend and workers |
| The browser shows a certificate error | docker compose logs caddy |
Check DNS, port 80 reachability for Let's Encrypt, or your own certificate files (HTTPS profile) |
| Disk almost full | df -h; docker system df |
Move backups off the host; docker image prune removes images of earlier releases |
| High memory use | docker stats |
Each service is capped (Container limits); size the host above the sum for production |
For anything this page does not cover, contact your Huitzo partner contact or [email protected]. Report security vulnerabilities to [email protected].