mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
Merge pull request #64 from FrozenDragoon/feature-dockercompose
Don't build Docker container from source for the example
This commit is contained in:
commit
9ac2c808ec
10
README.md
10
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/).
|
||||
|
||||
|
|
12
example/authelia/docker-compose.yml
Normal file
12
example/authelia/docker-compose.yml
Normal file
|
@ -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
|
|
@ -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
|
|
@ -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
|
||||
|
|
|
@ -2,9 +2,8 @@
|
|||
"name": "authelia",
|
||||
"version": "3.3.19",
|
||||
"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",
|
||||
|
|
|
@ -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
|
5
scripts/example-commit/undeploy-example.sh
Executable file
5
scripts/example-commit/undeploy-example.sh
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
DC_SCRIPT=./scripts/example-commit/dc-example.sh
|
||||
|
||||
$DC_SCRIPT down
|
11
scripts/example-dockerhub/dc-example.sh
Executable file
11
scripts/example-dockerhub/dc-example.sh
Executable file
|
@ -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 $*
|
6
scripts/example-dockerhub/deploy-example.sh
Executable file
6
scripts/example-dockerhub/deploy-example.sh
Executable file
|
@ -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
|
5
scripts/example-dockerhub/undeploy-example.sh
Executable file
5
scripts/example-dockerhub/undeploy-example.sh
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
DC_SCRIPT=./scripts/example-dockerhub/dc-example.sh
|
||||
|
||||
$DC_SCRIPT down
|
|
@ -1,5 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
DC_SCRIPT=./scripts/example/dc-example.sh
|
||||
|
||||
$DC_SCRIPT down
|
|
@ -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
|
|
@ -15,10 +15,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");
|
||||
});
|
||||
});
|
|
@ -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");
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue
Block a user