Loading…
Loading documentation...
Configure Authentik trusted proxy CIDRs and OIDC SSO, Gitea ROOT_URL and Git SSH passthrough, and n8n WEBHOOK_URL with PostgreSQL backing in Docker.
Commands checked on 2026-11-23 with Authentik 2024.10+, Gitea 1.22+, n8n 1.70+, Caddy 2.9, PostgreSQL 17.
A unified internal developer and automation plane: Authentik acting as your OIDC/SAML identity provider with accurate client IP auditing, Gitea or Forgejo integrated with Authentik OIDC + clean SSH/HTTPS clone URLs, and n8n running on PostgreSQL with verified webhook callbacks and encrypted credentials.
Generate cryptographic secrets cleanly before first boot (chmod 600 .env):
AUTHENTIK_SECRET_KEY=$(openssl rand -base64 48)
N8N_ENCRYPTION_KEY=$(openssl rand -hex 32)
In Authentik's environment, explicitly declare your reverse proxy bridge subnet so failed logins log real client IPs instead of 172.x.x.x:
AUTHENTIK_SECRET_KEY=<generated>
AUTHENTIK_POSTGRESQL__HOST=authentik-pg
AUTHENTIK_REDIS__HOST=authentik-redis
AUTHENTIK_LISTEN__TRUSTED_PROXY_CIDRS=172.16.0.0/12,127.0.0.1
AUTHENTIK_ERROR_REPORTING__ENABLED=false
Complete initial setup immediately at https://auth.YOUR_DOMAIN/if/flow/initial-setup/ on a private or allowlisted session before exposing registration flows broadly.
Set explicit external URLs inside Gitea's app.ini (or GITEA__server__* environment variables) so web cloning URLs, OAuth2 redirects, and Git SSH URLs match your public hostname:
GITEA__server__ROOT_URL=https://git.YOUR_DOMAIN/
GITEA__server__DOMAIN=git.YOUR_DOMAIN
GITEA__server__SSH_DOMAIN=git.YOUR_DOMAIN
GITEA__server__SSH_PORT=2222
GITEA__security__INSTALL_LOCK=true
GITEA__service__DISABLE_REGISTRATION=true
GITEA__openid__ENABLE_OPENID_SIGNIN=false
If port 22 belongs to host OpenSSH, publish Gitea's SSH port on 2222:22 and open 2222/tcp explicitly in /etc/ufw/after.rules DOCKER-USER so git clone ssh://git@git.YOUR_DOMAIN:2222/org/repo.git works cleanly.
Bind Gitea to Authentik OIDC in Site Administration -> Authentication Sources -> Add Source -> OpenID Connect with auto-discovery URL https://auth.YOUR_DOMAIN/application/o/<slug>/.well-known/openid-configuration.
Default SQLite n8n instances hit lock errors under concurrent webhooks. Point n8n to PostgreSQL and declare WEBHOOK_URL plus strict file permissions:
n8n:
image: n8nio/n8n:latest
restart: unless-stopped
environment:
- N8N_HOST=n8n.YOUR_DOMAIN
- N8N_PORT=5678
- N8N_PROTOCOL=https
- WEBHOOK_URL=https://n8n.YOUR_DOMAIN/
- N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true
- N8N_ENCRYPTION_KEY=${N8N_ENCRYPTION_KEY}
- DB_TYPE=postgresdb
- DB_POSTGRESDB_HOST=n8n-postgres
- DB_POSTGRESDB_DATABASE=n8n
- DB_POSTGRESDB_USER=n8n
- DB_POSTGRESDB_PASSWORD=${N8N_DB_PASSWORD}
- N8N_RUNNERS_ENABLED=true
volumes:
- n8n_data:/home/node/.n8n
networks:
- proxy_net
- internal_net
Notice N8N_ENCRYPTION_KEY: back it up in your Key Vault or password manager immediately. Losing N8N_ENCRYPTION_KEY makes every saved API credential inside the n8n database unreadable after restoring.
curl -fsS https://auth.YOUR_DOMAIN/-/health/live/
curl -fsS https://git.YOUR_DOMAIN/api/v1/version
curl -fsS https://n8n.YOUR_DOMAIN/healthz
Confirm each responds with HTTP 200, and test triggering a sample n8n webhook URL (https://n8n.YOUR_DOMAIN/webhook-test/...) while viewing live SSE execution logs in the n8n editor.
http://localhost:9000 or fails CSRF state verification. Caddy/Traefik stripped Host or X-Forwarded-Proto, or AUTHENTIK_LISTEN__TRUSTED_PROXY_CIDRS omits your Docker subnet (docker network inspect proxy_net).http://localhost:5678. WEBHOOK_URL was omitted from container environment variables; external SaaS callers need WEBHOOK_URL=https://n8n.YOUR_DOMAIN/.GITEA__server__ROOT_URL was left unset. Set ROOT_URL with trailing slash and restart the container.DISABLE_REGISTRATION=true) once Authentik OIDC SSO is active.akadmin or disable default akadmin after creating named administrators.N8N_ENCRYPTION_KEY stored separately from database backups so stolen DB dumps cannot decrypt downstream OAuth/API secrets.Every Servers Are Up virtual machine and container includes an integrated HTML5 browser-based SSH, RDP, and VNC console in your dashboard, default-off inbound firewall rules with per-IP allow-lists, and full programmatic control via REST API v1 and Model Context Protocol (MCP). Explore our Virtual Datacenter Plans or reach out to Servers Are Up Support.