Repository navigation
Expand file tree
/
Copy pathcompose.yml
More file actions
92 lines (88 loc) · 3.67 KB
/
Copy pathcompose.yml
File metadata and controls
92 lines (88 loc) · 3.67 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
# Production-shaped compose file for realty-rest: MariaDB plus the API.
#
# This is NOT compose.dev.yml -- that file is managed by the startDevDb /
# stopDevDb / resetDevDb Gradle tasks for `./gradlew runServer` and stays
# untouched. This file stands the standalone realty-rest service up against
# its own database, e.g. for local image verification or as a starting
# point for a real deployment.
#
# realty-rest never migrates and never writes; it only reads a database that
# realty-paper has already initialised/migrated elsewhere. For a from-empty
# demo, replace `mariadb` below with an image that already has the schema
# applied, or run realty-paper's migrations against it first.
#
# Every value below that is a real credential rather than a fixed default is
# `${VARIABLE}`, never a literal -- Compose substitutes these from a `.env`
# file in this directory, which .gitignore excludes from the repository.
# Copy .env.example to .env and fill it in before running this file; see
# README.md's "Docker Compose" section for the full explanation.
#
# Testing against an existing remote database rather than the bundled
# `mariadb` service: set REALTY_DB_URL in `.env` to that database's address
# and start only the API, skipping its dependency on the bundled one --
# docker compose up -d --no-deps realty-rest
# Compose project name. Explicit because all three compose files in this repo would
# otherwise default to the directory name and share one project -- which means
# `up` with any of them reconciles that project and REMOVES the containers the
# others created. A distinct name per file keeps them independent.
name: realty
services:
mariadb:
image: mariadb:11.7
restart: unless-stopped
environment:
MARIADB_DATABASE: realty
MARIADB_USER: ${REALTY_DB_USERNAME}
MARIADB_PASSWORD: ${REALTY_DB_PASSWORD}
MARIADB_ROOT_PASSWORD: ${REALTY_DB_ROOT_PASSWORD}
volumes:
- realty-rest-db:/var/lib/mysql
healthcheck:
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
interval: 5s
timeout: 5s
retries: 12
start_period: 30s
realty-rest:
build:
context: .
dockerfile: realty-web/realty-rest/Dockerfile
restart: unless-stopped
ports:
- "8080:8080"
environment:
REALTY_DB_URL: "${REALTY_DB_URL}"
REALTY_DB_USERNAME: "${REALTY_DB_USERNAME}"
REALTY_DB_PASSWORD: "${REALTY_DB_PASSWORD}"
REALTY_REST_HOST: "0.0.0.0"
REALTY_REST_PORT: "8080"
REALTY_REST_MAX_PAGE_SIZE: "100"
# Point at the query-service module inside the game server to enrich
# responses with live geometry and player names. Left blank in
# .env.example, which disables enrichment; both must match the
# module's own config.yml when set.
REALTY_REST_MODULE_URL: "${REALTY_REST_MODULE_URL}"
REALTY_REST_MODULE_SECRET: "${REALTY_REST_MODULE_SECRET}"
REALTY_REST_MODULE_TIMEOUT_MS: "1500"
depends_on:
mariadb:
condition: service_healthy
# The front end, served by nginx with /v1 proxied to the API above. Because the
# browser only ever sees this one origin, REALTY_REST_CORS_ORIGINS can stay
# empty and no config.json is needed.
#
# The alternative shape is realty-web-dist, a single jar carrying both -- see
# realty-web/README.md. This file demonstrates the split deployment.
realty-explorer:
build:
# The repo root: the Dockerfile also reads openapi.yaml from the sibling
# realty-rest module to generate the API client.
context: .
dockerfile: realty-web/realty-explorer/Dockerfile
restart: unless-stopped
ports:
- "8090:80"
depends_on:
- realty-rest
volumes:
realty-rest-db: