made this more flexible

This commit is contained in:
Zehka 2020-07-07 14:15:08 +02:00
父節點 79943bcaae
當前提交 66cfdae22f
共有 2 個文件被更改,包括 17 次插入5 次删除

查看文件

@ -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:

16
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"