website: Flesh out docs split.

website: Copy files during build.

website: Allow for mixed env builds.

website: Reduce build size.

website: Expose build.

website: Add build memory debugging.

WIP: Disable broken links check to compare memory usage.

website: Update deps.

website: Clean up API paths.

website: Flesh out 3.8 fixes.

Format.

website: Update ignore paths.

Website: Clean up integrations build.

website: Fix paths.

website: Optimize remark.

website: Update deps.

website: Format.

website: Remove linking.

website: Fix paths.

wip: Attempt API only build.

Prep.

Migrate render to runtime. Tidy sidebar.

Clean up templates.

docs: Move directory. WIP

docs: Flesh out split.

website: Fix issue where routes have collisions.
This commit is contained in:
Teffen Ellis
2025-06-17 21:02:38 +02:00
parent b10c795a26
commit 582812b3ec
704 changed files with 5179 additions and 4670 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 805 KiB

View File

@ -0,0 +1,53 @@
---
title: Debugging authentik
---
This page describes how to debug different components of an authentik instance, running either in production or in a development setup. To learn more about the structure of authentik, refer to our [architecture documentation](../../core/architecture.md).
## authentik Server & Worker (Python)
The majority of the authentik codebase is in Python, running in Gunicorn for the server and Celery for the worker. These instructions show how this code can be debugged/inspected. The local debugging setup requires a setup as described in [Full development environment](./full-dev-environment.mdx)
Note that authentik uses [debugpy](https://github.com/microsoft/debugpy), which relies on the "Debug Adapter Protocol" (DAP). These instructions demonstrate debugging using [Visual Studio Code](https://code.visualstudio.com/), however they should be adaptable to other editors that support DAP.
To enable the debugging server, set the environment variable `AUTHENTIK_DEBUGGER` to `true`. This will launch the debugging server (by default on port _9901_).
With this setup in place, you can set Breakpoints in VS Code. To connect to the debugging server, run the command `> Debug: Start Debugging" in VS Code.
![](./debug_vscode.png)
:::info
Note that due to the Python debugger for VS Code, when a Python file in authentik is saved and the Django process restarts, you must manually reconnect the Debug session. Automatic re-connection is not supported for the Python debugger (see [here](https://github.com/microsoft/vscode-python/issues/19998) and [here](https://github.com/microsoft/vscode-python/issues/1182)).
:::
#### Debugging in containers
When debugging an authentik instance running in containers, there are some additional steps that need to be taken in addition to the steps above.
A local clone of the authentik repository is required to be able to set breakpoints in the code. The locally checked out repository must be on the same version/commit as the authentik version running in the containers. To checkout version 2024.12.3 for example, you can run `git checkout version/2024.12.3`.
The debug port needs to be accessible on the local machine. By default, this is port 9901. Additionally, the container being debugged must be started as `root`, because additional dependencies need to be installed on startup.
When running in Docker Compose, a file `docker-compose.override.yml` can be created next to the authentik docker-compose.yml file to expose the port, change the user, and enable debug mode.
```yaml
services:
# Replace `server` with `worker` to debug the worker container.
server:
user: root
healthcheck:
disable: true
environment:
AUTHENTIK_DEBUGGER: "true"
AUTHENTIK_LOG_LEVEL: "debug"
ports:
- 9901:9901
```
After re-creating the containers with `AUTHENTIK_DEBUGGER` set to `true` and the port mapped, the steps are identical to the steps above.
If the authentik instance is running on a remote server, the `.vscode/launch.json` file needs to be adjusted to point to the IP of the remote server. Alternatively, it is also possible to forward the debug port via an SSH tunnel, using `-L 9901:127.0.0.1:9901`.
## authentik Server / Outposts (Golang)
Outposts, as well as some auxiliary code of the authentik server, are written in Go. These components can be debugged using standard Golang tooling, such as [Delve](https://github.com/go-delve/delve).

View File

@ -0,0 +1,83 @@
---
title: Frontend development environment
sidebar_label: Frontend development
tags:
- development
- contributor
- frontend
- docker
---
If you're focusing solely on frontend development, you can create a minimal development environment using Docker and Node.js. This setup allows you to make and preview changes to the frontend in real-time, without needing to interact with the backend.
### Prerequisites
- [Node.js](https://nodejs.org/en) (24 or later)
- [Docker](https://www.docker.com/) (Latest Community Edition or Docker Desktop)
- [Docker Compose](https://docs.docker.com/compose/) (Compose v2)
- [Make](https://www.gnu.org/software/make/) (3 or later)
:::info
Depending on platform, some native dependencies might be required. On macOS, run `brew install node@24`, and for Docker `brew install --cask docker`
:::
### Instructions
1. Clone the Git repo to your development machine and navigate to the authentik directory.
```shell
git clone https://github.com/goauthentik/authentik
cd authentik
```
:::info Beta images
By default, authentik will use the latest stable Docker images.
You can opt into using beta images during development by creating a `.env` file in the root of the repository with the following variables:
```shell
AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-next
AUTHENTIK_OUTPOSTS__CONTAINER_IMAGE_BASE=ghcr.io/goauthentik/dev-%(type)s:gh-next
AUTHENTIK_LOG_LEVEL=debug
```
:::
2. From the cloned repository, follow the Docker Compose [installation instructions](../../install-config/install/docker-compose.mdx).
3. Create a Docker Compose override to mount the local configuration file (`local.env.yml`) and ESBuild's output directory (`web`).
```yaml title="docker-compose.override.yml"
services:
server:
volumes:
- ./web:/web
- ./local.env.yml:/local.env.yml
```
By creating this file in the root of the repository, Docker will automatically mount the web files generated by the build process. The `local.env.yml` mount is optional, but allows you to override the default configuration.
4. From the cloned repository root, install the front-end dependencies using NPM.
```shell
cd web
npm ci
```
5. From the cloned repository root, run the front-end build script.
```shell
make web-watch
```
6. In a new terminal, navigate to the cloned repository root and start the backend containers with Docker Compose.
```shell
docker compose up
```
You can now access authentik on http://localhost:9000 (or https://localhost:9443).
You might also want to complete the initial setup under `/if/flow/initial-setup/`.

View File

@ -0,0 +1,158 @@
---
title: Full development environment
sidebar_label: Full development
tags:
- development
- contributor
- backend
- frontend
- docker
---
import ExecutionEnvironment from "@docusaurus/ExecutionEnvironment";
import TabItem from "@theme/TabItem";
import Tabs from "@theme/Tabs";
## Requirements
- [Python](https://www.python.org/) (3.13 or later)
- [uv](https://docs.astral.sh/uv/getting-started/installation/), (Latest stable release)
- [Go](https://go.dev/) (1.24 or later)
- [Node.js](https://nodejs.org/en) (24 or later)
- [PostgreSQL](https://www.postgresql.org/) (16 or later)
- [Redis](https://redis.io/) (7 or later)
- [Docker](https://www.docker.com/) (Latest Community Edition or Docker Desktop)
- [Docker Compose](https://docs.docker.com/compose/) (Compose v2)
## Services Setup
For PostgreSQL and Redis, you can use the `docker-compose.yml` file in `/scripts`.To use these pre-configured database instances, navigate to the `/scripts` directory in your local copy of the authentik git repo, and run `docker compose up -d`.
You can also use a native install, if you prefer.
:::info
If you use locally installed databases, the PostgreSQL credentials given to authentik should have permissions for `CREATE DATABASE` and `DROP DATABASE`, because authentik creates a temporary database for tests.
:::
## Backend Setup
:::info
Depending on your platform, some native dependencies might be required.
<Tabs
defaultValue={ (ExecutionEnvironment.canUseDOM) ? (() => {
const ua = window.navigator.userAgent.toLowerCase();
return ["linux", "windows", "mac"].find((p) => ua.includes(p)) || "mac";
})() : "mac" }
values={[
{label: "macOS", value: "mac"},
{label: "Linux", value: "linux"},
{label: "Windows", value: "windows"},
]}>
<TabItem value="mac">
To install the native dependencies on macOS, run:
```sh
$ brew install libxmlsec1 libpq krb5 pkg-config # Required development libraries,
$ brew install uv postgresql redis node@24 golangci-lint # Required CLI tools
```
</TabItem>
<TabItem value="linux">
To install native dependencies on Debian or Ubuntu, run:
```sh
$ pip install uv
$ sudo apt-get install libgss-dev krb5-config libkrb5-dev postgresql-server-dev-all
$ sudo apt-get install postresql redis
```
Adjust your needs as required for other distributions such as Red Hat, SUSE, or Arch.
Install golangci-lint locally [from the site instructions](https://golangci-lint.run/welcome/install/#other-ci).
</TabItem>
<TabItem value="windows">
[We request community input on running the full dev environment on Windows]
</TabItem>
</Tabs>
:::
1. Create an isolated Python environment. To create the environment and install dependencies, run the following commands in the same directory as your local authentik git repository:
```shell
make install # Installs all required dependencies for Python and Javascript, including development dependencies
```
2. Configure authentik to use the local databases using a local config file. To generate this file, run the following command in the same directory as your local authentik git repository:
```shell
make gen-dev-config # Generates a local config file
```
Generally speaking, authentik is a Django application, ran by gunicorn, proxied by a Go application. The Go application serves static files.
Most functions and classes have type-hints and docstrings, so it is recommended to install a Python Type-checking Extension in your IDE to navigate around the code.
## Frontend Setup
By default, no compiled bundle of the frontend is included so this step is required even if you're not developing for the UI.
The UI requires the authentik API files for Typescript be built and installed:
```
$ make migrate # On a fresh install, ensures the API schema file is available
$ make gen # Generates the API based on the schema file
```
If you make changes to the authentik API, you must re-run `make gen` so that the corresponding
changes are made to the API library that is used by the UI.
To build the UI once, run the following command in the same directory as your local authentik git repository:
```shell
make web-build # Builds the UI once
```
If you want to live-edit the UI, you can run the following command in the same directory as your local authentik git repository instead, which will immediately update the UI with any changes you make so you can see the results in real time without needing to rebuild:
```shell
make web-watch # Updates the UI with any changes you make
```
To format the frontend code, run the following command in the same directory as your authentik git repository:
```shell
make web # Formats the frontend code
```
## Running authentik
Now that the backend and frontend have been setup and built, you can start authentik by running the following command in the same directory as your local authentik git repository:
```shell
make run # Starts authentik server
```
And now, authentik should now be accessible at `http://localhost:9000`.
:::info
To define a password for the default admin (called **akadmin**), you can manually enter the `/if/flow/initial-setup/` path in the browser address bar to launch the initial flow. Example: http://localhost:9000/if/flow/initial-setup/.
In case of issues in this process, feel free to use `make dev-reset` which drops and restores the authentik PostgreSQL instance to a "fresh install" state.
:::
## Submitting Pull Requests
Before submitting a pull request, run the following commands in the same directory as your local authentik git repository:
```shell
make lint # Ensures your code is well-formatted
make gen # Generates an updated OpenAPI Docs for any changes you make
make web # Formats the front-end code
```

View File

@ -0,0 +1,27 @@
---
title: Docs development environment
sidebar_label: Docs development
tags:
- development
- contributor
- docs
- docusaurus
---
If you want to only make changes to the documentation, you only need Node.js.
### Prerequisites
- Node.js (any recent version should work; we use 24.x to build)
- Make (again, any recent version should work)
:::info
Depending on platform, some native dependencies might be required. On macOS, run `brew install node@24`
:::
### Instructions
1. Clone the git repo from https://github.com/goauthentik/authentik
2. Run `make docs-install` to install the docs development dependencies
3. Run `make docs-watch` to start a development server to see and preview your changes
4. Finally when you're about to commit your changes, run `make docs` to run the linter and auto-formatter.