generated from coop-cloud/example
Init this thing too
This commit is contained in:
parent
ed92960c47
commit
7defc326ff
18
README.md
18
README.md
|
@ -3,14 +3,16 @@
|
||||||
Community Keycloak SSO user management.
|
Community Keycloak SSO user management.
|
||||||
|
|
||||||
<!-- metadata -->
|
<!-- metadata -->
|
||||||
* **Category**:
|
|
||||||
* **Status**:
|
- **Category**:
|
||||||
* **Image**: [`keycloak-collective-portal`](https://hub.docker.com/r/keycloak-collective-portal/keycloak-collective-portal)
|
- **Status**:
|
||||||
* **Healthcheck**:
|
- **Image**: [`decentral1se/keycloak-collective-portal`](https://hub.docker.com/r/decentral1se/keycloak-collective-portal)
|
||||||
* **Backups**:
|
- **Healthcheck**:
|
||||||
* **Email**:
|
- **Backups**:
|
||||||
* **Tests**:
|
- **Email**:
|
||||||
* **SSO**:
|
- **Tests**:
|
||||||
|
- **SSO**:
|
||||||
|
|
||||||
<!-- endmetadata -->
|
<!-- endmetadata -->
|
||||||
|
|
||||||
## Basic usage
|
## Basic usage
|
||||||
|
|
62
compose.yml
62
compose.yml
|
@ -2,30 +2,50 @@
|
||||||
version: "3.8"
|
version: "3.8"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
web:
|
||||||
|
image: nginx:1.21.0
|
||||||
|
environment:
|
||||||
|
- STACK_NAME=${STACK_NAME}
|
||||||
|
- DOMAIN=${DOMAIN}
|
||||||
|
configs:
|
||||||
|
- source: nginx_conf
|
||||||
|
target: /etc/nginx/nginx.conf
|
||||||
|
networks:
|
||||||
|
- proxy
|
||||||
|
- internal
|
||||||
|
deploy:
|
||||||
|
update_config:
|
||||||
|
failure_action: rollback
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=true"
|
||||||
|
- "traefik.http.services.wiki.loadbalancer.server.port=80"
|
||||||
|
- "traefik.http.routers.wiki.rule=Host(`${DOMAIN}`)"
|
||||||
|
- "traefik.http.routers.wiki.entrypoints=web-secure"
|
||||||
|
- "traefik.http.routers.wiki.tls.certresolver=production"
|
||||||
|
|
||||||
app:
|
app:
|
||||||
image: nginx:1.19.2
|
image: "decentral1se/keycloak-collective-portal:latest"
|
||||||
networks:
|
networks:
|
||||||
- proxy
|
- internal
|
||||||
deploy:
|
configs:
|
||||||
restart_policy:
|
- source: entrypoint_sh
|
||||||
condition: on-failure
|
target: /usr/local/bin/entrypoint.sh
|
||||||
labels:
|
mode: 0555
|
||||||
- "traefik.enable=true"
|
entrypoint: /usr/local/bin/entrypoint.sh
|
||||||
- "traefik.http.services.${STACK_NAME}.loadbalancer.server.port=80"
|
command: uvivorn --host 0.0.0.0 keycloak_collective_portal:app
|
||||||
- "traefik.http.routers.${STACK_NAME}.rule=Host(`${DOMAIN}`${EXTRA_DOMAINS})"
|
|
||||||
- "traefik.http.routers.${STACK_NAME}.entrypoints=web-secure"
|
|
||||||
- "traefik.http.routers.${STACK_NAME}.tls.certresolver=${LETS_ENCRYPT_ENV}"
|
|
||||||
## Redirect from EXTRA_DOMAINS to DOMAIN
|
|
||||||
#- "traefik.http.routers.${STACK_NAME}.middlewares=${STACK_NAME}-redirect"
|
|
||||||
#- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLForceHost=true"
|
|
||||||
#- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLHost=${DOMAIN}"
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "curl", "-f", "http://localhost"]
|
|
||||||
interval: 30s
|
|
||||||
timeout: 10s
|
|
||||||
retries: 10
|
|
||||||
start_period: 1m
|
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
proxy:
|
proxy:
|
||||||
external: true
|
external: true
|
||||||
|
internal:
|
||||||
|
internal: true
|
||||||
|
|
||||||
|
configs:
|
||||||
|
nginx_conf:
|
||||||
|
name: ${STACK_NAME}_nginx_conf_${NGINX_CONF_VERSION}
|
||||||
|
file: nginx.conf.tmpl
|
||||||
|
template_driver: golang
|
||||||
|
entrypoint_sh:
|
||||||
|
name: ${STACK_NAME}_entrypoint_conf_${ENTRYPOINT_CONF_VERSION}
|
||||||
|
file: entrypoint.sh.tmpl
|
||||||
|
template_driver: golang
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
file_env() {
|
||||||
|
local var="$1"
|
||||||
|
local fileVar="${var}_FILE"
|
||||||
|
local def="${2:-}"
|
||||||
|
|
||||||
|
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
|
||||||
|
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local val="$def"
|
||||||
|
if [ "${!var:-}" ]; then
|
||||||
|
val="${!var}"
|
||||||
|
elif [ "${!fileVar:-}" ]; then
|
||||||
|
val="$(< "${!fileVar}")"
|
||||||
|
fi
|
||||||
|
|
||||||
|
export "$var"="$val"
|
||||||
|
unset "$fileVar"
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "Passing it back to the upstream ENTRYPOINT/CMD..."
|
||||||
|
exec "$@"
|
|
@ -0,0 +1,36 @@
|
||||||
|
user www-data;
|
||||||
|
|
||||||
|
events {
|
||||||
|
worker_connections 768;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
upstream backend {
|
||||||
|
server {{ env "STACK_NAME" }}_app:8000;
|
||||||
|
}
|
||||||
|
|
||||||
|
include /etc/nginx/mime.types;
|
||||||
|
client_max_body_size 25M;
|
||||||
|
charset utf-8;
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80 default;
|
||||||
|
server_name {{ env "DOMAIN" }};
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri @proxy_to_app;
|
||||||
|
}
|
||||||
|
|
||||||
|
location @proxy_to_app {
|
||||||
|
proxy_pass http://backend;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection "upgrade";
|
||||||
|
proxy_redirect off;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Host $server_name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue