Overview
Hyperscape uses Docker for:
- Asset CDN: nginx serving game assets
- PostgreSQL: Database for player data
- Development services: Local infrastructure
Prerequisites
- Docker Desktop (macOS/Windows)
- Or Docker Engine on Linux:
apt install docker.io
CDN Container
Start CDN
This starts an nginx container serving assets from packages/server/world/assets/ on port 8080.
Stop CDN
Automatic Start
The CDN starts automatically with bun run dev. Only run manually if using services separately.
PostgreSQL Container
PostgreSQL starts automatically when the server runs via Docker Compose.
Configuration
Default connection:
Manual Control
Docker Compose
The server package includes docker-compose.yml:
Production Docker Images
Server Image
The server Dockerfile includes all dependencies for production deployment with Bun 1.3.10 and multi-service support:
Key Features (Updated March 15, 2026):
- Bun 1.3.10: Upgraded from 1.1.38 for Vite 6+ compatibility
- Multi-Service Support: Builds both client and server in single image
- Workspace Symlinks: Manually recreated after Docker COPY (COPY flattens symlinks)
- Per-Package node_modules: Bun 1.3 doesn’t hoist all deps - explicitly copied
- better-sqlite3 Removal: Stripped from manifests before install (segfaults under QEMU)
- Manifest Embedding: Copies cleaned manifests from builder stage
- Client Build: Includes
packages/client/dist for multi-service deployments
Docker Build Workarounds:
-
better-sqlite3 QEMU Crash: Node-gyp native build segfaults under QEMU cross-compilation
- Solution: Strip from package.json before install
- Project uses bun:sqlite and PostgreSQL instead
-
Workspace Symlinks Destroyed: Docker COPY flattens symlinks to regular files
- Solution: Manually recreate
node_modules/@hyperscape/* symlinks in runtime stage
- Bun workspace resolution requires these symlinks
-
Bun 1.3 Per-Package node_modules: Bun 1.3 changed dependency resolution
- Solution: Explicitly copy per-package node_modules from builder
- Packages like three, dotenv end up in
packages/*/node_modules/
-
Procgen Build Errors: Type errors cause partial emit
- Solution:
(bun run build || true) continues build with partial output
- Downstream consumers still get sufficient artifacts
Vast.ai Keeper Image
The vast-keeper package uses a specialized image for GPU instance provisioning:
Key Features:
- Python 3.11+: Required for vastai-sdk (needs Python 3.10+)
- —break-system-packages: Required for pip3 on Debian 12 due to PEP 668
- SSH key generation: Enables secure access to provisioned instances
- vastai CLI: Installed as Python package (not binary)
Resetting Containers
Reset Database
This deletes all local data (characters, inventory, progress).
Reset CDN
No Docker Alternative
If you can’t run Docker locally:
External PostgreSQL
Use a hosted database (e.g., Neon):
External CDN
Host assets on cloud storage:
Container Status
Check running containers:
Expected output when running:
Logs
View container logs: