Implement Monlet MVP stack and UI updates

This commit is contained in:
Stanislav Rossovskii
2026-05-27 10:01:59 +04:00
parent dcea096327
commit edc51e9c59
145 changed files with 15618 additions and 248 deletions

View File

@@ -1,15 +1,75 @@
# Deploy
Deployment examples live here.
Local stack and example operator configs.
Planned files:
## Quick start
- Docker Compose for local development;
- PostgreSQL service;
- optional Prometheus scrape config;
- optional Alertmanager config;
- optional Grafana dashboard stub.
```sh
cd deploy
MONLET_AUTH_TOKEN=$(openssl rand -hex 16) docker compose up --build
```
No production-ready deployment files are implemented in Stage 0.
Brings up: PostgreSQL 16, Monlet server (with Alembic upgrade on start), Web UI.
Docker examples must not install Python, Node, or Go project dependencies on the host. Dependency installation belongs inside images/containers or repo-local development directories.
- Server: http://127.0.0.1:8000 (`/api/v1/health`, `/api/v1/ready`, `/metrics`)
- Web UI: http://127.0.0.1:3000
- PostgreSQL: 127.0.0.1:5432, db `monlet`, user `monlet`
Add Prometheus + Alertmanager + Grafana:
```sh
MONLET_AUTH_TOKEN=$(openssl rand -hex 16) docker compose --profile observability up
```
- Prometheus: http://127.0.0.1:9090
- Alertmanager: http://127.0.0.1:9093
- Grafana: http://127.0.0.1:3001 (admin / `$GF_ADMIN_PASSWORD`, default `admin`)
## Smoke test
```sh
bash deploy/smoke.sh
```
Boots the stack, hits `/health`, `/ready`, `/metrics`, ingests example payloads from `examples/`, and verifies the API exposes resulting agent/check/incident/outbox state.
`SMOKE_KEEP=1 bash deploy/smoke.sh` leaves the stack up after the run.
## Showcase / E2E stand (Stage 6.1)
Full-fat demo stack with several dockerized agents driving the system through
every witness state: agent alive/stale/dead, check ok/warning/critical/unknown,
incident open/resolved, outbox sent/retry/failed/discarded,
anti-double-alerting with `notifications_enabled=false`, and agent spool
replay against a server that becomes available after the agent starts.
```sh
bash deploy/e2e-showcase.sh
```
Internally:
```sh
MONLET_AUTH_TOKEN=monlet-dev-token docker compose -f deploy/docker-compose.yml -f deploy/docker-compose.showcase.yml up -d --build
```
`SHOWCASE_KEEP=1 bash deploy/e2e-showcase.sh` leaves the stack up so you can
inspect the web UI at http://127.0.0.1:3000.
Dockerized agents (`deploy/docker/agent.Dockerfile`, `deploy/showcase/`) exist
for demo/e2e only — production deploys the Go binary under systemd.
## Files
- `docker-compose.yml` — full local stack (server / postgres / web / optional observability profile).
- `prometheus/prometheus.yml` — example scrape config (Monlet server + agent target).
- `alertmanager/alertmanager.yml` — example route + receiver.
- `grafana/provisioning/` — datasource + dashboard providers.
- `grafana/dashboards/monlet-overview.json` — starter dashboard.
- `smoke.sh` — local stack smoke entry point.
- `docker-compose.showcase.yml` — override that adds demo agents + mock webhook.
- `docker/agent.Dockerfile` — demo/e2e agent image (not for production).
- `showcase/` — demo agent configs, check scripts, mock webhook, seed SQL.
- `e2e-showcase.sh` — full showcase runner (Stage 6.1).
Docker images install Python/Node project dependencies inside the image; host venvs are never mounted (see `AGENTS.md`).