Skip to content

A production-ready Docker Compose setup for a secure, self-hosted Authentik instance. Features a decoupled architecture with PostgreSQL, integrated backup scripts, and security best practices for robust Identity & Access Management (IAM).

License

Notifications You must be signed in to change notification settings

AiratTop/authentik-self-hosted

Authentik Self-Hosted with Docker

authentik-self-hosted

This repository provides a docker-compose setup to run a self-hosted Authentik instance. Authentik is a flexible, open-source Identity & Access Management (IAM) solution that provides Single Sign-On, support for various protocols, and a user-friendly interface.

This setup uses dedicated PostgreSQL container and is pre-configured to join a shared Docker network, allowing easy integration with other self-hosted services.

Key Features

  • Comprehensive IAM Solution: Manage users, groups, and permissions with a powerful and easy-to-use interface.
  • Wide Protocol Support: Supports OAuth 2.0, SAML, LDAP, and RADIUS for broad compatibility.
  • Extensible & Customizable: Use custom templates, policies, and integrations to fit your needs.
  • Advanced Security: Features like multi-factor authentication (MFA), passwordless login, and detailed audit logs.
  • Outpost Integrations: Easily put existing applications behind a secure proxy with forward authentication.
  • Decoupled Services: Uses separate, dedicated containers for PostgreSQL (authentik-psql) and Worker (authentik-worker) for better stability and management.

Getting Started

  1. Clone the repository:

    git clone https://github.com/AiratTop/authentik-self-hosted.git
    cd authentik-self-hosted
  2. Create the shared network: If it doesn't exist yet, create the shared Docker network:

    docker network create shared_network
  3. Configure environment variables: Create a .env file and add the following required variables. These are critical for securing your instance.

    # A strong password for the Authentik database user
    PSQL_PWD=
    # A long, random, and secret string used for signing sessions
    AUTHENTIK_SECRET_KEY=
  4. Start the services:

    docker compose up -d

    After starting, Authentik will perform its initial setup. This might take a minute or two.

Setup and Accessing Authentik

To start the initial setup, navigate to:

You will get a Not Found error if initial setup URL doesn't include the trailing forward slash /. Make sure you use the complete url http://localhost:9000/if/flow/initial-setup/ including the trailing forward slash.

There you are prompted to set a password for the akadmin user (the default user).

Usage and Management

  • Start Services: docker compose up -d
  • Stop Services: docker compose down
  • View Logs: docker compose logs -f
  • Restart: ./restart-docker.sh (Stops and starts the containers)
  • Update Images: ./update-docker.sh (Pulls the latest Docker images and restarts the services)
  • Backup: ./backup.sh (Creates a compressed backup of the PostgreSQL database)

See Also

Check out other self-hosted solutions:

License

This project is licensed under the MIT License - see the LICENSE file for details.


Author

AiratTop

About

A production-ready Docker Compose setup for a secure, self-hosted Authentik instance. Features a decoupled architecture with PostgreSQL, integrated backup scripts, and security best practices for robust Identity & Access Management (IAM).

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Sponsor this project

Languages