-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
86 lines (81 loc) · 3.29 KB
/
Copy pathdocker-compose.yml
File metadata and controls
86 lines (81 loc) · 3.29 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
# moyu (kun-galgame-patch) — the downstream patch site.
#
# Stateless api + web only. The backing services (Postgres / Redis) and the
# upstreams (oauth / galgame-wiki / image_service / MinIO) are OWNED BY the
# kun-galgame-infra stack. moyu connects to them by service name on infra's
# network. See docker/README.md.
#
# Run one of:
# A) Umbrella: a website/compose.yaml that `include:`s infra + this (the
# infra provides postgres/redis/oauth/galgame/image). Recommended.
# B) Alongside infra: bring infra up first (so its network + services exist),
# then `docker compose up -d` here — this joins `kun-galgame-infra_default`.
#
# Host ports use the 1xxxx range to coexist with a running `air` dev server.
# Service-to-service traffic uses container ports via service names
# (postgres:5432, http://oauth:9277, http://galgame:9280, http://image:9278).
name: moyu
x-svc-health: &svc-health
interval: 10s
timeout: 5s
retries: 5
start_period: 15s
services:
# 服务名直接叫 moyu-api(与 prod 一致):两仓都叫 `api` 在共享网络会 DNS 冲突,
# 用唯一服务名,SSR(moyu-web → http://moyu-api:5214)才能解析到。
moyu-api:
build:
context: .
dockerfile: docker/go.Dockerfile
args: { CMD: server }
image: moyu/api
env_file: [./docker/api.env]
ports: ["15010:5214"]
# No depends_on on postgres/redis: they live in the infra compose, not here.
# `restart: unless-stopped` reconnects once the infra stack is up.
healthcheck:
test: ["CMD", "/app", "healthcheck"]
<<: *svc-health
restart: unless-stopped
web:
build:
context: .
dockerfile: docker/nuxt.Dockerfile
args:
APP: web
# Browser-facing → host ports / public URLs. Override per deploy.
PUBLIC_API_BASE: http://localhost:15010/api/v1
PUBLIC_OAUTH_SERVER_URL: http://localhost:15005/api/v1
PUBLIC_OAUTH_WEB_URL: http://localhost:15008
PUBLIC_OAUTH_CLIENT_ID: df3ff6008d740bfacbe46aa8cf483cf2
PUBLIC_OAUTH_REDIRECT_URI: http://localhost:15011/auth/callback
image: moyu/web
env_file: [./docker/web.env]
ports: ["15011:3000"]
depends_on:
moyu-api: { condition: service_healthy }
healthcheck:
test: ["CMD", "node", "-e", "require('net').connect(3000,'127.0.0.1').on('connect',()=>process.exit(0)).on('error',()=>process.exit(1))"]
<<: *svc-health
restart: unless-stopped
# ─────────────────────── one-off job (profile: jobs) ───────────────────────
# moyu's SQL migrations. Not started by `up`. Run on demand AFTER infra's
# postgres is up and the kungalgame_patch database exists (add it to infra's
# docker/initdb.d, see README):
# docker compose run --rm migrate
migrate:
build:
context: .
dockerfile: docker/go.Dockerfile
args: { CMD: migrate }
image: moyu/migrate
env_file: [./docker/api.env]
profiles: ["jobs"]
restart: "no"
# moyu joins infra's network so `postgres`/`oauth`/`galgame`/`image`/`minio`
# resolve. (When run via the umbrella `include`, all services share one project
# network and this `external` block is unnecessary — drop it there.)
networks:
default:
name: kun-galgame-infra_default
external: true