Self-Hosting
Run Incidion on your own server with Docker Compose.
Incidion runs as a few Docker containers next to managed or self-run data services. This page describes the setup the hosted service itself uses.
Architecture
| Component | Runs as | Purpose |
|---|---|---|
| Django | container django (Gunicorn) |
REST API, admin, status pages, web billing, the website and the web dashboard at /app |
| Celery worker | container celery-worker |
Checks, paging, alerts, emails |
| Celery beat | container celery-beat |
Schedules: checks, re-paging every 30 s, alert rules every minute, rollups |
| ClickHouse | container clickhouse |
Logs and server metrics |
| Ingest service | FastAPI container (we run it on Cloud Run) | POST /v1/logs, /v1/metrics, OTLP |
| PostgreSQL | managed (we use Supabase) or your own | Everything else |
| Redis | managed (we use Upstash) or your own | Cache, Celery broker, rate limits |
| Reverse proxy | Caddy on the host | HTTPS; the only way in |
Data-service ports are never published. Django listens on 127.0.0.1:8000 only, behind the proxy.
Prerequisites
- A Linux server with Docker and Docker Compose
- A domain with DNS pointing at the server, and Caddy (or another proxy that terminates HTTPS)
- PostgreSQL 15+ and Redis 7+ (managed or self-run)
- Email: a Brevo account (API key) or any SMTP server
- Optional: a Firebase project (push), Twilio (SMS and voice), Stripe (billing)
Configuration
Put a .env next to the compose files (start from backend/.env.example). The most important settings:
# Django (production refuses to start without a real key)
SECRET_KEY=... # python -c 'import secrets; print(secrets.token_urlsafe(50))'
DJANGO_ENV=production
ALLOWED_HOSTS=incidion.example.com
FRONTEND_URL=https://incidion.example.com
NUM_PROXIES=1 # Caddy in front; 2 with Cloudflare + Caddy
# Two-factor: set before anyone turns it on, keep every key ever used
MFA_ENCRYPTION_KEYS=... # python -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())"
# Data services
DATABASE_URL=postgres://user:password@host:5432/incidion
REDIS_URL=rediss://default:password@host:6379
CELERY_BROKER_URL=rediss://default:password@host:6379
CLICKHOUSE_URL=http://clickhouse:8123
CLICKHOUSE_PASSWORD=...
# Email: Brevo's API when BREVO_API_KEY is set, else SMTP
BREVO_API_KEY=xkeysib-...
DEFAULT_FROM_EMAIL=Incidion <noreply@example.com>
# EMAIL_HOST=smtp.example.com EMAIL_PORT=587 EMAIL_HOST_USER=... EMAIL_HOST_PASSWORD=...
# Optional
FIREBASE_SERVICE_ACCOUNT_BASE64=... # push notifications
TWILIO_ACCOUNT_SID=... TWILIO_AUTH_TOKEN=... TWILIO_FROM_NUMBER=+1... # SMS and voice
STATUS_PAGE_PROJECT_ID=... # project shown on your own /status/ page
The full list with explanations is in backend/.env.example.
Every email (verification, password reset codes, invitations, incident and alert emails, status page subscribers, billing notices) is built in code; there are no provider templates. With BREVO_API_KEY set, mail goes out through Brevo’s transactional API; without it, through SMTP (EMAIL_HOST, EMAIL_PORT with STARTTLS, EMAIL_HOST_USER, EMAIL_HOST_PASSWORD). The domain of DEFAULT_FROM_EMAIL must be a verified sender in Brevo (SPF and DKIM), or Brevo refuses the mail or it lands in spam. If Brevo’s IP restriction is on, allow the server’s address.
Ingest service
The ingest service reads its own environment: CLICKHOUSE_URL, CLICKHOUSE_USER, CLICKHOUSE_PASSWORD, CLICKHOUSE_DB, POSTGRES_URL (the same database as Django, for API key lookups), and optionally REDIS_URL (rate limits, daily quotas, key cache) and INGEST_INTERNAL_TOKEN (enables GET /v1/usage). Without REDIS_URL it accepts everything without quotas.
Deploy
Always use both compose files:
compose() { docker compose -f docker-compose.yml -f docker-compose.prod.yml "$@"; }
compose pull
# Migrations run once, in a one-off container, before the services restart
compose run --rm --no-deps -T django python manage.py migrate --noinput
compose up -d --remove-orphans
Then check https://incidion.example.com/health/deep/ (database, cache, beat and worker ticks, check lag) and the ingest service’s /health. Point an Incidion monitor at both.
Schema changes of the log tables ship as SQL in scripts/clickhouse-migrations/; run them before deploying a new ingest image.
HTTPS
Caddy gets and renews certificates by itself:
incidion.example.com {
reverse_proxy 127.0.0.1:8000
}
Django redirects to HTTPS, sends HSTS and trusts X-Forwarded-For only from the number of proxies set in NUM_PROXIES.
Website
CI builds website/ and dashboard/ and copies them into the Django image, which serves the website from the root and the web dashboard at /app. Without those builds (a local image), /, /pricing/ and the other website pages and /app answer 404.
Billing (Stripe, optional)
Without STRIPE_SECRET_KEY billing is off and every organization keeps its plan. To sell plans:
-
Set
STRIPE_SECRET_KEY. -
Create the products, prices and webhook endpoint once:
compose run --rm django python manage.py setup_stripe \ --webhook-url https://incidion.example.com/api/v1/billing/stripe/webhook/It prints the
STRIPE_PRICE_PRO_MONTHLY,..._YEARLY,STRIPE_PRICE_BUSINESS_MONTHLY,..._YEARLYandSTRIPE_WEBHOOK_SECRETlines for.env. Running it again creates nothing new. The output contains a secret: do not paste it into tickets or CI logs. -
Optional: to charge tax with Stripe Tax, set it up in the Stripe dashboard first (origin address, registrations, product tax code), then set
STRIPE_AUTOMATIC_TAX=true. Checkout then asks for the billing address, lets businesses enter a VAT id (reverse charge) and keeps automatic tax on renewals. With the setting on but Stripe Tax not set up, every checkout fails. -
Restart. Owners buy plans in the web dashboard (Plan and billing) or at
https://incidion.example.com/billing/. The iOS app never shows a purchase link.
New organizations get a 14-day Pro trial (BILLING_TRIAL_DAYS, BILLING_TRIAL_PLAN; 0 turns it off).
Your own status page
Set STATUS_PAGE_PROJECT_ID before the first migrate: the migration creates the page with the reserved address incidion, shown at /status/. Customer pages live at /s/<slug>/.
Backups
Back up PostgreSQL with pg_dump (custom format) and copy the dumps off the server; restore with pg_restore --no-owner. Logs in ClickHouse expire by plan; back them up with BACKUP ... TO Disk(...) if you need them.
Updates
Pull the new images and run the three deploy commands above. Read the release notes for settings that must be set before the deploy.
Security
- Never publish database, Redis or ClickHouse ports.
- Keep
.envout of version control and readable only by the deploy user. - Every request Incidion makes for a customer (checks, webhooks, alert channels) only reaches public addresses. Set
OUTBOUND_ALLOW_PRIVATE_NETWORKS=trueonly on a private test setup.
Support
For help with a self-hosted setup, talk to us.