made this more flexible

This commit is contained in:
Zehka 2020-07-07 14:15:08 +02:00
parent 79943bcaae
commit 66cfdae22f
2 changed files with 17 additions and 5 deletions

View File

@ -30,7 +30,7 @@ services:
- ${DATA_ROOT}/static/:/usr/share/nginx/html - ${DATA_ROOT}/static/:/usr/share/nginx/html
- ./configs/nginx:/etc/nginx - ./configs/nginx:/etc/nginx
labels: labels:
- traefik.frontend.rule=Host:chaospott.de - traefik.frontend.rule=Host:${DOMAIN}
- traefik.port=80 - traefik.port=80
- traefik.docker.network=web - traefik.docker.network=web
networks: networks:
@ -43,11 +43,11 @@ services:
expose: expose:
- 80 - 80
labels: labels:
- traefik.frontend.rule=Host:www.chaospott.de - traefik.frontend.rule=Host:${REDIRECT_DOMAIN}
- traefik.port=80 - traefik.port=80
- traefik.frontend.passHostHeader=true - traefik.frontend.passHostHeader=true
environment: environment:
- dest=https://chaospott.de - dest=https://${DOMAIN}
networks: networks:
extern: extern:

16
init.sh
View File

@ -3,12 +3,22 @@ exe() {
echo "running $@" echo "running $@"
$@ $@
} }
SITE_REPO="https://git.chaospott.de/chaospott/site.git" SITE_REPO_DEFAULT="https://git.chaospott.de/chaospott/site.git"
SITE_DOMAIN_DEFAULT="chaospott.de"
REDIRECT_DOMAIN_DEFAULT="www.chaospott.de"
echo "Where should the site store all volumes?" echo "Where should the site store all volumes?"
read -p "PATH: " VOLUMES_PATH_RAW read -p "PATH: " VOLUMES_PATH_RAW
read -p "Hook endpoint ID (just make something up):" ENDPOINT_ID read -p "Hook endpoint ID (just make something up):" ENDPOINT_ID
read -p "Hook endpoint Password:" ENDPOINT_PW read -p "Hook endpoint Password:" ENDPOINT_PW
read -p "Hook Domain (NOT site domain):" HOOK_DOMAIN read -p "Hook Domain (NOT site domain):" HOOK_DOMAIN
read -p "Repo (Default: Repo for chaospott.de):" SITE_REPO
read -p "Domain (Default: chaospott.de):" SITE_DOMAIN
read -p "Domain(s) to redirect (Default: www.chaospott.de)" REDIRECT_DOMAIN
#set defaults
if [ -z "$SITE_REPO" ]; then SITE_REPO="$SITE_REPO_DEFAULT"; fi
if [ -z "$SITE_DOMAIN" ]; then SITE_DOMAIN="$SITE_DOMAIN_DEFAULT"; fi
if [ -z "$REDIRECT_DOMAIN" ]; then REDIRECT_DOMAIN="$REDIRECT_DOMAIN_DEFAULT"; fi
VOLUMES_PATH=$(echo $VOLUMES_PATH_RAW | sed 's/\/$//g') VOLUMES_PATH=$(echo $VOLUMES_PATH_RAW | sed 's/\/$//g')
echo "Creating volumes structure" echo "Creating volumes structure"
exe mkdir -p $VOLUMES_PATH/static exe mkdir -p $VOLUMES_PATH/static
@ -26,7 +36,9 @@ echo """[
} }
]""" > $VOLUMES_PATH/webhook/hooks.json ]""" > $VOLUMES_PATH/webhook/hooks.json
echo """DATA_ROOT=$VOLUMES_PATH echo """DATA_ROOT=$VOLUMES_PATH
WEBHOOK_DOMAIN=$HOOK_DOMAIN""" > .env WEBHOOK_DOMAIN=$HOOK_DOMAIN
DOMAIN=$SITE_DOMAIN
REDIRECT_DOMAIN=$REDIRECT_DOMAIN""" > .env
exe chmod 777 $VOLUMES_PATH -Rc exe chmod 777 $VOLUMES_PATH -Rc
echo "configure your git with the following hook URL:" echo "configure your git with the following hook URL:"
echo "https://$HOOK_DOMAIN/hooks/$ENDPOINT_ID" echo "https://$HOOK_DOMAIN/hooks/$ENDPOINT_ID"