authelia/internal/suites/example/swarm/docker-compose.yml
Amir Zarrinkafsh ff7f9a50ab
[FEATURE] Docker simplification and configuration generation (#1113)
* [FEATURE] Docker simplification and configuration generation
The Authelia binary now will attempt to generate configuration based on the latest template assuming that the config location specified on startup does not exist. If a file based backend is selected and the backend cannot be found similarly it will generate a `user_database.yml` based a template.

This will allow more seamless bootstrapping of an environment no matter the deployment method.

We have also squashed the Docker volume requirement down to just `/config` thus removing the requirement for `/var/lib/authelia` this is primarily in attempts to simplify the Docker deployment.

Users with the old volume mappings have two options:
1. Change their mappings to conform to `/config`
2. Change the container entrypoint from `authelia --config /config/configuration.yml` to their old mapping

* Adjust paths relative to `/etc/authelia` and simplify to single volume for compose
* Add generation for file backend based user database
* Refactor Docker volumes and paths to /config
* Refactor Docker WORKDIR to /app
* Fix integration tests
* Update BREAKING.md for v4.20.0
* Run go mod tidy
* Fix log_file_path in miscellaneous.md docs
* Generate config and userdb with 0600 permissions
* Fix log_file_path in config.template.yml
2020-06-17 16:25:35 +10:00

48 lines
1.5 KiB
YAML

version: '3.4'
services:
authelia:
image: authelia/authelia:latest
# Used for Docker configs
configs:
- source: authelia
target: /config/configuration.yml
uid: '0'
gid: '0'
mode: 0444
environment:
- NODE_TLS_REJECT_UNAUTHORIZED=0
# Where the authelia volume is to be mounted. To only use a single volume, the minimal config needs to be changed to read the users_database.yml also from this subdirectory.
# Otherwise a second volume will need to be configured here to mount the users_database.yml.
volumes:
- authelia:/config/storage
networks:
- overlay
deploy:
#Configure Authelia to automatically restart on failure.
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s
# Mode: global would start authelia on all available nodes, replicated limits it to how many replicas are configured.
mode: replicated
# How many replicas are wanted. Can be any number >0 up to however many nodes are available.
replicas: 1
placement:
constraints:
- node.role == worker
#The volume for authelia needs to be configured. There are many drivers available. Such as local storage, ceph-rdb, nfs, cifs etc.
volumes:
authelia:
driver: default
name: volume-authelia
networks:
overlay:
external: true
# This is needed if Docker configs are being used to provide Authelia with its configuration.
configs:
authelia:
external: true