From 192219578ac433482c093591fea16ef718fdd529 Mon Sep 17 00:00:00 2001 From: Mike <24802844+hoflogic@users.noreply.github.com> Date: Mon, 2 Aug 2021 14:29:45 +1000 Subject: [PATCH] fix(examples): change config in example projects to solve startup issues (#2199) * fix(configuration): change config in example projects to solve startup issues * fix(configuration): use new log level key * fix(configuration): remove redundant docker-compose error message Co-authored-by: hoflogic Co-authored-by: James Elliott Co-authored-by: Amir Zarrinkafsh --- .../compose/lite/authelia/users_database.yml | 2 +- examples/compose/lite/docker-compose.yml | 8 ++++---- examples/compose/local/setup.sh | 18 +++++++++++------- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/examples/compose/lite/authelia/users_database.yml b/examples/compose/lite/authelia/users_database.yml index 5ee86289f..8785bebe9 100644 --- a/examples/compose/lite/authelia/users_database.yml +++ b/examples/compose/lite/authelia/users_database.yml @@ -9,7 +9,7 @@ users: authelia: displayname: "Authelia User" - # Password is Authelia + # Password is authelia password: "$6$rounds=50000$BpLnfgDsc2WD8F2q$Zis.ixdg9s/UOJYrs56b5QEZFiZECu0qZVNsIYxBaNJ7ucIL.nlxVCT5tqh8KHG8X4tlwCFm5r6NTOZZ5qRFN/" # yamllint disable-line rule:line-length email: authelia@authelia.com groups: diff --git a/examples/compose/lite/docker-compose.yml b/examples/compose/lite/docker-compose.yml index 00dfbe325..2c14ca8c1 100644 --- a/examples/compose/lite/docker-compose.yml +++ b/examples/compose/lite/docker-compose.yml @@ -15,11 +15,11 @@ services: - net labels: - 'traefik.enable=true' - - 'traefik.http.routers.authelia.rule=Host(`auth.example.com`)' + - 'traefik.http.routers.authelia.rule=Host(`authelia.example.com`)' - 'traefik.http.routers.authelia.entrypoints=https' - 'traefik.http.routers.authelia.tls=true' - 'traefik.http.routers.authelia.tls.certresolver=letsencrypt' - - 'traefik.http.middlewares.authelia.forwardauth.address=http://authelia:9091/api/verify?rd=https://auth.example.com' # yamllint disable-line rule:line-length + - 'traefik.http.middlewares.authelia.forwardauth.address=http://authelia:9091/api/verify?rd=https://authelia.example.com' # yamllint disable-line rule:line-length - 'traefik.http.middlewares.authelia.forwardauth.trustForwardHeader=true' - 'traefik.http.middlewares.authelia.forwardauth.authResponseHeaders=Remote-User,Remote-Groups,Remote-Name,Remote-Email' # yamllint disable-line rule:line-length expose: @@ -47,7 +47,7 @@ services: image: traefik:2.4 container_name: traefik volumes: - - ./traefik/acme.json:/acme.json + - ./traefik:/etc/traefik - /var/run/docker.sock:/var/run/docker.sock networks: - net @@ -73,7 +73,7 @@ services: - '--entrypoints.https=true' - '--entrypoints.https.address=:443' - '--certificatesResolvers.letsencrypt.acme.email=your-email@your-domain.com' - - '--certificatesResolvers.letsencrypt.acme.storage=acme.json' + - '--certificatesResolvers.letsencrypt.acme.storage=/etc/traefik/acme.json' - '--certificatesResolvers.letsencrypt.acme.httpChallenge.entryPoint=http' - '--log=true' - '--log.level=DEBUG' diff --git a/examples/compose/local/setup.sh b/examples/compose/local/setup.sh index d686931ae..9a0dc65dd 100755 --- a/examples/compose/local/setup.sh +++ b/examples/compose/local/setup.sh @@ -32,18 +32,18 @@ if [[ ! -x "$(command -v docker-compose)" ]]; then exit 1 fi -echo "Pulling Authelia docker image for setup" -docker pull authelia/authelia > /dev/null - if [[ $(id -u) != 0 ]]; then echo "The script requires root access to perform some functions such as modifying your /etc/hosts file" read -rp "Would you like to elevate access with sudo? [y/N] " confirmsudo if ! [[ "$confirmsudo" =~ ^([yY][eE][sS]|[yY])$ ]]; then echo "Sudo elevation denied, exiting" - exit + exit 1 fi fi +echo "Pulling Authelia docker image for setup" +sudo docker pull authelia/authelia > /dev/null + echo "Resetting docker-compose.yml, configuration.yml and users_database.yml" sudo git checkout -- docker-compose.yml authelia/configuration.yml authelia/users_database.yml @@ -60,7 +60,7 @@ if [[ $MODIFIED == "false" ]]; then fi echo "Generating SSL certificate for *.$DOMAIN" -docker run -a stdout -v $PWD/traefik/certs:/tmp/certs authelia/authelia authelia certificates generate --host *.$DOMAIN --dir /tmp/certs/ > /dev/null +sudo docker run -a stdout -v $PWD/traefik/certs:/tmp/certs authelia/authelia authelia certificates generate --host *.$DOMAIN --dir /tmp/certs/ > /dev/null if [[ $DOMAIN != "example.com" ]]; then if [[ $(uname) == "Darwin" ]]; then @@ -99,7 +99,7 @@ fi password if [[ $PASSWORD != "" ]]; then - PASSWORD=$(docker run authelia/authelia authelia hash-password $PASSWORD | sed 's/Password hash: //g') + PASSWORD=$(sudo docker run authelia/authelia authelia hash-password $PASSWORD | sed 's/Password hash: //g') if [[ $(uname) == "Darwin" ]]; then sudo sed -i '' "s//$(echo $PASSWORD | sed -e 's/[\/&]/\\&/g')/g" authelia/users_database.yml else @@ -110,7 +110,11 @@ else password fi -docker-compose up -d +sudo docker-compose up -d + +if [[ $? != 0 ]]; then + exit 1 +fi cat << EOF Setup completed successfully.