Handle NAS system service using port 80

- Detect if system service (DSM/Web Station) uses port 80
- Automatically switch nginx to port 8080 if port 80 is occupied
- Avoid touching system services, only manage Docker containers
- Prevents conflicts with Synology NAS built-in services

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
happybell80 2025-07-08 00:52:20 +09:00
parent 9b8712237c
commit cf666af1ee

View File

@ -89,12 +89,18 @@ jobs:
echo "Deployed to $DEPLOY; backup saved at $BACKUP" echo "Deployed to $DEPLOY; backup saved at $BACKUP"
# 5) 포트 80 사용 중인 컨테이너 정 # 5) 포트 80 사용 중인 서비스 확인 및 처
echo "Checking port 80 usage..." echo "Checking port 80 usage..."
netstat -tlnp | grep :80 || true netstat -tlnp | grep :80 || true
docker ps --format "table {{.Names}}\t{{.Ports}}" | grep ":80" || true docker ps --format "table {{.Names}}\t{{.Ports}}" | grep ":80" || true
# 포트 80 사용하는 모든 컨테이너 정지 # NAS 시스템 서비스가 80포트 사용 중이면 nginx를 8080으로 실행
if netstat -tln | grep -q ":80.*LISTEN"; then
echo "Port 80 is used by system service, switching nginx to port 8080"
sed -i 's/80:80/8080:80/g' "$DEPLOY/docker-compose.yml"
fi
# Docker 컨테이너만 정리 (시스템 서비스는 건드리지 않음)
docker ps --filter "publish=80" -q | xargs -r docker stop docker ps --filter "publish=80" -q | xargs -r docker stop
docker ps -a --filter "publish=80" -q | xargs -r docker rm docker ps -a --filter "publish=80" -q | xargs -r docker rm