diff --git a/docker-compose.yml b/docker-compose.yml index bce9682..11ca222 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -30,7 +30,7 @@ services: - ${DATA_ROOT}/static/:/usr/share/nginx/html - ./configs/nginx:/etc/nginx labels: - - traefik.frontend.rule=Host:chaospott.de + - traefik.frontend.rule=Host:${DOMAIN} - traefik.port=80 - traefik.docker.network=web networks: @@ -43,11 +43,11 @@ services: expose: - 80 labels: - - traefik.frontend.rule=Host:www.chaospott.de + - traefik.frontend.rule=Host:${REDIRECT_DOMAIN} - traefik.port=80 - traefik.frontend.passHostHeader=true environment: - - dest=https://chaospott.de + - dest=https://${DOMAIN} networks: extern: diff --git a/init.sh b/init.sh index eaefda7..f9019b3 100755 --- a/init.sh +++ b/init.sh @@ -3,12 +3,22 @@ exe() { 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?" read -p "PATH: " VOLUMES_PATH_RAW read -p "Hook endpoint ID (just make something up):" ENDPOINT_ID read -p "Hook endpoint Password:" ENDPOINT_PW 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') echo "Creating volumes structure" exe mkdir -p $VOLUMES_PATH/static @@ -26,7 +36,9 @@ echo """[ } ]""" > $VOLUMES_PATH/webhook/hooks.json 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 echo "configure your git with the following hook URL:" echo "https://$HOOK_DOMAIN/hooks/$ENDPOINT_ID"