diff --git a/builder/build.sh b/builder/build.sh index 069034e..6568ca4 100755 --- a/builder/build.sh +++ b/builder/build.sh @@ -136,7 +136,7 @@ routes = [r for r in routes if not (isinstance(r, dict) and any(isinstance(m, dict) and new_host in m.get('host', []) for m in r.get('match', [])))] -routes.append(json.loads(sys.argv[1])) +routes.insert(0, json.loads(sys.argv[1])) print(json.dumps(routes)) " "$ROUTE_JSON") diff --git a/infra/docker-compose.yml b/infra/docker-compose.yml index 60d6e97..4b66238 100644 --- a/infra/docker-compose.yml +++ b/infra/docker-compose.yml @@ -43,9 +43,10 @@ services: - "443:443" - "2019:2019" # admin API volumes: - - ../proxy/Caddyfile:/etc/caddy/Caddyfile:ro + - ../proxy/caddy.json:/etc/caddy/caddy.json:ro - caddy-data:/data - caddy-config:/config + command: caddy run --config /etc/caddy/caddy.json networks: - hiy-net - default diff --git a/proxy/caddy.json b/proxy/caddy.json new file mode 100644 index 0000000..9284561 --- /dev/null +++ b/proxy/caddy.json @@ -0,0 +1,24 @@ +{ + "admin": { + "listen": "0.0.0.0:2019" + }, + "apps": { + "http": { + "servers": { + "hiy": { + "listen": [":80", ":443"], + "routes": [ + { + "handle": [ + { + "handler": "reverse_proxy", + "upstreams": [{"dial": "server:3000"}] + } + ] + } + ] + } + } + } + } +}