-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
137 lines (127 loc) · 4.53 KB
/
Copy pathdocker-compose.yml
File metadata and controls
137 lines (127 loc) · 4.53 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
services:
db:
image: pgvector/pgvector:pg16
container_name: musclub_pg
restart: unless-stopped
environment:
POSTGRES_DB: ${POSTGRES_DB:-musclub}
POSTGRES_USER: ${POSTGRES_USER:-musclub}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-musclub}
PGDATA: /var/lib/postgresql/data/pgdata
volumes:
- ./data/postgres:/var/lib/postgresql/data
- ./backend/docker/postgres/init:/docker-entrypoint-initdb.d:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-musclub} -d ${POSTGRES_DB:-musclub}"]
interval: 5s
timeout: 5s
retries: 10
networks:
- internal
keycloak:
image: quay.io/keycloak/keycloak:24.0
container_name: musclub_keycloak
restart: unless-stopped
command: start-dev --import-realm
environment:
KEYCLOAK_ADMIN: ${KEYCLOAK_ADMIN:-admin}
KEYCLOAK_ADMIN_PASSWORD: ${KEYCLOAK_ADMIN_PASSWORD:-admin}
KC_DB: postgres
KC_DB_URL: jdbc:postgresql://db:5432/${POSTGRES_DB:-musclub}
KC_DB_USERNAME: ${POSTGRES_USER:-musclub}
KC_DB_PASSWORD: ${POSTGRES_PASSWORD:-musclub}
KC_HTTP_PORT: 8180
KC_HOSTNAME: ${SERVER_HOST:-localhost}
KC_HOSTNAME_PORT: ${HTTP_PORT:-80}
KC_HOSTNAME_STRICT: "false"
KC_HOSTNAME_STRICT_HTTPS: "false"
KC_HTTP_RELATIVE_PATH: /auth
FRONTEND_URL: ${SERVER_PROTOCOL:-http}://${SERVER_HOST:-localhost}:${HTTP_PORT:-80}
volumes:
- ./backend/keycloak:/opt/keycloak/data/import:ro
depends_on:
db:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "timeout 3 bash -lc '</dev/tcp/127.0.0.1/8180' || exit 1"]
interval: 10s
timeout: 5s
retries: 15
networks:
- internal
app:
build:
context: ./backend
dockerfile: Dockerfile
container_name: musclub_app
restart: unless-stopped
environment:
SPRING_DATASOURCE_URL: jdbc:postgresql://db:5432/${POSTGRES_DB:-musclub}
SPRING_DATASOURCE_USERNAME: ${POSTGRES_USER:-musclub}
SPRING_DATASOURCE_PASSWORD: ${POSTGRES_PASSWORD:-musclub}
SPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_ISSUER_URI: ${SERVER_PROTOCOL:-http}://${SERVER_HOST:-localhost}:${HTTP_PORT:-80}/auth/realms/${KEYCLOAK_REALM:-musclub}
SPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_JWK_SET_URI: http://keycloak:8180/auth/realms/${KEYCLOAK_REALM:-musclub}/protocol/openid-connect/certs
KEYCLOAK_ISSUER_URI: ${SERVER_PROTOCOL:-http}://${SERVER_HOST:-localhost}:${HTTP_PORT:-80}/auth/realms/${KEYCLOAK_REALM:-musclub}
KEYCLOAK_BASE_URL: http://keycloak:8180/auth
KEYCLOAK_REALM: ${KEYCLOAK_REALM:-musclub}
KEYCLOAK_ADMIN_USERNAME: ${KEYCLOAK_ADMIN:-admin}
KEYCLOAK_ADMIN_PASSWORD: ${KEYCLOAK_ADMIN_PASSWORD:-admin}
DEEPSEEK_API_KEY: ${DEEPSEEK_API_KEY}
VAPID_PUBLIC_KEY: ${VAPID_PUBLIC_KEY}
VAPID_PRIVATE_KEY: ${VAPID_PRIVATE_KEY}
MUSCLUB_DISPLAY_TIMEZONE: ${MUSCLUB_DISPLAY_TIMEZONE:-Asia/Novosibirsk}
depends_on:
db:
condition: service_healthy
keycloak:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:8080/api/events?size=1 || exit 1"]
interval: 15s
timeout: 5s
retries: 10
networks:
- internal
frontend:
build:
context: ./musclub-app
dockerfile: Dockerfile
args:
BACKEND_INTERNAL_URL: http://app:8080
container_name: musclub_frontend
restart: unless-stopped
environment:
NEXTAUTH_URL: ${SERVER_PROTOCOL:-http}://${SERVER_HOST:-localhost}:${HTTP_PORT:-80}
NEXTAUTH_SECRET: ${NEXTAUTH_SECRET}
KEYCLOAK_ISSUER: ${SERVER_PROTOCOL:-http}://${SERVER_HOST:-localhost}:${HTTP_PORT:-80}/auth/realms/${KEYCLOAK_REALM:-musclub}
KEYCLOAK_INTERNAL_ISSUER: http://keycloak:8180/auth/realms/${KEYCLOAK_REALM:-musclub}
KEYCLOAK_CLIENT_ID: ${KEYCLOAK_CLIENT_ID:-musclub-frontend}
BACKEND_INTERNAL_URL: http://app:8080
depends_on:
app:
condition: service_healthy
keycloak:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "wget -q -O /dev/null http://127.0.0.1:3000 || exit 1"]
interval: 10s
timeout: 5s
retries: 12
networks:
- internal
nginx:
image: nginx:1.27-alpine
container_name: musclub_nginx
restart: unless-stopped
ports:
- "${HTTP_PORT:-80}:80"
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
frontend:
condition: service_healthy
networks:
- internal
networks:
internal:
driver: bridge