2020-02-29 00:43:59 +00:00
|
|
|
---
|
|
|
|
layout: default
|
|
|
|
title: Build & Dev
|
|
|
|
parent: Contributing
|
|
|
|
nav_order: 1
|
|
|
|
---
|
|
|
|
|
|
|
|
# Build & Dev
|
2019-03-03 22:51:52 +00:00
|
|
|
|
2019-12-05 20:52:04 +00:00
|
|
|
**Authelia** is written in Go and comes with a dedicated CLI called
|
|
|
|
[authelia-scripts](./authelia-scripts.md) which is available after
|
|
|
|
running `source bootstrap.sh`. This CLI provides many useful tools
|
|
|
|
to help you during development.
|
2019-03-03 22:51:52 +00:00
|
|
|
|
2019-12-05 20:52:04 +00:00
|
|
|
In order to build and contribute to **Authelia**, you need to make
|
2021-01-30 08:29:07 +00:00
|
|
|
sure Go >= v1.13, Docker, docker-compose and Node >= v12 are installed on
|
2019-12-05 20:52:04 +00:00
|
|
|
your machine.
|
2019-03-03 22:51:52 +00:00
|
|
|
|
2019-11-16 14:43:20 +00:00
|
|
|
## Get started
|
2019-03-03 22:51:52 +00:00
|
|
|
|
2019-12-05 20:52:04 +00:00
|
|
|
**Authelia** is made of Go application serving the API and a
|
|
|
|
[React](https://reactjs.org/) application for the portal.
|
2019-03-03 22:51:52 +00:00
|
|
|
|
2019-12-05 20:52:04 +00:00
|
|
|
In order to ease development, Authelia uses the concept of [suites] to
|
|
|
|
run Authelia from source code so that your patches are included. This
|
|
|
|
is a kind of virtual environment running **Authelia** in a complete
|
2020-03-09 22:37:46 +00:00
|
|
|
ecosystem (LDAP, Redis, SQL server). Note that Authelia is hot-reloaded
|
2019-12-05 20:52:04 +00:00
|
|
|
in the environment so that your patches are instantly included.
|
2019-03-03 22:51:52 +00:00
|
|
|
|
2019-11-16 14:43:20 +00:00
|
|
|
The next command starts the suite called *Standalone*:
|
2019-03-03 22:51:52 +00:00
|
|
|
|
2019-12-05 20:52:04 +00:00
|
|
|
$ authelia-scripts suites setup Standalone
|
2019-03-03 22:51:52 +00:00
|
|
|
|
2019-12-05 20:52:04 +00:00
|
|
|
Most of the suites are using docker-compose to bootstrap the
|
|
|
|
environment. Therefore, you can check the logs of all application
|
|
|
|
by running the following command on the component you want to
|
|
|
|
monitor.
|
2019-03-03 22:51:52 +00:00
|
|
|
|
2019-12-05 20:52:04 +00:00
|
|
|
$ docker logs authelia_authelia-backend_1 -f
|
2019-03-03 22:51:52 +00:00
|
|
|
|
2019-12-05 20:52:04 +00:00
|
|
|
Then, edit the code and observe how **Authelia** is automatically
|
|
|
|
reloaded.
|
2019-03-03 22:51:52 +00:00
|
|
|
|
|
|
|
### Unit tests
|
|
|
|
|
2019-11-16 14:43:20 +00:00
|
|
|
To run the unit tests, run:
|
2019-03-03 22:51:52 +00:00
|
|
|
|
2019-12-05 20:52:04 +00:00
|
|
|
$ authelia-scripts unittest
|
2019-03-03 22:51:52 +00:00
|
|
|
|
|
|
|
### Integration tests
|
|
|
|
|
2019-12-05 20:52:04 +00:00
|
|
|
Integration tests are located under the `internal/suites` directory
|
|
|
|
and are based on Selenium. A suite is a combination of environment
|
|
|
|
and tests. Executing a suite therefore means starting the environment,
|
|
|
|
running the tests and tearing down the environment. Each step can be
|
2020-01-21 00:10:00 +00:00
|
|
|
run independently:
|
2019-03-03 22:51:52 +00:00
|
|
|
|
2019-12-05 20:52:04 +00:00
|
|
|
# List the available suites
|
|
|
|
$ authelia-scripts suites list
|
|
|
|
Standalone
|
|
|
|
DuoPush
|
|
|
|
LDAP
|
|
|
|
Traefik
|
2019-03-03 22:51:52 +00:00
|
|
|
|
2019-12-05 20:52:04 +00:00
|
|
|
# Start the environment of Standalone suite.
|
|
|
|
$ authelia-scripts suites setup Standalone
|
2019-11-03 12:07:02 +00:00
|
|
|
|
2019-12-05 20:52:04 +00:00
|
|
|
# Run the tests related to the currently running suite.
|
|
|
|
$ authelia-scripts suites test
|
2019-11-03 12:07:02 +00:00
|
|
|
|
2019-12-05 20:52:04 +00:00
|
|
|
# Tear down the environment
|
|
|
|
$ authelia-scripts suites teardown Standalone
|
|
|
|
|
|
|
|
|
|
|
|
In order to test all suites (approx 30 minutes), you need to make
|
|
|
|
sure there is no currently running suite and then you should run:
|
|
|
|
|
|
|
|
$ authelia-scripts suites test
|
|
|
|
|
|
|
|
Also, you don't need to start the suite before testing it. Given
|
|
|
|
you're not running any suite, just use the following command to
|
|
|
|
test the *Standalone* suite.
|
|
|
|
|
|
|
|
$ authelia-scripts suites test Standalone
|
|
|
|
|
|
|
|
The suite will be spawned, tests will be run and then the suite
|
2021-01-30 08:29:07 +00:00
|
|
|
will be torn down automatically.
|
2019-11-03 12:07:02 +00:00
|
|
|
|
2019-03-03 22:51:52 +00:00
|
|
|
|
2019-08-27 16:36:40 +00:00
|
|
|
[suites]: ./suites.md
|