-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
116 lines (111 loc) · 3.8 KB
/
docker-compose.yml
File metadata and controls
116 lines (111 loc) · 3.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# IPAM Frontend + Backend + Redis Master + Sentinel (Server A)
# 사용법:
# 운영: ./deploy.sh rebuild
#
# 포트 구성:
# - Frontend: 80 (nginx, 정적 파일 + API 프록시)
# - Backend: 내부 (API, context-path: /api)
# - Redis Master: 6379
# - Sentinel: 26379 (host network)
#
# 라우팅 (Frontend nginx):
# - /api/* → Backend
# - /* → 정적 파일
services:
# frontend:
# build: ../ipam-frontend
# container_name: ipam-frontend
# ports:
# - "80:80"
# volumes:
# - ${FRONTEND_LOG_DIR:-./logs/frontend}:/var/log/frontend
# depends_on:
# - backend
# restart: unless-stopped
# networks:
# - app-network
# backend:
# build: .
# container_name: ipam-backend
# expose:
# - "80"
# environment:
# SPRING_PROFILES_ACTIVE: ${SPRING_PROFILES_ACTIVE:-prod}
# SERVER_ID: ${SERVER_ID:-ipam-server-a}
# LOG_DIR: /var/log/ipam
# # Frontend
# FRONTEND_URL: ${FRONTEND_URL}
# # MySQL
# SPRING_DATASOURCE_URL: jdbc:mysql://${MYSQL_HOST}:${MYSQL_PORT}/${MYSQL_DATABASE}?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Seoul
# SPRING_DATASOURCE_USERNAME: ${MYSQL_USERNAME}
# SPRING_DATASOURCE_PASSWORD: ${MYSQL_PASSWORD}
# # Redis (prod: Sentinel 사용, local: 아래 호스트/포트로 standalone 연결)
# SPRING_DATA_REDIS_HOST: ${SPRING_DATA_REDIS_HOST:-redis}
# SPRING_DATA_REDIS_PORT: ${SPRING_DATA_REDIS_PORT:-6379}
# SPRING_DATA_REDIS_PASSWORD: ${REDIS_PASSWORD}
# REDIS_SENTINEL_MASTER: ${REDIS_SENTINEL_MASTER:-mymaster}
# REDIS_SENTINEL_NODES: ${REDIS_SENTINEL_NODES:-}
# # JPA
# SPRING_JPA_HIBERNATE_DDL_AUTO: ${DDL_AUTO:-update}
# SPRING_JPA_SHOW_SQL: ${SHOW_SQL:-false}
# # Keycloak
# KEYCLOAK_SERVER: ${KEYCLOAK_SERVER}
# KEYCLOAK_REALM: ${KEYCLOAK_REALM}
# KEYCLOAK_CLIENT_ID: ${KEYCLOAK_CLIENT_ID}
# KEYCLOAK_CLIENT_SECRET: ${KEYCLOAK_CLIENT_SECRET}
# volumes:
# - ${BACKEND_LOG_DIR:-./logs/backend}:/var/log/ipam
# extra_hosts:
# - "host.docker.internal:host-gateway"
# depends_on:
# - redis
# restart: unless-stopped
# networks:
# - app-network
mysql:
image: mysql:8.0
container_name: mysql
restart: always
ports:
- "3307:3306"
environment:
MYSQL_ROOT_PASSWORD: test1234
MYSQL_ROOT_HOST: '%'
MYSQL_DATABASE: mydb
command:
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_unicode_ci
- --character-set-client-handshake=FALSE
- --init-connect=SET NAMES utf8mb4
redis:
image: redis:7-alpine
container_name: ipam-redis
command: redis-server --requirepass ${REDIS_PASSWORD:-ipam_redis_password}
ports:
- "6379:6379"
volumes:
- redis-data:/data
restart: unless-stopped
networks:
- app-network
# sentinel:
# image: redis:7-alpine
# container_name: ipam-sentinel
# network_mode: host
# command: >-
# sh -c "
# echo 'port 26379' > /tmp/sentinel.conf &&
# echo 'sentinel monitor mymaster ${REDIS_MASTER_IP:-10.150.243.156} 6379 2' >> /tmp/sentinel.conf &&
# echo 'sentinel auth-pass mymaster ${REDIS_PASSWORD:-ipam_redis_password}' >> /tmp/sentinel.conf &&
# echo 'sentinel down-after-milliseconds mymaster 5000' >> /tmp/sentinel.conf &&
# echo 'sentinel failover-timeout mymaster 10000' >> /tmp/sentinel.conf &&
# echo 'sentinel parallel-syncs mymaster 1' >> /tmp/sentinel.conf &&
# echo 'sentinel announce-ip ${ANNOUNCE_IP:-10.150.243.156}' >> /tmp/sentinel.conf &&
# echo 'sentinel announce-port 26379' >> /tmp/sentinel.conf &&
# redis-sentinel /tmp/sentinel.conf"
# restart: unless-stopped
volumes:
redis-data:
networks:
app-network:
driver: bridge