From ce2d77edfd56b44ffff930ac2c1a0ca932bf583c Mon Sep 17 00:00:00 2001 From: Bnyro Date: Sat, 15 Jun 2024 14:58:17 +0200 Subject: [PATCH] refactor: use BACKEND_HOSTNAME env instead of ash entrypoint --- configure-instance.sh | 9 ++++++--- template/docker-compose.caddy.yml | 7 +++---- template/docker-compose.nginx.yml | 7 +++---- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/configure-instance.sh b/configure-instance.sh index 52e39d0..5e594fd 100755 --- a/configure-instance.sh +++ b/configure-instance.sh @@ -9,8 +9,11 @@ rm -f docker-compose.yml cp -r template/ config/ -sed -i "s/FRONTEND_HOSTNAME/$frontend/g" config/* -sed -i "s/BACKEND_HOSTNAME/$backend/g" config/* -sed -i "s/PROXY_HOSTNAME/$proxy/g" config/* +conffiles=$(find config/ -type f ! -name '*.yml') +sed -i "s/FRONTEND_HOSTNAME/$frontend/g" $conffiles +sed -i "s/BACKEND_HOSTNAME/$backend/g" $conffiles +sed -i "s/PROXY_HOSTNAME/$proxy/g" $conffiles + +sed -i "s/BACKEND_HOSTNAME_PLACEHOLDER/$backend/g" config/*.yml mv config/docker-compose.$reverseproxy.yml docker-compose.yml diff --git a/template/docker-compose.caddy.yml b/template/docker-compose.caddy.yml index ebb6637..13ad8d7 100644 --- a/template/docker-compose.caddy.yml +++ b/template/docker-compose.caddy.yml @@ -1,13 +1,12 @@ -version: "3" - services: - pipedfrontend: + piped-frontend: image: 1337kavin/piped-frontend:latest restart: unless-stopped depends_on: - piped + environment: + BACKEND_HOSTNAME: BACKEND_HOSTNAME_PLACEHOLDER container_name: piped-frontend - entrypoint: ash -c 'sed -i s/pipedapi.kavin.rocks/BACKEND_HOSTNAME/g /usr/share/nginx/html/assets/* && /docker-entrypoint.sh && nginx -g "daemon off;"' piped-proxy: image: 1337kavin/piped-proxy:latest restart: unless-stopped diff --git a/template/docker-compose.nginx.yml b/template/docker-compose.nginx.yml index 2610282..935400f 100644 --- a/template/docker-compose.nginx.yml +++ b/template/docker-compose.nginx.yml @@ -1,13 +1,12 @@ -version: "3" - services: - pipedfrontend: + piped-frontend: image: 1337kavin/piped-frontend:latest restart: unless-stopped depends_on: - piped + environment: + BACKEND_HOSTNAME: BACKEND_HOSTNAME_PLACEHOLDER container_name: piped-frontend - entrypoint: ash -c 'sed -i s/pipedapi.kavin.rocks/BACKEND_HOSTNAME/g /usr/share/nginx/html/assets/* && /docker-entrypoint.sh && nginx -g "daemon off;"' piped-proxy: image: 1337kavin/piped-proxy:latest restart: unless-stopped