From cf666af1eefeffbb01160856df28599450cef136 Mon Sep 17 00:00:00 2001 From: happybell80 Date: Tue, 8 Jul 2025 00:52:20 +0900 Subject: [PATCH] Handle NAS system service using port 80 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- .github/workflows/deploy.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index bb463e3..161f02a 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -89,12 +89,18 @@ jobs: echo "Deployed to $DEPLOY; backup saved at $BACKUP" - # 5) ํฌํŠธ 80 ์‚ฌ์šฉ ์ค‘์ธ ์ปจํ…Œ์ด๋„ˆ ์ •๋ฆฌ + # 5) ํฌํŠธ 80 ์‚ฌ์šฉ ์ค‘์ธ ์„œ๋น„์Šค ํ™•์ธ ๋ฐ ์ฒ˜๋ฆฌ echo "Checking port 80 usage..." netstat -tlnp | 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 -a --filter "publish=80" -q | xargs -r docker rm