-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
117 lines (111 loc) · 4.53 KB
/
docker-compose.yml
File metadata and controls
117 lines (111 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
# Docker Compose for Clusterio Development Cluster
#
# Uses pre-built images from ghcr.io/solarcloud7/clusterio-docker
# See: https://github.com/solarcloud7/clusterio-docker
#
# Architecture:
# - 1 Controller (manages cluster, seeds data on first run)
# - 2 Hosts (run Factorio instances)
# - Instances are created automatically from seed-data/hosts/ convention
#
# Startup sequence:
# 1. Controller starts, bootstraps admin user, generates host tokens
# 2. Controller seeds database, mods, and instances from seed-data/
# 3. Hosts start, read tokens from shared volume, connect to controller
# 4. Instances are automatically assigned and started
#
# ============================================================================
# Adding more hosts:
# 1. Copy the surface-export-host-2 block and rename to surface-export-host-N
# 2. Update ports to a new range (e.g., 34300-34309)
# 3. Create seed-data/hosts/clusterio-host-N/<instance-name>/ folders
# 4. Update HOST_COUNT in controller environment
#
# IMPORTANT: The hostname MUST stay "clusterio-host-N" pattern for
# automatic token loading (the host extracts its ID from the hostname).
# Only the service/container names use the surface-export- prefix.
# ============================================================================
# Template anchor for host services (reduces duplication)
x-host-base: &host-base
image: ghcr.io/solarcloud7/clusterio-docker-host:ExtendedExportData
env_file:
- .env
networks:
- surface-export-net
depends_on:
surface-export-controller:
condition: service_healthy
restart: unless-stopped
services:
surface-export-controller:
image: ghcr.io/solarcloud7/clusterio-docker-controller:ExtendedExportData
env_file:
- .env
container_name: surface-export-controller
hostname: clusterio-controller # Hosts connect to this name on the Docker network
ports:
- "${CONTROLLER_HTTP_PORT:-8080}:${CONTROLLER_HTTP_PORT:-8080}"
volumes:
- surface-export-controller-data:/clusterio/data
- surface-export-tokens:/clusterio/tokens
- ./docker/seed-data:/clusterio/seed-data:ro
# Mount external plugins (auto-discovered by install-plugins.sh)
- ./docker/seed-data/external_plugins:/clusterio/external_plugins
environment:
- HOST_COUNT=${HOST_COUNT:-2}
- EXPORT_HOST=${EXPORT_HOST:-1}
networks:
- surface-export-net
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-sf", "http://localhost:${CONTROLLER_HTTP_PORT:-8080}/"]
interval: 10s
timeout: 3s
retries: 12
start_period: 90s
# -------------------------------------------------------------------------
# Host 1 - Port range 34100-34109
# -------------------------------------------------------------------------
surface-export-host-1:
<<: *host-base
container_name: surface-export-host-1
hostname: clusterio-host-1
environment:
- HOST_NAME=clusterio-host-1
ports:
- "34100-34109:34100-34109/udp"
volumes:
- surface-export-host-1-data:/clusterio/data
- surface-export-tokens:/clusterio/tokens:ro
- ./docker/seed-data/mods:/clusterio/seed-mods:ro
- factorio-client:/opt/factorio-client
# Mount external plugins (auto-discovered by install-plugins.sh)
- ./docker/seed-data/external_plugins:/clusterio/external_plugins
# -------------------------------------------------------------------------
# Host 2 - Port range 34200-34209
# -------------------------------------------------------------------------
surface-export-host-2:
<<: *host-base
container_name: surface-export-host-2
hostname: clusterio-host-2
environment:
- HOST_NAME=clusterio-host-2
- SKIP_CLIENT=true
ports:
- "34200-34209:34200-34209/udp"
volumes:
- surface-export-host-2-data:/clusterio/data
- surface-export-tokens:/clusterio/tokens:ro
- ./docker/seed-data/mods:/clusterio/seed-mods:ro
# Mount external plugins (auto-discovered by install-plugins.sh)
- ./docker/seed-data/external_plugins:/clusterio/external_plugins
networks:
surface-export-net:
driver: bridge
volumes:
surface-export-controller-data: # All controller persistent data
surface-export-host-1-data: # Host 1 persistent data (config, instances, logs)
surface-export-host-2-data: # Host 2 persistent data
surface-export-tokens: # Token exchange between controller and hosts
factorio-client: # Shared Factorio game client (external — survives down -v)
external: true