diff --git a/.env.example b/.env.example index 29dd395..a24af3a 100644 --- a/.env.example +++ b/.env.example @@ -1,5 +1,5 @@ # ─── uptop configuration ─────────────────────────────────── -# Copy to .env and edit. Only uncomment what you need. +# Export in your environment or pass via docker run --env-file.\n# Only uncomment what you need. # ─── Core ────────────────────────────────────────────────── UPTOP_PORT=23234 # SSH server port @@ -40,3 +40,5 @@ UPTOP_DB_DSN=/data/uptop.db # File path (SQLite) or connection string (Postgre # UPTOP_ALLOW_PRIVATE_TARGETS=false # Allow monitoring RFC1918/loopback addresses # UPTOP_METRICS_PUBLIC=false # Expose /metrics without auth # UPTOP_CORS_ORIGIN= # Access-Control-Allow-Origin for /status/json +# UPTOP_TRUSTED_PROXIES= # Comma-separated CIDRs/IPs for X-Forwarded-For trust +# UPTOP_MAINT_RETENTION=168h # How long ended maintenance windows are kept diff --git a/.gitea/issue_template/bug_report.yaml b/.gitea/issue_template/bug_report.yaml index 1aff83a..fcc82ad 100644 --- a/.gitea/issue_template/bug_report.yaml +++ b/.gitea/issue_template/bug_report.yaml @@ -16,7 +16,7 @@ body: label: What happened? description: Include what you expected to happen instead. placeholder: | - When I run `uptop serve`, the TUI crashes after 10 seconds. + When I run `uptop`, the TUI crashes after 10 seconds. I expected it to keep running and display monitor status. validations: required: true @@ -25,7 +25,7 @@ body: attributes: label: Steps to reproduce placeholder: | - 1. Run `uptop serve` + 1. Run `uptop` 2. Wait ~10 seconds 3. TUI crashes with panic validations: @@ -37,7 +37,7 @@ body: description: Output of `uptop version`, OS, terminal. Paste any errors below. render: shell placeholder: | - uptop version 2026.06.1 + uptop 0.1.0 (abc1234, 2026-06-17) OS: Debian 13 Terminal: Ghostty diff --git a/Dockerfile b/Dockerfile index aada010..40fdb00 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,14 +23,13 @@ RUN mkdir -p /data/.ssh && chown -R uptop:uptop /data COPY --from=builder /app/uptop . COPY --chmod=755 docker-entrypoint.sh /usr/local/bin/ -ENV LIPGLOSS_RENDERER_HAS_DARK_BACKGROUND=true ENV UPTOP_DB_TYPE=sqlite ENV UPTOP_DB_DSN=/data/uptop.db ENV UPTOP_KEYS=/data/authorized_keys ENV UPTOP_SSH_HOST_KEY=/data/.ssh/id_ed25519 ENV UPTOP_PORT=23234 -EXPOSE 23234 +EXPOSE 8080 23234 HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \ CMD wget -qO- http://localhost:8080/api/health || exit 1 USER uptop diff --git a/README.md b/README.md index aaadcc4..699c69b 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@
No browser. No client install. Just ssh -p 23234 your-server.
-
+
@@ -27,7 +27,7 @@ Canonical repo: [gitea.lerkolabs.com/lerkolabs/uptop](https://gitea.lerkolabs.co
- **10 alert providers** — Discord, Slack, Email, Ntfy, Webhook, Telegram, PagerDuty, Pushover, Gotify, Opsgenie
- **Config as code** — define monitors in YAML, apply declaratively, version control your setup
- **HA clustering** — leader/follower with automatic failover
-- **Prometheus metrics** — `/metrics` endpoint, wire it straight to Grafana
+- **Prometheus metrics** — `/metrics` endpoint (`UPTOP_METRICS_PUBLIC=true` to expose without auth)
- **Public status page** — HTML + JSON, toggle with an env var
- **SQLite or Postgres** — SQLite for single-node, Postgres for production
- **Uptime Kuma import** — migrate from Kuma with one command
@@ -146,6 +146,8 @@ Full reference in [docs/config-as-code.md](docs/config-as-code.md).
| `UPTOP_INSECURE_SKIP_VERIFY` | `false` | Skip TLS verification for checks |
| `UPTOP_ALLOW_PRIVATE_TARGETS` | `false` | Allow monitoring RFC1918/loopback addresses |
| `UPTOP_ADMIN_KEY` | | SSH public key seeded as first admin on startup |
+| `UPTOP_METRICS_PUBLIC` | `false` | Expose `/metrics` without auth |
+| `UPTOP_MAINT_RETENTION` | `168h` | How long ended maintenance windows are kept |
| `UPTOP_TRUSTED_PROXIES` | | Comma-separated CIDRs/IPs whose `X-Forwarded-For` is trusted ([details](#running-behind-a-reverse-proxy)) |
See [`.env.example`](.env.example) for all options including TLS, probes, and advanced settings.
@@ -179,7 +181,7 @@ uptop prunes its own history in the background — no external cleanup jobs need
| Check history | newest 1,000 checks per monitor |
| State changes (UP/DOWN transitions) | newest 5,000 per monitor |
| Logs | newest 200 entries |
-| Maintenance windows | 7 days after they end (configurable) |
+| Maintenance windows | 7 days after they end (`UPTOP_MAINT_RETENTION`) |
Sparklines, uptime percentages, and SLA reports are computed from these windows, so very long-horizon stats aren't retained. Export to Prometheus via `/metrics` if you need unlimited history.
diff --git a/cmd/uptop/main.go b/cmd/uptop/main.go
index fcaef41..9449382 100644
--- a/cmd/uptop/main.go
+++ b/cmd/uptop/main.go
@@ -77,17 +77,37 @@ func main() {
case "export":
runExport(os.Args[2:])
return
- case "version", "--version", "-v":
+ case "version", "--version", "-v", "-version":
printVersion()
return
case "migrate-secrets":
runMigrateSecrets(os.Args[2:])
return
+ case "help", "--help", "-h":
+ printUsage()
+ return
+ case "serve":
+ runServe(os.Args[2:])
+ return
}
}
runServe(os.Args[1:])
}
+func printUsage() {
+ fmt.Fprintf(os.Stderr, `Usage: uptop