Browse Source

made this more flexible

master
Zehka 4 months ago
parent
commit
66cfdae22f
2 changed files with 17 additions and 5 deletions
  1. 3
    3
      docker-compose.yml
  2. 14
    2
      init.sh

+ 3
- 3
docker-compose.yml View File

@@ -30,7 +30,7 @@ services:
30 30
       - ${DATA_ROOT}/static/:/usr/share/nginx/html
31 31
       - ./configs/nginx:/etc/nginx
32 32
     labels:
33
-      - traefik.frontend.rule=Host:chaospott.de
33
+      - traefik.frontend.rule=Host:${DOMAIN}
34 34
       - traefik.port=80
35 35
       - traefik.docker.network=web
36 36
     networks:
@@ -43,11 +43,11 @@ services:
43 43
       expose:
44 44
         - 80
45 45
       labels:
46
-        - traefik.frontend.rule=Host:www.chaospott.de
46
+        - traefik.frontend.rule=Host:${REDIRECT_DOMAIN}
47 47
         - traefik.port=80
48 48
         - traefik.frontend.passHostHeader=true
49 49
       environment:
50
-        - dest=https://chaospott.de
50
+        - dest=https://${DOMAIN}
51 51
       networks:
52 52
         extern:
53 53
 

+ 14
- 2
init.sh View File

@@ -3,12 +3,22 @@ exe() {
3 3
 	echo "running $@"
4 4
 	$@
5 5
 }
6
-SITE_REPO="https://git.chaospott.de/chaospott/site.git"
6
+SITE_REPO_DEFAULT="https://git.chaospott.de/chaospott/site.git"
7
+SITE_DOMAIN_DEFAULT="chaospott.de"
8
+REDIRECT_DOMAIN_DEFAULT="www.chaospott.de"
7 9
 echo "Where should the site store all volumes?"
8 10
 read -p "PATH: " VOLUMES_PATH_RAW
9 11
 read -p "Hook endpoint ID (just make something up):" ENDPOINT_ID
10 12
 read -p "Hook endpoint Password:" ENDPOINT_PW
11 13
 read -p "Hook Domain (NOT site domain):" HOOK_DOMAIN
14
+read -p "Repo (Default: Repo for chaospott.de):" SITE_REPO
15
+read -p "Domain (Default: chaospott.de):" SITE_DOMAIN
16
+read -p "Domain(s) to redirect (Default: www.chaospott.de)" REDIRECT_DOMAIN
17
+#set defaults
18
+if [ -z "$SITE_REPO" ]; then SITE_REPO="$SITE_REPO_DEFAULT"; fi
19
+if [ -z "$SITE_DOMAIN" ]; then SITE_DOMAIN="$SITE_DOMAIN_DEFAULT"; fi
20
+if [ -z "$REDIRECT_DOMAIN" ]; then REDIRECT_DOMAIN="$REDIRECT_DOMAIN_DEFAULT"; fi
21
+
12 22
 VOLUMES_PATH=$(echo $VOLUMES_PATH_RAW | sed 's/\/$//g')
13 23
 echo "Creating volumes structure" 
14 24
 exe mkdir -p $VOLUMES_PATH/static
@@ -26,7 +36,9 @@ echo """[
26 36
         }
27 37
 ]""" > $VOLUMES_PATH/webhook/hooks.json
28 38
 echo """DATA_ROOT=$VOLUMES_PATH
29
-WEBHOOK_DOMAIN=$HOOK_DOMAIN""" > .env
39
+WEBHOOK_DOMAIN=$HOOK_DOMAIN
40
+DOMAIN=$SITE_DOMAIN
41
+REDIRECT_DOMAIN=$REDIRECT_DOMAIN""" > .env
30 42
 exe chmod 777 $VOLUMES_PATH -Rc
31 43
 echo "configure your git with the following hook URL:"
32 44
 echo "https://$HOOK_DOMAIN/hooks/$ENDPOINT_ID"

Loading…
Cancel
Save