Bash automation scripts for common agentic-hosting operations. All scripts read configuration from environment variables.
export AH_URL="https://<your-domain>" # ah API base URL
export AH_KEY="keyid.secret" # Your API keyFor local dev:
export AH_URL="http://localhost:8080"| Script | Description |
|---|---|
register.sh |
Register a new tenant and save credentials |
deploy.sh |
Deploy a service from git URL or Docker image |
status.sh |
Show status of all services and databases |
logs.sh |
Stream build logs for a service |
db-provision.sh |
Provision a database and wire it to a service |
health-check.sh |
Cron-friendly health check with webhook alerting |
chmod +x scripts/*.sh
# Register (one-time, needs bootstrap token)
AH_BOOTSTRAP_TOKEN=<token> ./scripts/register.sh my-tenant me@example.com
# Deploy from git
./scripts/deploy.sh https://github.com/org/repo my-app 3000
# Deploy from Docker image
./scripts/deploy.sh nginx:alpine my-site 80
# Check status
./scripts/status.sh
# Stream build logs
./scripts/logs.sh my-app
# Provision Postgres and wire to service
./scripts/db-provision.sh my-app postgres
# Provision Redis and wire to service
./scripts/db-provision.sh my-app redishealth-check.sh performs five checks and exits 0 on success or 1 on failure. On failure it POSTs a machine-readable JSON payload to the configured webhook URL.
- Health API --
GET /v1/system/healthreturns{"status":"ok"} - systemd service --
systemctl is-active ahshowsactive - Infrastructure containers --
docker pscontainspaas-traefikandpaas-registry - Disk usage -- checks both the ah state dir and Docker data dir, warns at 80%, fails at 90% (configurable)
- Public HTTPS -- base domain returns 2xx/3xx (if
AH_BASE_DOMAINis set)
| Variable | Required | Default | Description |
|---|---|---|---|
ALERT_WEBHOOK_URL |
Yes (unless --dry-run) |
-- | POST endpoint for failure alerts |
AH_API_PORT |
No | 8080 |
Local health API port |
AH_SERVICE_NAME |
No | ah |
systemd service name |
AH_BASE_DOMAIN |
No | -- | Public domain to probe via HTTPS |
AH_DATA_DIR |
No | /var/lib/ah |
ah state data dir to monitor for disk usage |
AH_DOCKER_DATA_DIR |
No | /var/lib/docker |
Docker data dir to monitor for disk usage |
AH_DISK_WARN_PCT |
No | 80 |
Disk usage warning threshold (%) |
AH_DISK_FAIL_PCT |
No | 90 |
Disk usage failure threshold (%) |
Run every 5 minutes (adjust to taste):
*/5 * * * * ALERT_WEBHOOK_URL="https://hooks.example.com/alert" AH_BASE_DOMAIN="agentic.hosting" /opt/agentic-hosting/scripts/health-check.sh >> /var/log/ah-health.log 2>&1Or with all options:
*/5 * * * * ALERT_WEBHOOK_URL="https://hooks.example.com/alert" AH_API_PORT=8080 AH_SERVICE_NAME=ah AH_BASE_DOMAIN="agentic.hosting" AH_DATA_DIR="/var/lib/ah" AH_DOCKER_DATA_DIR="/var/lib/docker" AH_DISK_WARN_PCT=80 AH_DISK_FAIL_PCT=90 /opt/agentic-hosting/scripts/health-check.sh >> /var/log/ah-health.log 2>&1Test locally without firing the webhook:
./scripts/health-check.sh --dry-runThis runs all checks and prints what would be sent to the webhook, but does not actually POST.
On failure the script sends a JSON POST body:
{
"event": "health_check_failed",
"hostname": "prod-01",
"timestamp": "2026-03-20T12:00:00Z",
"failure_count": 1,
"warning_count": 0,
"failures": ["Health API returned HTTP 000 (expected 200)"],
"warnings": []
}