forked from baron/baron-sso
gateway 분리 적용
This commit is contained in:
@@ -48,6 +48,24 @@ services:
|
||||
networks:
|
||||
- baron_net
|
||||
|
||||
gateway:
|
||||
build:
|
||||
context: ./gateway
|
||||
dockerfile: Dockerfile
|
||||
container_name: baron_gateway
|
||||
restart: always
|
||||
ports:
|
||||
- "${USERFRONT_PORT:-5000}:5000"
|
||||
networks:
|
||||
- baron_net
|
||||
- public_net
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:5000/"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
start_period: 10s
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
clickhouse_data:
|
||||
@@ -58,3 +76,7 @@ networks:
|
||||
name: baron_net
|
||||
external: true
|
||||
driver: bridge
|
||||
public_net:
|
||||
name: public_net
|
||||
external: true
|
||||
|
||||
|
||||
@@ -82,28 +82,6 @@ services:
|
||||
networks:
|
||||
- baron_net
|
||||
|
||||
gateway:
|
||||
build:
|
||||
context: ./gateway
|
||||
dockerfile: Dockerfile
|
||||
container_name: baron_gateway
|
||||
restart: always
|
||||
ports:
|
||||
- "${USERFRONT_PORT:-5000}:5000"
|
||||
networks:
|
||||
- baron_net
|
||||
- public_net
|
||||
depends_on:
|
||||
backend:
|
||||
condition: service_healthy
|
||||
userfront:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:5000/"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
start_period: 10s
|
||||
userfront:
|
||||
build:
|
||||
context: ./userfront
|
||||
|
||||
31
gateway/entrypoint.sh
Normal file
31
gateway/entrypoint.sh
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
|
||||
# 대상 호스트와 포트가 준비될 때까지 대기하는 함수
|
||||
wait_for_host() {
|
||||
host=$1
|
||||
port=$2
|
||||
name=$3
|
||||
|
||||
echo "Waiting for $name ($host:$port)..."
|
||||
|
||||
# 최대 30초 동안 대기
|
||||
count=0
|
||||
until nc -z $host $port || [ $count -eq 30 ]; do
|
||||
sleep 1
|
||||
count=$((count + 1))
|
||||
done
|
||||
|
||||
if [ $count -eq 30 ]; then
|
||||
echo "Timeout waiting for $name"
|
||||
else
|
||||
echo "$name is ready!"
|
||||
fi
|
||||
}
|
||||
|
||||
# 백엔드와 유저프론트 대기 (Oathkeeper는 인프라 레벨이므로 함께 뜰 가능성이 높지만 안전을 위해 포함)
|
||||
wait_for_host "baron_backend" 3000 "Backend"
|
||||
wait_for_host "baron_userfront" 5000 "UserFront"
|
||||
wait_for_host "oathkeeper" 4455 "Oathkeeper"
|
||||
|
||||
echo "All dependencies are up. Starting Nginx..."
|
||||
exec nginx -g 'daemon off;'
|
||||
Reference in New Issue
Block a user