-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
150 lines (139 loc) · 4.64 KB
/
docker-compose.yml
File metadata and controls
150 lines (139 loc) · 4.64 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
services:
sportease-traefik:
image: traefik:v2.11
container_name: sportease-traefik
command:
# - "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
- "--entrypoints.websecure.address=:443"
- --entrypoints.local3300.address=:3300
- "--certificatesresolvers.myresolver.acme.httpchallenge=true"
- "--certificatesresolvers.myresolver.acme.httpchallenge.entrypoint=web"
- "--certificatesresolvers.myresolver.acme.email=${LETSENCRYPT_EMAIL}" # IMPORTANT: Change this in .env file!
- "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json"
ports:
- "80:80"
- "443:443"
# - "8080:8080" # Traefik Dashboard
- "3300:3300" # Frontapp"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- "./letsencrypt:/letsencrypt"
networks:
- spotease-public
restart: unless-stopped
sportease-db:
image: mysql:8.0
container_name: sportease-db
command:
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_unicode_ci
environment:
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
MYSQL_DATABASE: ${DB_DATABASE}
MYSQL_USER: ${DB_USER}
MYSQL_PASSWORD: ${DB_PASSWORD}
ports:
- "127.0.0.1:3306:3306"
volumes:
- db-data:/var/lib/mysql
- ./backapp/db/migrations:/docker-entrypoint-initdb.d
- ./backapp/db/conf.d:/etc/mysql/conf.d
networks:
- spotease-internal
restart: always
healthcheck:
test: [ "CMD", "mysqladmin", "ping", "-h", "localhost" ]
interval: 10s
timeout: 5s
retries: 5
sportease-redis:
image: redis:7-alpine
container_name: sportease-redis
networks:
- spotease-internal
restart: always
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
sportease-backapp:
build:
context: ./backapp
container_name: sportease-backapp
env_file:
- .env
volumes:
- uploads-data:/app/uploads
depends_on:
sportease-db:
condition: service_healthy
sportease-redis:
condition: service_healthy
networks:
- spotease-public
- spotease-internal
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://127.0.0.1:8080/api/health | grep -q 'UP'"]
interval: 10s
timeout: 5s
retries: 5
start_period: 15s
labels:
- "traefik.enable=true"
- "traefik.http.routers.uploads-https.rule=Host(`nitsche-gyouji.com`) && PathPrefix(`/uploads`)"
- "traefik.http.routers.uploads-https.entrypoints=websecure"
- "traefik.http.routers.uploads-https.tls.certresolver=myresolver"
- "traefik.http.routers.uploads.rule=Host(`localhost`) && PathPrefix(`/uploads`)"
- "traefik.http.routers.uploads.entrypoints=local3300"
- "traefik.http.services.uploads.loadbalancer.server.port=8080"
sportease-frontapp:
build:
context: ./frontapp
container_name: frontapp
env_file:
- ./frontapp/.env
environment:
- BACKEND_URL=http://sportease-backapp:8080
depends_on:
sportease-backapp:
condition: service_healthy
networks:
- spotease-public
- spotease-internal
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "wget -q --spider http://127.0.0.1:3000"]
interval: 10s
timeout: 5s
retries: 5
start_period: 20s
labels:
- "traefik.enable=true"
# nitsche-gyouji.com用(80/443)
- "traefik.http.routers.frontend-http.rule=Host(`nitsche-gyouji.com`)"
- "traefik.http.routers.frontend-http.entrypoints=web"
#localhost:3300用
- "traefik.http.routers.frontend-localhost.rule=Host(`localhost`)"
- "traefik.http.routers.frontend-localhost.entrypoints=local3300"
# 2. HTTPからHTTPSへリダイレクトするミドルウェアを定義・適用
- "traefik.http.routers.frontend-http.middlewares=redirect-to-https"
- "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
# 3. 既存のHTTPS用ルーター(nitsche-gyouji.comのみ)
- "traefik.http.routers.frontend-https.rule=Host(`nitsche-gyouji.com`)"
- "traefik.http.routers.frontend-https.entrypoints=websecure"
- "traefik.http.routers.frontend-https.tls.certresolver=myresolver"
# サービス設定(変更なし)
- "traefik.http.services.frontend.loadbalancer.server.port=3000"
networks:
spotease-public:
driver: bridge
spotease-internal:
driver: bridge
volumes:
db-data:
uploads-data: