-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcompose.dev.yml
More file actions
116 lines (114 loc) · 5.95 KB
/
Copy pathcompose.dev.yml
File metadata and controls
116 lines (114 loc) · 5.95 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
# Containerized development runtime. Devkit adds this checkout's PostgreSQL service.
#
# Named `compose.dev.yml` rather than `compose.yml` because the root `compose.yml` is gitignored and
# reserved for a deployment-local copy of `compose.server.example.yml` (see .gitignore). Devkit
# combines this file with the checkout's generated database service.
#
# Browser and host-bridge entry points bind to loopback only. Do not remove the bind address to
# "make it reachable": on a laptop that would expose development services to the current network.
services:
node:
build:
context: .
dockerfile: docker/dev/Dockerfile
working_dir: /workspace
user: "${HOST_UID:?host uid is required}:${HOST_GID:?host gid is required}"
init: true
env_file:
- path: .env
required: false
environment:
HOME: /tmp/devkit-home
NODE_ENV: development
DATABASE_URL: ${DATABASE_URL:?database URL is required}
API_PORT: ${API_PORT:?api port is required}
METRICS_PORT: ${METRICS_PORT:?metrics port is required}
CLIENT_ORIGIN: ${CLIENT_ORIGIN:?client origin is required}
# The bridge watcher runs on the host, where printer LAN routes are available.
PRINTSTREAM_DEV_BRIDGE: host
# Preserve the tri-state deployment override so the private source tree can exercise the
# public self-hosted auth and UI paths with `SELF_HOSTED=true npm run dev`.
SELF_HOSTED: ${SELF_HOSTED:-}
VITE_API_PORT: ${VITE_API_PORT:?vite api port is required}
VITE_DEV_ALLOWED_HOSTS: ${VITE_DEV_ALLOWED_HOSTS:?allowed hosts are required}
VITE_DEV_HOST: 0.0.0.0
VITE_DEV_PORT: ${VITE_DEV_PORT:?vite port is required}
SLICER_PORT: ${SLICER_PORT:?slicer port is required}
SLICER_DATA_ROOT: /slicer-data
SLICER_WORK_DIR: /slicer-work
SLICER_SERVICE_URL: http://slicer:${SLICER_PORT:?slicer port is required}
DEVKIT_COMPOSE_PROJECT: ${DEVKIT_COMPOSE_PROJECT:?compose project is required}
ports:
- "127.0.0.1:${DEVKIT_WEB_PORT:?web port is required}:${VITE_DEV_PORT:?vite port is required}"
- "[::1]:${DEVKIT_WEB_PORT:?web port is required}:${VITE_DEV_PORT:?vite port is required}"
- "127.0.0.1:${DEVKIT_API_PORT:?api port is required}:${API_PORT:?api port is required}"
- "[::1]:${DEVKIT_API_PORT:?api port is required}:${API_PORT:?api port is required}"
volumes:
- .:/workspace
# A linked worktree's `.git` is a file pointing into the primary checkout's absolute Git
# directory. Mount that directory at the same absolute path so Git-aware validation works
# inside the source-mounted container too. Read-only is sufficient for diff/test discovery.
- ${PRINTSTREAM_GIT_COMMON_DIR:?git common dir is required}:${PRINTSTREAM_GIT_COMMON_DIR:?git common dir is required}:ro
- slicer-data:/slicer-data
- slicer-work:/slicer-work
depends_on:
database:
condition: service_healthy
command: node scripts/dev/run-dev.mjs --container-runtime
# Opt-in: `docker compose -f compose.dev.yml up -d slicer`, then set PRINTSTREAM_DEV_SLICER=remote
# so `npm run dev` leaves the in-process slicer alone and the API uses SLICER_SERVICE_URL.
#
# Why a container rather than the in-process slicer `npm run dev` normally starts: that path needs
# BambuStudio's x86-64 toolchain, which the development image bakes in and a
# bare host does not have. On arm64 it needs qemu-user-static, weston and an x86-64 cross compiler
# besides. The published image already carries all of it, including the emulation sysroot for
# arm64, so this is the same engine without installing any of it system-wide.
#
# Built FROM THIS CHECKOUT, not pulled: in dev a container should run the code you are editing.
# `npm run dev` rebuilds it when this checkout's source is newer; `dev:doctor` only reports the
# state. Use `--build` directly when you deliberately want to force a rebuild.
#
# docker compose -f compose.dev.yml --profile slicer up -d --build slicer
#
# The slicer belongs to this checkout's Compose project too. That costs one engine process per
# running worktree, but guarantees each branch runs the slicer source mounted beside its API and
# lets `devkit --down` remove the complete checkout runtime as one unit.
#
# To skip building entirely (you are not touching the slicer and want the fastest start), point
# SLICER_IMAGE at the published engine and pull it instead of building:
#
# SLICER_IMAGE=ghcr.io/printstreamapp/printstream-slicer:latest \
# docker compose -f compose.dev.yml --profile slicer up -d slicer
slicer:
# A LOCAL tag by default, so a build from this checkout can never be tagged over the published
# image other things on this machine may be using.
image: ${SLICER_IMAGE:-printstream-slicer-dev}
build:
context: .
dockerfile: apps/slicer/Dockerfile
args:
PRINTSTREAM_SLICER_SOURCE_FINGERPRINT: ${SLICER_SOURCE_FINGERPRINT:-unknown}
profiles:
- slicer
restart: unless-stopped
# The CLI launcher spawns helpers (a per-slice weston; qemu on arm64) that become zombies when a
# slice is cancelled. node-as-PID-1 never reaps them and they accumulate until slicing stops
# working; tini reaps. Same reason as the production stack.
init: true
environment:
SLICER_PORT: ${SLICER_PORT:?slicer port is required}
SLICER_WORK_DIR: /work
SLICER_BAMBUSTUDIO_HOME_DIR: /work/bambustudio-home
SLICER_BAMBUSTUDIO_DATA_DIR: /work/bambustudio-data
# Engines download on first use (~530 MB each). Name ids here to preload instead.
SLICER_PRELOAD_ENGINES: ${SLICER_PRELOAD_ENGINES:-}
volumes:
- slicer-work:/work
# Engines live outside the image so they survive an image update, and outside the repo so a
# worktree cannot carry 530 MB per checkout.
- slicer-engines:/data/engines
volumes:
slicer-data:
slicer-work:
slicer-engines:
name: ${SLICER_ENGINES_VOLUME:-printstream-slicer-compose-engines}