mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
Merge pull request #51 from clems4ever/fix-deployment
Fix deployment of example using dedicated script
This commit is contained in:
commit
cdf6a73bdf
|
@ -3,8 +3,7 @@ services:
|
|||
nginx:
|
||||
image: nginx:alpine
|
||||
volumes:
|
||||
- ./example/nginx/index.html:/usr/share/nginx/html/index.html
|
||||
- ./example/nginx/secret.html:/usr/share/nginx/html/secret.html
|
||||
- ./example/nginx/html:/usr/share/nginx/html
|
||||
- ./example/nginx/ssl:/etc/ssl
|
||||
- ./example/nginx/nginx.conf:/etc/nginx/nginx.conf
|
||||
ports:
|
||||
|
|
BIN
example/nginx/html/icon.png
Normal file
BIN
example/nginx/html/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
|
@ -1,6 +1,8 @@
|
|||
<!DOCTYPE>
|
||||
<html>
|
||||
<head>
|
||||
<title>Home page</title>
|
||||
<link rel="icon" href="/icon.png" type="image/png" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>Access the secret</h1>
|
|
@ -1,6 +1,7 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Secret</title>
|
||||
<link rel="icon" href="/icon.png" type="image/png" />
|
||||
</head>
|
||||
<body>
|
||||
This is a very important secret!<br/>
|
|
@ -1,14 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
service_count=`docker ps -a | grep "Up " | wc -l`
|
||||
|
||||
if [ "${service_count}" -eq "5" ]
|
||||
then
|
||||
echo "Service are up and running."
|
||||
exit 0
|
||||
else
|
||||
echo "Some services exited..."
|
||||
docker ps -a
|
||||
exit 1
|
||||
fi
|
||||
|
|
@ -3,4 +3,4 @@
|
|||
DC_SCRIPT=./scripts/example/dc-example.sh
|
||||
|
||||
$DC_SCRIPT build
|
||||
$DC_SCRIPT up -d
|
||||
$DC_SCRIPT up -d redis openldap authelia nginx
|
||||
|
|
|
@ -2,21 +2,30 @@
|
|||
|
||||
DC_SCRIPT=./scripts/example/dc-example.sh
|
||||
|
||||
run_services() {
|
||||
$DC_SCRIPT up -d redis openldap
|
||||
sleep 2
|
||||
$DC_SCRIPT up -d authelia nginx nginx-tests
|
||||
start_services() {
|
||||
$DC_SCRIPT up -d redis openldap authelia nginx nginx-tests
|
||||
sleep 3
|
||||
}
|
||||
|
||||
set -e
|
||||
|
||||
echo "Make sure services are not already running"
|
||||
shut_services() {
|
||||
$DC_SCRIPT down
|
||||
}
|
||||
|
||||
expect_services_count() {
|
||||
EXPECTED_COUNT=$1
|
||||
service_count=`docker ps -a | grep "Up " | wc -l`
|
||||
|
||||
# Prepare & run integration tests
|
||||
if [ "${service_count}" -eq "$EXPECTED_COUNT" ]
|
||||
then
|
||||
echo "Services are up and running."
|
||||
else
|
||||
echo "Some services exited..."
|
||||
docker ps -a
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
run_integration_tests() {
|
||||
echo "Prepare nginx-test configuration"
|
||||
cat example/nginx/nginx.conf | sed 's/listen 443 ssl/listen 8080 ssl/g' | dd of="test/integration/nginx.conf"
|
||||
|
||||
|
@ -24,7 +33,7 @@ echo "Build services images..."
|
|||
$DC_SCRIPT build
|
||||
|
||||
echo "Start services..."
|
||||
run_services
|
||||
start_services
|
||||
docker ps -a
|
||||
|
||||
echo "Display services logs..."
|
||||
|
@ -35,20 +44,46 @@ $DC_SCRIPT logs nginx-tests
|
|||
$DC_SCRIPT logs authelia
|
||||
|
||||
echo "Check number of services"
|
||||
./scripts/example/check-services.sh
|
||||
expect_services_count 5
|
||||
|
||||
echo "Run integration tests..."
|
||||
$DC_SCRIPT run --rm integration-tests
|
||||
|
||||
echo "Shutdown services..."
|
||||
$DC_SCRIPT down
|
||||
|
||||
# Prepare & test example from end user perspective
|
||||
shut_services
|
||||
}
|
||||
|
||||
run_system_tests() {
|
||||
echo "Start services..."
|
||||
run_services
|
||||
start_services
|
||||
expect_services_count 5
|
||||
|
||||
./node_modules/.bin/mocha --compilers ts:ts-node/register --recursive test/system
|
||||
shut_services
|
||||
}
|
||||
|
||||
$DC_SCRIPT down
|
||||
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
|
||||
expect_services_count 4
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
set -e
|
||||
|
||||
echo "Make sure services are not already running"
|
||||
shut_services
|
||||
|
||||
# Prepare & run integration tests
|
||||
run_integration_tests
|
||||
|
||||
# Prepare & test example from end user perspective
|
||||
run_system_tests
|
||||
|
||||
# Other tests like executing the deployment script
|
||||
run_other_tests
|
||||
|
|
|
@ -4,7 +4,7 @@ html
|
|||
head
|
||||
title Authelia - 2FA
|
||||
meta(name="viewport", content="width=device-width, initial-scale=1.0")/
|
||||
link(rel="icon", href="/img/icon.png" type="image/gif" sizes="32x32")/
|
||||
link(rel="icon", href="/img/icon.png" type="image/png" sizes="32x32")/
|
||||
link(rel="stylesheet", type="text/css", href="/css/authelia.min.css")/
|
||||
if redirection_url
|
||||
<meta http-equiv="refresh" content="5;url=#{redirection_url}">
|
||||
|
|
|
@ -11,8 +11,7 @@ services:
|
|||
nginx-tests:
|
||||
image: nginx:alpine
|
||||
volumes:
|
||||
- ./example/nginx/index.html:/usr/share/nginx/html/index.html
|
||||
- ./example/nginx/secret.html:/usr/share/nginx/html/secret.html
|
||||
- ./example/nginx/html:/usr/share/nginx/html
|
||||
- ./example/nginx/ssl:/etc/ssl
|
||||
- ./test/integration/nginx.conf:/etc/nginx/nginx.conf
|
||||
expose:
|
||||
|
|
Loading…
Reference in New Issue
Block a user