Skip to content

From source

For development, or to run the binaries without containers.

What you need

  • Go (the version in backend/go.mod; with an older Go, GOTOOLCHAIN=auto downloads the right one)
  • Node.js 20
  • PostgreSQL 16 (Docker is the quickest way)

Run it

# a database
docker run -d --name neuroops-db \
  -e POSTGRES_USER=aiops_user -e POSTGRES_PASSWORD=aiops_pass -e POSTGRES_DB=aiops \
  -p 127.0.0.1:5435:5432 postgres:16-alpine

# the backend (migrations run at start)
cd backend
export POSTGRES_DSN="host=localhost port=5435 user=aiops_user password=aiops_pass dbname=aiops sslmode=disable"
export JWT_SECRET="$(openssl rand -base64 32)"
go run ./cmd/server             # listens on :8080

# the web app, in another terminal
cd frontend
npm install
npm run dev                     # http://localhost:5173, proxies /api to :8080

In development mode (ENV unset or development) the server allows missing keys and prints a warning for each; production refuses to start without them. make db and make run-backend in the repository root do the same as the first two steps.

Check it:

curl -s http://localhost:8080/readyz

Prove the core flow with curl

API=http://localhost:8080/api/v1

# sign up: a new workspace with you as its admin
TOKEN=$(curl -s -X POST $API/auth/register -H 'Content-Type: application/json' \
  -d '{"email":"me@example.com","password":"a-long-password","organization_name":"Acme"}' | jq -r .token)

# a Prometheus source; its token is returned only now
SOURCE=$(curl -s -X POST $API/sources -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
  -d '{"name":"prometheus","type":"prometheus"}' | jq -r .token)

# one alert
curl -s -X POST $API/ingest/prometheus -H "Authorization: Bearer $SOURCE" -H 'Content-Type: application/json' \
  -d '{"alerts":[{"status":"firing","labels":{"alertname":"HighErrorRate","service":"payments-api","severity":"critical"},"annotations":{"summary":"High error rate on payments-api"}}]}'

# the incident, with its root-cause summary
curl -s "$API/incidents?search=payments-api" -H "Authorization: Bearer $TOKEN" | jq '.items[0] | {id, title, status, severity}'

Use the source token for ingest and your sign-in token for everything else.

scripts/seed-demo.sh fires about a thousand alerts through the same API so a fresh database shows a busy dashboard (BASE_URL=http://localhost:8080 scripts/seed-demo.sh).

Build

make build          # backend binary and web app
make build-foss     # the same without any enterprise code (Apache-2.0 only)
make docker         # backend container image

Test

make test                                   # backend unit tests
TEST_POSTGRES_DSN="host=… dbname=…" go test ./...   # in backend/: also the integration tests against Postgres
cd frontend && npm test && npm run lint     # web app tests and lint
make e2e                                    # browser end-to-end (Docker, a free :8080, Firefox via Playwright)
make helm-test                              # Helm chart lint and render tests

The integration tests boot the whole application against a real Postgres; point TEST_POSTGRES_DSN at a throwaway database. The end-to-end tests send an alert, check the on-call person is paged through a webhook, and acknowledge in the browser.

Documentation

pip install mkdocs-material
mkdocs serve                     # http://127.0.0.1:8000
cd backend && go run ./cmd/docgen   # regenerate the API route index and configuration reference