2019-03-04 05:51:52 +07:00
|
|
|
# Build and dev
|
|
|
|
|
2019-11-03 19:07:02 +07:00
|
|
|
**Authelia** is written in Go and comes with a dedicated CLI called [authelia-scripts](./authelia-scripts.md)
|
|
|
|
which is provided after running `source bootstrap.sh`. This CLI provides many useful tools to help you during
|
|
|
|
development.
|
2019-03-04 05:51:52 +07:00
|
|
|
|
2019-11-03 19:07:02 +07:00
|
|
|
In order to build and contribute to **Authelia**, you need to make sure Node with version >= 8 and < 12,
|
|
|
|
Go v1.13 and Docker is installed on your machine.
|
2019-03-04 05:51:52 +07:00
|
|
|
|
|
|
|
## Build
|
|
|
|
|
|
|
|
**Authelia** is made of two parts: the frontend and the backend.
|
|
|
|
|
|
|
|
The frontend is a [React](https://reactjs.org/) application written in Typescript and
|
2019-11-03 19:07:02 +07:00
|
|
|
the backend is Go application.
|
2019-03-04 05:51:52 +07:00
|
|
|
|
|
|
|
The following command builds **Authelia** under dist/:
|
|
|
|
|
|
|
|
authelia-scripts build
|
|
|
|
|
2019-11-03 19:07:02 +07:00
|
|
|
Or you can also build the Alpine-based official Docker image with:
|
2019-03-04 05:51:52 +07:00
|
|
|
|
|
|
|
authelia-scripts docker build
|
|
|
|
|
|
|
|
## Development
|
|
|
|
|
|
|
|
In order to ease development, Authelia uses the concept of [suites]. This is
|
|
|
|
a kind of virutal environment for **Authelia**, it allows you to run **Authelia** in a complete
|
2019-11-03 19:07:02 +07:00
|
|
|
ecosystem, develop and test your patches. A hot-reload feature has been implemented so that
|
|
|
|
you can test your changes right after the file has been saved.
|
2019-03-04 05:51:52 +07:00
|
|
|
|
2019-08-27 23:36:40 +07:00
|
|
|
The next command will start the suite called [basic](../test/suites/basic/README.md):
|
2019-03-04 05:51:52 +07:00
|
|
|
|
|
|
|
authelia-scripts suites start basic
|
|
|
|
|
|
|
|
Then, edit the code and observe how **Authelia** is automatically updated.
|
|
|
|
|
|
|
|
### Unit tests
|
|
|
|
|
2019-11-03 19:07:02 +07:00
|
|
|
To run the unit tests written, run:
|
2019-03-04 05:51:52 +07:00
|
|
|
|
|
|
|
authelia-scripts unittest
|
|
|
|
|
|
|
|
### Integration tests
|
|
|
|
|
2019-11-03 19:07:02 +07:00
|
|
|
Integration tests run with Mocha and are based on Selenium. They generally
|
2019-03-04 05:51:52 +07:00
|
|
|
require a complete environment made of several components like redis, mongo and a LDAP
|
|
|
|
to run. That's why [suites] have been created. At this point, the *basic* suite should
|
|
|
|
already be running and you can run the tests related to this suite with the following
|
|
|
|
command:
|
|
|
|
|
|
|
|
authelia-scripts suites test
|
|
|
|
|
2019-11-03 19:07:02 +07:00
|
|
|
You don't need to start the suite before testing it. Given your environment is not running
|
|
|
|
any suite, just use the following command to test the basic suite.
|
|
|
|
|
|
|
|
authelia-scripts suites test basic
|
|
|
|
|
|
|
|
The suite will be spawned, tests will be run and then the suite will be teared down
|
|
|
|
automatically.
|
|
|
|
|
2019-03-04 05:51:52 +07:00
|
|
|
|
2019-08-27 23:36:40 +07:00
|
|
|
[suites]: ./suites.md
|