Identity Provider Guide

    Deploying Authentik on RamNode VPS

    Authentik is a powerful open-source identity provider that supports SAML, OAuth2, OpenID Connect, LDAP, and SCIM. This guide walks through deploying Authentik using Docker Compose with production-ready configurations for security and performance.

    Ubuntu 24.04 LTS
    Docker Compose
    ⏱️ 30-45 minutes

    Key Features

    • SAML, OAuth2, OpenID Connect support
    • LDAP and SCIM integration
    • Visual flow designer for authentication
    • Built-in application proxy & outposts

    Prerequisites

    Before starting, ensure you have:

    Server Requirements

    • • RamNode VPS with 2GB RAM minimum
    • • 4GB RAM recommended for production
    • • Ubuntu 24.04 LTS or Debian 12
    • • Domain name pointed to your VPS

    Recommended Specs

    Use CaseRAMStorage
    Small/Dev2 GB20 GB
    Production4 GB40 GB
    Enterprise8+ GB80+ GB
    2

    Initial Server Setup

    Update System & Install Packages

    System Update
    apt update && apt upgrade -y
    apt install -y curl git pwgen apache2-utils
    3

    Install Docker

    Install Docker Engine

    Install Docker
    curl -fsSL https://get.docker.com | sh
    systemctl enable --now docker

    Verify Installation

    Check Versions
    docker --version
    docker compose version
    4

    Configure Firewall

    Setup UFW Firewall

    Configure UFW
    apt install -y ufw
    ufw default deny incoming
    ufw default allow outgoing
    ufw allow ssh
    ufw allow 80/tcp
    ufw allow 443/tcp
    ufw enable
    5

    Create Directory Structure

    Create Authentik Directories

    Create Directories
    mkdir -p /opt/authentik/{certs,media,templates,custom-templates}
    cd /opt/authentik

    Generate Secrets

    Authentik requires a secret key and database password:

    Generate Secrets
    echo "PG_PASS=$(pwgen -s 40 1)" >> .env
    echo "AUTHENTIK_SECRET_KEY=$(pwgen -s 50 1)" >> .env
    6

    Docker Compose Configuration

    Container Services Overview

    ServicePurpose
    postgresqlPostgreSQL 16 database for persistent storage
    redisSession management and message queuing
    serverMain web server handling HTTP requests
    workerBackground task processor for async operations

    Environment Variables

    Add these settings to your .env file:

    Environment Variables
    AUTHENTIK_ERROR_REPORTING__ENABLED=false
    AUTHENTIK_DISABLE_UPDATE_CHECK=false
    AUTHENTIK_DISABLE_STARTUP_ANALYTICS=true
    COMPOSE_PROJECT_NAME=authentik

    SMTP Configuration (Optional)

    SMTP Settings
    AUTHENTIK_EMAIL__HOST=smtp.your-provider.com
    AUTHENTIK_EMAIL__PORT=587
    AUTHENTIK_EMAIL__USE_TLS=true
    AUTHENTIK_EMAIL__FROM=authentik@yourdomain.com
    7

    Reverse Proxy with Caddy

    Install Caddy

    Install Caddy
    apt install -y debian-keyring debian-archive-keyring apt-transport-https
    curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | \
      gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
    apt update && apt install caddy
    systemctl enable caddy

    Configure Caddyfile

    Create /etc/caddy/Caddyfile with your domain:

    /etc/caddy/Caddyfile
    auth.yourdomain.com {
        reverse_proxy localhost:9000
        header {
            X-Content-Type-Options nosniff
            X-Frame-Options DENY
            Referrer-Policy strict-origin-when-cross-origin
        }
        encode gzip
    }
    8

    Launch Authentik

    Start the Containers

    Launch Authentik
    cd /opt/authentik
    docker compose pull
    docker compose up -d

    Monitor Startup

    View Logs
    docker compose logs -f

    ℹ️ Wait until you see messages indicating the server is ready (typically 1-2 minutes on first launch).

    9

    Initial Configuration

    Access the Setup Wizard

    Navigate to https://auth.yourdomain.com/if/flow/initial-setup/ in your browser. This URL is only available during first-time setup.

    Configure Basic Settings

    After logging in to the admin interface:

    • 1.Navigate to System → Settings and configure your installation title and branding
    • 2.Under System → Tenants, update the default tenant with your domain
    • 3.Review Events → Logs to verify everything started correctly
    10

    Security Hardening

    Docker Socket Proxy

    For production environments, consider using a Docker socket proxy (tecnativa/docker-socket-proxy) instead of mounting the socket directly.

    Configure Fail2ban

    Install Fail2ban
    apt install -y fail2ban

    Create Authentik Filter

    Create /etc/fail2ban/filter.d/authentik.conf:

    Fail2ban Filter
    failregex = ^.* Failed login attempt .* remote=<HOST>.*$

    Create Jail Configuration

    Create /etc/fail2ban/jail.d/authentik.conf:

    Fail2ban Jail
    [authentik]
    enabled = true
    maxretry = 5
    bantime = 3600
    11

    Backup Configuration

    Automated Backup Script

    Create a backup script at /opt/authentik/backup.sh that performs:

    • • PostgreSQL database dump using pg_dump
    • • Backup of media files, custom templates, and environment configuration
    • • Automatic cleanup of backups older than 7 days

    Schedule Daily Backups

    Crontab Entry
    0 3 * * * /opt/authentik/backup.sh >> /var/log/authentik-backup.log 2>&1
    12

    Updating Authentik

    Update Process

    To update to a newer version:

    • 1. Edit docker-compose.yml and update the image tag (e.g., 2024.10 to 2024.12)
    • 2. Pull and restart containers
    • 3. Clean up old images
    Update Commands
    docker compose pull && docker compose up -d
    docker image prune -f

    ⚠️ Important: Always review the release notes before upgrading, as some versions may require database migrations or configuration changes.

    13

    Troubleshooting

    Check Container Status

    Container Status
    docker compose ps
    docker compose logs server --tail 100
    docker compose logs worker --tail 100

    Verify Database Connectivity

    Test Database
    docker compose exec postgresql psql -U authentik -c "SELECT version();"

    Test Redis Connection

    Test Redis
    docker compose exec redis redis-cli ping

    Common Issues

    IssueSolution
    Memory issuesUse deploy.resources.limits.memory in compose file
    Container restartsCheck logs for specific errors
    Database errorsVerify PG_PASS in .env matches database
    14

    Integrating Applications

    Once Authentik is running, you can configure it as an identity provider for your other self-hosted applications. Common integrations include Gitea, Nextcloud, Grafana, and many others.

    Each Application Requires:

    • • Creating a new Provider in Authentik's admin interface
    • • Creating an Application entry linked to the provider
    • • Configuring the target application with the generated client credentials

    📚 The Authentik documentation provides specific integration guides at docs.goauthentik.io/integrations/