2018-11-16 07:39:57 +00:00
|
|
|
|
# Deployment for Dev
|
|
|
|
|
|
|
|
|
|
1. [Deploy With npm](#deploy-with-npm)
|
|
|
|
|
2. [Deploy With Docker](#deploy-with-docker)
|
|
|
|
|
3. [Deploy nginx](#deploy-nginx)
|
|
|
|
|
4. [Discard components](#discard-components)
|
|
|
|
|
1. [Discard MongoDB](#discard-mongodb)
|
|
|
|
|
2. [Discard Redis](#discard-redis)
|
|
|
|
|
3. [Discard LDAP](#discard-ldap)
|
|
|
|
|
5. [FAQ](#faq)
|
|
|
|
|
|
2018-11-17 11:20:39 +00:00
|
|
|
|
**WARNING:** *the instructions given in this documentation are not meant
|
2018-11-16 07:39:57 +00:00
|
|
|
|
to be used for production environments since it will make **Authelia**
|
|
|
|
|
non resilient to failures.*
|
|
|
|
|
|
|
|
|
|
**NOTE:** If not done already, we highly recommend you first follow the
|
|
|
|
|
[Getting Started] documentation.
|
|
|
|
|
|
|
|
|
|
In some cases, like protecting personal websites, it can be fine to use
|
2019-03-02 23:25:40 +00:00
|
|
|
|
**Authelia** in a non highly-available setup. We can
|
2019-11-03 12:07:02 +00:00
|
|
|
|
achieve that in order to reduce the number of components to only two: a
|
|
|
|
|
reverse proxy such as nginx or Traefik and Authelia as a companion of the
|
|
|
|
|
proxy.
|
2018-11-16 07:39:57 +00:00
|
|
|
|
|
|
|
|
|
As for a regular deployment in production, you need to install **Authelia**
|
2019-11-03 12:07:02 +00:00
|
|
|
|
either by pulling the Docker image or building distributable version.
|
2018-11-16 07:39:57 +00:00
|
|
|
|
|
2019-11-03 12:07:02 +00:00
|
|
|
|
## Build and deploy the distributable version
|
2018-11-16 07:39:57 +00:00
|
|
|
|
|
2019-11-03 12:07:02 +00:00
|
|
|
|
authelia-scripts build
|
|
|
|
|
PUBLIC_DIR=./dist/public_html ./dist/authelia -config /path/to/your/config.yml
|
2018-11-16 07:39:57 +00:00
|
|
|
|
|
|
|
|
|
## Deploy with Docker
|
|
|
|
|
|
|
|
|
|
docker pull clems4ever/authelia
|
|
|
|
|
docker run -v /path/to/your/config.yml:/etc/authelia/config.yml clems4ever/authelia
|
|
|
|
|
|
|
|
|
|
## Deploy Nginx
|
|
|
|
|
|
2019-03-02 23:25:40 +00:00
|
|
|
|
You also need to install nginx and take [example/compose/nginx/minimal/nginx.conf](./example/compose/nginx/minimal/nginx.conf)
|
|
|
|
|
as an example for your configuration.
|
2018-11-16 07:39:57 +00:00
|
|
|
|
|
2019-11-03 12:07:02 +00:00
|
|
|
|
## Deploy Traefik
|
|
|
|
|
|
|
|
|
|
TODO
|
|
|
|
|
|
2018-11-16 07:39:57 +00:00
|
|
|
|
## Discard components
|
|
|
|
|
|
|
|
|
|
### Discard MongoDB
|
|
|
|
|
|
|
|
|
|
There is an option in the configuration file to discard MongoDB and use
|
2019-11-03 12:07:02 +00:00
|
|
|
|
your local filesystem to store data in a sqlite3 database. This option will
|
|
|
|
|
therefore prevent you from running multiple instances of **Authelia** in
|
|
|
|
|
parallel.
|
|
|
|
|
Consequently, this option is not meant to be used in production or at least
|
|
|
|
|
not one that should scale out.
|
2018-11-16 07:39:57 +00:00
|
|
|
|
|
|
|
|
|
Here is the configuration block you should use:
|
|
|
|
|
|
|
|
|
|
storage:
|
2019-11-03 12:07:02 +00:00
|
|
|
|
# The directory where the sqlite3 file will be saved
|
2018-11-16 07:39:57 +00:00
|
|
|
|
local:
|
2019-11-03 12:07:02 +00:00
|
|
|
|
path: /var/lib/authelia/db.sqlite3
|
2018-11-16 07:39:57 +00:00
|
|
|
|
|
|
|
|
|
### Discard Redis
|
|
|
|
|
|
|
|
|
|
There is an option in the configuration file to discard Redis and use the
|
|
|
|
|
memory of the server to store the KV data. This option will therefore
|
|
|
|
|
prevent you from running multiple instances of **Authelia** in parallel and
|
|
|
|
|
will make you lose user sessions if the application restarts. This
|
2019-11-03 12:07:02 +00:00
|
|
|
|
concretely means that all your users will need to authenticate again after
|
|
|
|
|
a restart of Authelia. Hence, this option is not meant to be used in production.
|
2018-11-16 07:39:57 +00:00
|
|
|
|
|
|
|
|
|
To use memory instead of a Redis backend, just comment out the Redis
|
|
|
|
|
connection details in the following block:
|
|
|
|
|
|
|
|
|
|
session:
|
|
|
|
|
...
|
|
|
|
|
# # The redis connection details
|
|
|
|
|
# redis:
|
|
|
|
|
# host: redis
|
|
|
|
|
# port: 6379
|
|
|
|
|
# password: authelia
|
|
|
|
|
|
|
|
|
|
### Discard LDAP
|
|
|
|
|
|
|
|
|
|
**Authelia** can use a file backend in order to store users instead of a
|
|
|
|
|
LDAP server or an Active Directory. This mode will therefore prevent you
|
|
|
|
|
from running multiple instances of **Authelia** in parallel and is therefore
|
|
|
|
|
discouraged for production environments.
|
|
|
|
|
|
|
|
|
|
To use a file backend instead of a LDAP server, you should first duplicate
|
2019-03-02 23:25:40 +00:00
|
|
|
|
the file [users_database.yml](../test/suites/basic/users_database.yml) and edit it to add the
|
2018-11-16 07:39:57 +00:00
|
|
|
|
users you want.
|
|
|
|
|
|
|
|
|
|
The content of this file is as follows:
|
|
|
|
|
|
|
|
|
|
users:
|
|
|
|
|
...
|
|
|
|
|
john:
|
|
|
|
|
password: "{CRYPT}$6$rounds=500000$jgiCMRyGXzoqpxS3$w2pJeZnnH8bwW3zzvoMWtTRfQYsHbWbD/hquuQ5vUeIyl9gdwBIt6RWk2S6afBA0DPakbeWgD/4SZPiS0hYtU/"
|
|
|
|
|
email: john.doe@authelia.com
|
|
|
|
|
groups:
|
|
|
|
|
- admins
|
|
|
|
|
- dev
|
|
|
|
|
|
2019-11-03 12:07:02 +00:00
|
|
|
|
The password is hashed and salted as it is in LDAP servers with salted SHA-512
|
|
|
|
|
(more hash algorithms such as Argon2 will be provided in the future).
|
|
|
|
|
Here is a one-liner to generate such hashed password:
|
2018-11-16 07:39:57 +00:00
|
|
|
|
|
2019-11-03 12:07:02 +00:00
|
|
|
|
$ authelia-scripts hash-password mypassword
|
2019-11-03 06:40:33 +00:00
|
|
|
|
$6$rounds=50000$BpLnfgDsc2WD8F2q$PumMwig8O0uIe9SgneL8Cm1FvUniOzpqBrH.uQE3aZR4K1dHsQldu5gEjJZsXcO./v3itfz6CXTDTJgeh5e8t.
|
|
|
|
|
|
2019-11-03 12:07:02 +00:00
|
|
|
|
Copy this newly hashed password into your `users_database.yml` file, prefixed with
|
|
|
|
|
`{CRYPT}` as shown in the example file above.
|
2018-11-16 07:39:57 +00:00
|
|
|
|
|
|
|
|
|
Once the file is created, edit the configuration file with the following
|
2019-03-02 23:25:40 +00:00
|
|
|
|
block (as used in [config.yml](../test/suites/basic/config.yml)):
|
2018-11-16 07:39:57 +00:00
|
|
|
|
|
|
|
|
|
authentication_backend:
|
|
|
|
|
file:
|
2019-11-03 12:07:02 +00:00
|
|
|
|
path: /path/to/the/users_database.yml
|
2018-11-16 07:39:57 +00:00
|
|
|
|
|
|
|
|
|
instead of (used in [config.template.yml](../config.template.yml)):
|
|
|
|
|
|
|
|
|
|
authentication_backend:
|
|
|
|
|
ldap:
|
|
|
|
|
url: ldap://openldap
|
|
|
|
|
base_dn: dc=example,dc=com
|
|
|
|
|
|
|
|
|
|
additional_users_dn: ou=users
|
|
|
|
|
users_filter: cn={0}
|
|
|
|
|
|
|
|
|
|
additional_groups_dn: ou=groups
|
|
|
|
|
groups_filter: (&(member={dn})(objectclass=groupOfNames))
|
|
|
|
|
|
|
|
|
|
group_name_attribute: cn
|
|
|
|
|
|
|
|
|
|
mail_attribute: mail
|
|
|
|
|
|
|
|
|
|
user: cn=admin,dc=example,dc=com
|
|
|
|
|
password: password
|
|
|
|
|
|
|
|
|
|
## FAQ
|
|
|
|
|
|
|
|
|
|
### Can you give more details on why this is not suitable for production environments?
|
|
|
|
|
|
|
|
|
|
This documentation gives instructions that will make **Authelia** non
|
|
|
|
|
highly-available and non scalable by preventing you from running multiple
|
|
|
|
|
instances of the application.
|
|
|
|
|
This means that **Authelia** won't be able to distribute the
|
|
|
|
|
load accross multiple servers and it will prevent failover in case of a
|
|
|
|
|
crash or an hardware issue. Moreover, it will also prevent from reliably
|
|
|
|
|
persisting data and consequently fail access to your platform as the devices
|
|
|
|
|
registered by your users will be lost.
|
|
|
|
|
|
2019-03-02 23:25:40 +00:00
|
|
|
|
### Why aren't all those steps automated?
|
2018-11-16 07:39:57 +00:00
|
|
|
|
|
|
|
|
|
Well, as stated before those instructions are not meant to be applied for
|
|
|
|
|
a production environment. That being said, in some cases it is just fine and
|
2019-03-02 23:25:40 +00:00
|
|
|
|
writing an Ansible playbook to automate all this process is ok.
|
2018-11-17 11:20:39 +00:00
|
|
|
|
We would really be more than happy to review such a PR.
|
2019-03-02 23:25:40 +00:00
|
|
|
|
In the meantime, you can check the *basic* [suite](./suites.md) to see all this
|
2019-11-03 12:07:02 +00:00
|
|
|
|
in a real example.
|
2019-03-02 23:25:40 +00:00
|
|
|
|
|
|
|
|
|
[Getting Started]: ./getting-started.md
|