diff --git a/examples/authelia/swarm.yml b/examples/authelia/swarm.yml index 46c980824..6a5382453 100644 --- a/examples/authelia/swarm.yml +++ b/examples/authelia/swarm.yml @@ -4,15 +4,7 @@ services: # APPLICATIONS app1: - image: node - working_dir: /home/node/app - networks: - - bw-services - volumes: - - ./js-app:/home/node/app - environment: - - NODE_ENV=production - command: bash -c "npm install express && node index.js" + image: tutum/hello-world deploy: placement: constraints: @@ -56,9 +48,17 @@ services: image: authelia/authelia networks: - bw-services - volumes: - - ./authelia:/config - restart: unless-stopped + configs: + - source: config_authelia_configuration + target: /config/configuration.yml + uid: "0" + gid: "0" + mode: 0444 + - source: config_authelia_users_database + target: /config/users_database.yml + uid: "0" + gid: "0" + mode: 0444 healthcheck: disable: true environment: @@ -79,10 +79,7 @@ services: networks: - bw-services volumes: - - ./redis:/data - expose: - - 6379 - restart: unless-stopped + - redis:/data environment: - TZ=Europe/Paris deploy: @@ -93,4 +90,13 @@ services: networks: bw-services: external: - name: bw-services \ No newline at end of file + name: bw-services + +volumes: + redis: + +configs: + config_authelia_configuration: + file: ./authelia/configuration.yml + config_authelia_users_database: + file: ./authelia/users_database.yml \ No newline at end of file diff --git a/tests/SwarmTest.py b/tests/SwarmTest.py index d7f390f77..82564aff4 100644 --- a/tests/SwarmTest.py +++ b/tests/SwarmTest.py @@ -32,7 +32,7 @@ class SwarmTest(Test) : compose = "/tmp/swarm/stack.yml" Test.replace_in_file(compose, r"bunkerity/bunkerweb:.*$", "10.20.1.1:5000/bw-tests:latest") Test.replace_in_file(compose, r"bunkerity/bunkerweb-autoconf:.*$", "10.20.1.1:5000/bw-autoconf-tests:latest") - Test.replace_in_file(compose, r"\./bw\-data:/", "/tmp/bw-data:/") + Test.replace_in_file(compose, r"bw\-data:/", "/tmp/bw-data:/") proc = run("docker stack deploy -c stack.yml bunkerweb", cwd="/tmp/swarm", shell=True) if proc.returncode != 0 : raise(Exception("docker stack deploy failed (swarm stack)")) @@ -60,7 +60,7 @@ class SwarmTest(Test) : proc = run("docker stack rm bunkerweb", shell=True) if proc.returncode != 0 : ret = False - proc = run("docker network rm services_net autoconf_net", shell=True) + proc = run("docker network rm bw-services bw-autoconf", shell=True) if proc.returncode != 0 : ret = False rmtree("/tmp/swarm") @@ -118,5 +118,5 @@ class SwarmTest(Test) : run("docker service logs bunkerweb_mybunker", shell=True) run("docker service logs bunkerweb_myautoconf", shell=True) proc = run('docker stack services --format "{{ .Name }}" "' + self._name + '"', shell=True, capture_output=True) - for service in proc.stdout.decode().readlines() : + for service in proc.stdout.decode().splitlines() : run('docker service logs "' + service + '"', shell=True) \ No newline at end of file