Repository navigation
Expand file tree
/
Copy pathcompose.yml
More file actions
66 lines (62 loc) · 2.89 KB
/
Copy pathcompose.yml
File metadata and controls
66 lines (62 loc) · 2.89 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
# Config file for compose, a tool that allows for easily managing multiple containers.
# https://docs.docker.com/compose/
services:
database:
# not :nightly because doing that once caused failures when graph linking
# and also caused errors with query parameters (twice)
build: ./Database
ports:
- 127.0.0.1:8000:8000
restart: unless-stopped
volumes:
- ./data/surreal:/database
environment:
# Read by `surreal start` instead of -u/-p, so the password doesn't show up in `ps`. It only sets the root password of a new store; database-setup changes it on an existing one.
SURREAL_USER: root
SURREAL_PASS: ${DATABASE_ROOT_PASSWORD:?set DATABASE_ROOT_PASSWORD in a .env file next to compose.yml}
command:
- start
# :8000 (all interfaces) is needed for the Site container to reach it over the compose network; the host port stays loopback-only
- --bind=0.0.0.0:8000
- surrealkv://database
# One-shot: defines the namespace, database and the Site's user, and changes root's password from the old default. Safe to run again.
database-setup:
build: .
entrypoint: ["bun", "src/lib/server/dbSetup.ts", "--url", "ws://database:8000"]
restart: "no"
environment:
DATABASE_ROOT_PASSWORD: ${DATABASE_ROOT_PASSWORD:?set DATABASE_ROOT_PASSWORD in a .env file next to compose.yml}
DATABASE_USER: ${DATABASE_USER:-site}
DATABASE_PASSWORD: ${DATABASE_PASSWORD:?set DATABASE_PASSWORD in a .env file next to compose.yml}
depends_on:
- database
economy:
build: ./Economy
ports:
- 127.0.0.1:2009:2009
environment:
ECONOMY_KEY: ${ECONOMY_KEY:?set ECONOMY_KEY in a .env file next to compose.yml}
restart: unless-stopped
volumes:
- ./data/economy:/data/economy
site:
build: .
ports:
# loopback only: Caddy on the host is the public entry point
- 127.0.0.1:4443:4443
restart: unless-stopped
environment:
# Caddy puts the client's address last in X-Forwarded-For, which is what ratelimits are keyed on
ADDRESS_HEADER: X-Forwarded-For
XFF_DEPTH: "1"
ECONOMY_URL: http://economy:2009
ECONOMY_KEY: ${ECONOMY_KEY:?set ECONOMY_KEY in a .env file next to compose.yml}
DATABASE_USER: ${DATABASE_USER:-site}
DATABASE_PASSWORD: ${DATABASE_PASSWORD:?set DATABASE_PASSWORD in a .env file next to compose.yml}
depends_on:
database:
condition: service_started # the Site keeps retrying until the database is ready
database-setup:
condition: service_completed_successfully
economy:
condition: service_started