From 690c73e5578470538ae604e1fe90ad11de438ad9 Mon Sep 17 00:00:00 2001 From: Clement Michaud Date: Mon, 4 Sep 2017 21:42:59 +0200 Subject: [PATCH 1/8] Fix installing authelia with npm install -g --- package.json | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 60d720981..ca0cf40f2 100644 --- a/package.json +++ b/package.json @@ -2,9 +2,8 @@ "name": "authelia", "version": "3.2.0", "description": "2FA Single Sign-On server for nginx using LDAP, TOTP and U2F", - "main": "dist/src/server/index.js", "bin": { - "authelia": "dist/src/server/index.js" + "authelia": "./dist/src/server/index.js" }, "scripts": { "test": "./node_modules/.bin/grunt unit-tests", @@ -104,6 +103,10 @@ "u2f-api": "0.0.9", "uglify-es": "^3.0.15" }, + "files": [ + "dist", + "LICENSE" + ], "nyc": { "include": [ "src/*.ts", From 86bb5c5a19a699a4df20c8a23719755ea222145c Mon Sep 17 00:00:00 2001 From: Clement Michaud Date: Mon, 4 Sep 2017 21:51:58 +0200 Subject: [PATCH 2/8] 3.3.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ca0cf40f2..38e4fa36b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "authelia", - "version": "3.2.0", + "version": "3.3.0", "description": "2FA Single Sign-On server for nginx using LDAP, TOTP and U2F", "bin": { "authelia": "./dist/src/server/index.js" From d4a2b5dab9b2db6760da10f5ea082a6da73cf56f Mon Sep 17 00:00:00 2001 From: Clement Michaud Date: Mon, 4 Sep 2017 23:49:11 +0200 Subject: [PATCH 3/8] Try to fix issue with npm publishing --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 38e4fa36b..b32a2e3f7 100644 --- a/package.json +++ b/package.json @@ -104,7 +104,7 @@ "uglify-es": "^3.0.15" }, "files": [ - "dist", + "dist/", "LICENSE" ], "nyc": { From 432568f8f5c406ba923b96a62644ed08668cd417 Mon Sep 17 00:00:00 2001 From: Clement Michaud Date: Mon, 4 Sep 2017 23:49:15 +0200 Subject: [PATCH 4/8] 3.3.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b32a2e3f7..65881b2ee 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "authelia", - "version": "3.3.0", + "version": "3.3.1", "description": "2FA Single Sign-On server for nginx using LDAP, TOTP and U2F", "bin": { "authelia": "./dist/src/server/index.js" From dbb936679c33d52d6adc10a6758acaef32f4699b Mon Sep 17 00:00:00 2001 From: Clement Michaud Date: Tue, 5 Sep 2017 00:43:00 +0200 Subject: [PATCH 5/8] Try to fix issue with npm publishing --- package.json | 4 ---- 1 file changed, 4 deletions(-) diff --git a/package.json b/package.json index 65881b2ee..0560be83d 100644 --- a/package.json +++ b/package.json @@ -103,10 +103,6 @@ "u2f-api": "0.0.9", "uglify-es": "^3.0.15" }, - "files": [ - "dist/", - "LICENSE" - ], "nyc": { "include": [ "src/*.ts", From 85834befb6c37d446c4d38e732e036f094dc9628 Mon Sep 17 00:00:00 2001 From: Clement Michaud Date: Tue, 5 Sep 2017 00:43:06 +0200 Subject: [PATCH 6/8] 3.3.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0560be83d..6b05f9a7a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "authelia", - "version": "3.3.1", + "version": "3.3.2", "description": "2FA Single Sign-On server for nginx using LDAP, TOTP and U2F", "bin": { "authelia": "./dist/src/server/index.js" From fa6134e7f593324a1b92b6d992cec3d39c38ecfb Mon Sep 17 00:00:00 2001 From: FrozenDragoon Date: Tue, 8 Aug 2017 09:03:51 -0500 Subject: [PATCH 7/8] Don't build a new container for ldap, pass the variables via docker-compose. --- example/ldap/Dockerfile | 9 --------- example/ldap/docker-compose.yml | 10 +++++++++- 2 files changed, 9 insertions(+), 10 deletions(-) delete mode 100644 example/ldap/Dockerfile diff --git a/example/ldap/Dockerfile b/example/ldap/Dockerfile deleted file mode 100644 index fbb515eba..000000000 --- a/example/ldap/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM clems4ever/openldap - -ENV SLAPD_ORGANISATION=MyCompany -ENV SLAPD_DOMAIN=example.com -ENV SLAPD_PASSWORD=password -ENV SLAPD_CONFIG_PASSWORD=password -ENV SLAPD_ADDITIONAL_MODULES=memberof -ENV SLAPD_ADDITIONAL_SCHEMAS=openldap -ENV SLAPD_FORCE_RECONFIGURE=true diff --git a/example/ldap/docker-compose.yml b/example/ldap/docker-compose.yml index 0f505a0a1..e991df60b 100644 --- a/example/ldap/docker-compose.yml +++ b/example/ldap/docker-compose.yml @@ -1,7 +1,15 @@ version: '2' services: openldap: - build: ./example/ldap + image: clems4ever/openldap + environment: + - SLAPD_ORGANISATION=MyCompany + - SLAPD_DOMAIN=example.com + - SLAPD_PASSWORD=password + - SLAPD_CONFIG_PASSWORD=password + - SLAPD_ADDITIONAL_MODULES=memberof + - SLAPD_ADDITIONAL_SCHEMAS=openldap + - SLAPD_FORCE_RECONFIGURE=true volumes: - ./example/ldap/base.ldif:/etc/ldap.dist/prepopulate/base.ldif - ./example/ldap/access.rules:/etc/ldap.dist/prepopulate/access.rules From e644fe7b7b0aeda1d05f4e4881d796646fc31ee1 Mon Sep 17 00:00:00 2001 From: FrozenDragoon Date: Tue, 8 Aug 2017 09:03:12 -0500 Subject: [PATCH 8/8] Split example scripts, allow running example using pre-built docker container (example-dockerhub) or build build from source, as it is now (example-commit). --- README.md | 10 ++++++++-- example/authelia/docker-compose.yml | 12 ++++++++++++ scripts/{example => example-commit}/dc-example.sh | 0 .../{example => example-commit}/deploy-example.sh | 2 +- scripts/example-commit/undeploy-example.sh | 5 +++++ scripts/example-dockerhub/dc-example.sh | 11 +++++++++++ scripts/example-dockerhub/deploy-example.sh | 6 ++++++ scripts/example-dockerhub/undeploy-example.sh | 5 +++++ scripts/example/undeploy-example.sh | 5 ----- scripts/integration-tests.sh | 13 +++++++++++-- test/features/step_definitions/hooks.ts | 4 ++-- test/features/step_definitions/resilience.ts | 2 +- 12 files changed, 62 insertions(+), 13 deletions(-) create mode 100644 example/authelia/docker-compose.yml rename scripts/{example => example-commit}/dc-example.sh (100%) rename scripts/{example => example-commit}/deploy-example.sh (63%) create mode 100755 scripts/example-commit/undeploy-example.sh create mode 100755 scripts/example-dockerhub/dc-example.sh create mode 100755 scripts/example-dockerhub/deploy-example.sh create mode 100755 scripts/example-dockerhub/undeploy-example.sh delete mode 100755 scripts/example/undeploy-example.sh diff --git a/README.md b/README.md index bd61219d4..25c99c968 100644 --- a/README.md +++ b/README.md @@ -102,12 +102,18 @@ Add the following lines to your **/etc/hosts** to alias multiple subdomains so t ### Run it! -Deploy **Authelia** example with the following command: +Deploy the **Authelia** example with one of the following commands: + +Build Docker container from current commit: npm install --only=dev ./node_modules/.bin/grunt build-dist - ./scripts/example/deploy-example.sh + ./scripts/example-commit/deploy-example.sh +Use provided container on [DockerHub](https://hub.docker.com/r/clems4ever/authelia/): + + ./scripts/example-dockerhub/deploy-example.sh + After few seconds the services should be running and you should be able to visit [https://home.test.local:8080/](https://home.test.local:8080/). diff --git a/example/authelia/docker-compose.yml b/example/authelia/docker-compose.yml new file mode 100644 index 000000000..9f1f1cb5d --- /dev/null +++ b/example/authelia/docker-compose.yml @@ -0,0 +1,12 @@ +version: '2' +services: + authelia: + image: clems4ever/authelia:latest + restart: always + volumes: + - ./config.template.yml:/etc/authelia/config.yml:ro + - ./notifications:/var/lib/authelia/notifications + depends_on: + - redis + networks: + - example-network diff --git a/scripts/example/dc-example.sh b/scripts/example-commit/dc-example.sh similarity index 100% rename from scripts/example/dc-example.sh rename to scripts/example-commit/dc-example.sh diff --git a/scripts/example/deploy-example.sh b/scripts/example-commit/deploy-example.sh similarity index 63% rename from scripts/example/deploy-example.sh rename to scripts/example-commit/deploy-example.sh index bae41949c..d0cfd5dd9 100755 --- a/scripts/example/deploy-example.sh +++ b/scripts/example-commit/deploy-example.sh @@ -1,6 +1,6 @@ #!/bin/bash -DC_SCRIPT=./scripts/example/dc-example.sh +DC_SCRIPT=./scripts/example-commit/dc-example.sh $DC_SCRIPT build $DC_SCRIPT up -d mongo redis openldap authelia nginx diff --git a/scripts/example-commit/undeploy-example.sh b/scripts/example-commit/undeploy-example.sh new file mode 100755 index 000000000..3ef607fe1 --- /dev/null +++ b/scripts/example-commit/undeploy-example.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +DC_SCRIPT=./scripts/example-commit/dc-example.sh + +$DC_SCRIPT down diff --git a/scripts/example-dockerhub/dc-example.sh b/scripts/example-dockerhub/dc-example.sh new file mode 100755 index 000000000..b72c6a37e --- /dev/null +++ b/scripts/example-dockerhub/dc-example.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +set -e + +docker-compose \ + -f docker-compose.base.yml \ + -f example/authelia/docker-compose.yml \ + -f example/mongo/docker-compose.yml \ + -f example/redis/docker-compose.yml \ + -f example/nginx/docker-compose.yml \ + -f example/ldap/docker-compose.yml $* diff --git a/scripts/example-dockerhub/deploy-example.sh b/scripts/example-dockerhub/deploy-example.sh new file mode 100755 index 000000000..3b71fd1b1 --- /dev/null +++ b/scripts/example-dockerhub/deploy-example.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +DC_SCRIPT=./scripts/example-dockerhub/dc-example.sh + +#$DC_SCRIPT build +$DC_SCRIPT up -d mongo redis openldap authelia nginx diff --git a/scripts/example-dockerhub/undeploy-example.sh b/scripts/example-dockerhub/undeploy-example.sh new file mode 100755 index 000000000..1b943f396 --- /dev/null +++ b/scripts/example-dockerhub/undeploy-example.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +DC_SCRIPT=./scripts/example-dockerhub/dc-example.sh + +$DC_SCRIPT down diff --git a/scripts/example/undeploy-example.sh b/scripts/example/undeploy-example.sh deleted file mode 100755 index 0c3a6f7bd..000000000 --- a/scripts/example/undeploy-example.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -DC_SCRIPT=./scripts/example/dc-example.sh - -$DC_SCRIPT down diff --git a/scripts/integration-tests.sh b/scripts/integration-tests.sh index 10d4973dd..84675b53e 100755 --- a/scripts/integration-tests.sh +++ b/scripts/integration-tests.sh @@ -1,6 +1,6 @@ #!/bin/bash -DC_SCRIPT=./scripts/example/dc-example.sh +DC_SCRIPT=./scripts/example-commit/dc-example.sh EXPECTED_SERVICES_COUNT=5 start_services() { @@ -40,7 +40,13 @@ run_other_tests() { echo "Test dev environment deployment (commands in README)" npm install --only=dev ./node_modules/.bin/grunt build-dist - ./scripts/example/deploy-example.sh + ./scripts/example-commit/deploy-example.sh + expect_services_count 5 +} + +run_other_tests_docker() { + echo "Test dev docker deployment (commands in README)" + ./scripts/example-dockerhub/deploy-example.sh expect_services_count 5 } @@ -58,3 +64,6 @@ run_integration_tests # Other tests like executing the deployment script run_other_tests + +# Test example with precompiled container +run_other_tests_docker \ No newline at end of file diff --git a/test/features/step_definitions/hooks.ts b/test/features/step_definitions/hooks.ts index 708bd3aef..b334ea2aa 100644 --- a/test/features/step_definitions/hooks.ts +++ b/test/features/step_definitions/hooks.ts @@ -11,10 +11,10 @@ Cucumber.defineSupportCode(function({ After, Before }) { }); Before({tags: "@needs-test-config", timeout: 15 * 1000}, function () { - return exec("./scripts/example/dc-example.sh -f docker-compose.test.yml up -d authelia && sleep 2"); + return exec("./scripts/example-commit/dc-example.sh -f docker-compose.test.yml up -d authelia && sleep 2"); }); After({tags: "@needs-test-config", timeout: 15 * 1000}, function () { - return exec("./scripts/example/dc-example.sh up -d authelia && sleep 2"); + return exec("./scripts/example-commit/dc-example.sh up -d authelia && sleep 2"); }); }); \ No newline at end of file diff --git a/test/features/step_definitions/resilience.ts b/test/features/step_definitions/resilience.ts index 1eb5f15a4..ad75a1437 100644 --- a/test/features/step_definitions/resilience.ts +++ b/test/features/step_definitions/resilience.ts @@ -7,6 +7,6 @@ import BluebirdPromise = require("bluebird"); Cucumber.defineSupportCode(function ({ Given, When, Then }) { When(/^the application restarts$/, {timeout: 15 * 1000}, function () { const exec = BluebirdPromise.promisify(ChildProcess.exec); - return exec("./scripts/example/dc-example.sh restart authelia && sleep 2"); + return exec("./scripts/example-commit/dc-example.sh restart authelia && sleep 2"); }); }); \ No newline at end of file