Skip to content

Commit 23ffddb

Browse files
committed
Fix: dev/stg 환경 SSL 인증서 관리 구조 통합
1 parent a26c11d commit 23ffddb

1 file changed

Lines changed: 2 additions & 59 deletions

File tree

infra/docker-compose.stg.yml

Lines changed: 2 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ services:
9393
restart: unless-stopped
9494
volumes:
9595
- ./nginx/nginx.stg.conf:/etc/nginx/nginx.conf:ro
96-
- ./certbot/etc:/etc/letsencrypt:ro
97-
- ./certbot/www:/var/www/certbot:ro
96+
- /srv/docsa/infra/certbot/etc:/etc/letsencrypt:ro
97+
- /srv/docsa/infra/certbot/www:/var/www/certbot:ro
9898
ports:
9999
- "8080:80"
100100
- "8443:443"
@@ -104,63 +104,6 @@ services:
104104
networks:
105105
- docsa_stg_net
106106

107-
# 최초 발급용(수동실행)
108-
certbot_init:
109-
image: certbot/certbot:latest
110-
container_name: docsa-certbot-init-stg
111-
profiles:
112-
- "init"
113-
depends_on:
114-
- nginx
115-
volumes:
116-
- ./certbot/www:/var/www/certbot:rw
117-
- ./certbot/etc:/etc/letsencrypt:rw
118-
- ./certbot/logs:/var/log/letsencrypt:rw
119-
command: >
120-
certonly --webroot
121-
--webroot-path /var/www/certbot
122-
-d stg.api.docsa.o-r.kr
123-
--email qoanstjdsla@gmail.com
124-
--agree-tos --non-interactive
125-
--no-eff-email
126-
127-
# 자동 갱신 데몬(하루마다 확인, 갱신되면 nginx 리로드)
128-
certbot_renew:
129-
image: certbot/certbot:latest
130-
container_name: docsa-certbot-renew-stg
131-
depends_on:
132-
- nginx
133-
volumes:
134-
- ./certbot/www:/var/www/certbot:rw
135-
- ./certbot/etc:/etc/letsencrypt:rw
136-
- ./certbot/logs:/var/log/letsencrypt:rw
137-
- /var/run/docker.sock:/var/run/docker.sock:rw
138-
entrypoint: >
139-
sh -c '
140-
set -eu
141-
142-
# curl 없으면 설치
143-
if ! command -v curl >/dev/null 2>&1; then
144-
if command -v apk >/dev/null 2>&1; then
145-
apk add --no-cache curl >/dev/null 2>&1
146-
else
147-
echo "[ERROR] curl not found and apk not available. Need curl-capable image." >&2
148-
exit 1
149-
fi
150-
fi
151-
152-
while :; do
153-
# renew 실행
154-
certbot renew --webroot -w /var/www/certbot --quiet || true
155-
156-
# nginx 무중단 reload (Docker Engine API)
157-
curl -sS --unix-socket /var/run/docker.sock \
158-
-X POST "http://localhost/v1.41/containers/docsa-nginx-stg/kill?signal=HUP" \
159-
>/dev/null 2>&1 || true
160-
161-
sleep 24h
162-
done
163-
'
164107

165108
# ===== METRICS =====
166109
cadvisor:

0 commit comments

Comments
 (0)