docs: update full-dev-setup docs (#7205)

This commit is contained in:
Samir Musali 2023-10-18 18:11:47 +03:00 committed by GitHub
parent 6ba4f4df46
commit 4262bd6ace
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 37 additions and 11 deletions

View File

@ -30,39 +30,65 @@ Depending on your platform, some native dependencies might be required. On macOS
As long as [this issue](https://github.com/xmlsec/python-xmlsec/issues/252) about `libxmlsec-1.3.0` is open, a workaround is required to install a compatible version of `libxmlsec1` with brew, see [this comment](https://github.com/xmlsec/python-xmlsec/issues/254#issuecomment-1612005910). As long as [this issue](https://github.com/xmlsec/python-xmlsec/issues/252) about `libxmlsec-1.3.0` is open, a workaround is required to install a compatible version of `libxmlsec1` with brew, see [this comment](https://github.com/xmlsec/python-xmlsec/issues/254#issuecomment-1612005910).
::: :::
First, you need to create an isolated Python environment. To create the environment and install dependencies, run the following commands in the same directory as your authentik git repository: 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 ```shell
poetry shell # Creates a python virtualenv, and activates it in a new shell poetry shell # Creates a python virtualenv, and activates it in a new shell
make install # Install all required dependencies for Python and Javascript, including development dependencies make install # Installs all required dependencies for Python and Javascript, including development dependencies
``` ```
To configure authentik to use the local databases, we need a local config file. This file can be generated by running `make gen-dev-config`. 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:
To apply database migrations, run `make migrate`. This is needed after the initial setup, and whenever you fetch new source from upstream. ```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. 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. 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.
Before committing code, run `make lint` to ensure your code is formatted well. This also requires `pyright`, which is installed in the `web/` folder to make dependency management easier. Before committing code, run the following commands in the same directory as your local authentik git repository:
Run `make gen` to generate an updated OpenAPI document for any changes you made. ```shell
make lint # Ensures your code is well-formatted
make gen # Generates an updated OpenAPI Docs for any changes you make
```
:::info
Linting also requires `pyright`, which is installed in the `web/` folder to make dependency management easier.
:::
## Frontend Setup ## 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. By default, no compiled bundle of the frontend is included so this step is required even if you're not developing for the UI.
To build the UI once, run `make web-build`. To build the UI once, run the following command in the same directory as your local authentik git repository:
Alternatively, if you want to live-edit the UI, you can run `make web-watch` instead. ```shell
This will immediately update the UI with any changes you make so you can see the results in real time without needing to rebuild. make web-build # Builds the UI once
```
To format the frontend code, run `make web`. 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 ## Running authentik
Now that the backend and frontend have been setup and built, you can start authentik by running `ak server`. authentik should now be accessible at `http://localhost:9000`. 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
ak server # Starts authentik server
```
And now, authentik should now be accessible at `http://localhost:9000`.
:::info :::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. 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.