Repository navigation
Expand file tree
/
Copy pathcompose.yaml
More file actions
213 lines (206 loc) · 7.46 KB
/
Copy pathcompose.yaml
File metadata and controls
213 lines (206 loc) · 7.46 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
name: ${USER}_a2_ros
x-common: &common
init: true
network_mode: host
# Share the host IPC namespace so containers use the host's large /dev/shm
# instead of the 64 MB default. Required for Zenoh shared-memory transport
# (many sim nodes pushing point clouds/images would otherwise hit OS error 12).
ipc: host
# Privileged so the container gets host device access (e.g. the joystick at
# /dev/input) without bind-mounting Linux-only paths. This keeps startup
# working on macOS (no /dev/input there) and on Linux whether or not a
# controller is plugged in. Overrides the non-privileged x-common default.
privileged: true
# Allow the Zenoh SHM watchdog threads to set real-time scheduling priority
# (otherwise they warn "error setting scheduling priority OS(1)") and lock
# the SHM pools into memory.
ulimits:
rtprio: 99
nice: -20
memlock: -1
environment:
# Linux: inherits the host's DISPLAY (e.g. :0) for native X11 forwarding
# through the bind-mounted /tmp/.X11-unix. macOS/Windows: the host has no X
# server, so default to :20 — the KasmVNC display in the `vnc` service
# (a high number that won't collide with host :0/:1 or other VNC instances).
# (Also silences the "DISPLAY variable is not set" warning on macOS/Windows.)
- DISPLAY=${DISPLAY:-:20}
- XAUTHORITY=/home/ubuntu/.Xauthority
- QT_X11_NO_MITSHM=1
working_dir: /a2_ros
command: [ "bash" ]
stdin_open: true
tty: true
# Individual bind-mount anchors so services can compose their own volume lists
x-vol-x11: &vol-x11
type: bind
source: /tmp/.X11-unix
target: /tmp/.X11-unix
x-vol-xauth: &vol-xauth
# Mount the real X auth cookie. Display managers (e.g. GDM) keep it at
# $XAUTHORITY (e.g. /run/user/UID/gdm/Xauthority), not ~/.Xauthority — so
# prefer $XAUTHORITY and fall back to ~/.Xauthority when it is unset.
type: bind
source: ${XAUTHORITY:-${HOME}/.Xauthority}
target: /home/ubuntu/.Xauthority
x-vol-workspace: &vol-workspace
type: bind
source: .
target: /a2_ros
x-vol-bags: &vol-bags
# ROS bags — bind mount so bags are accessible from the host.
# Override ROS_BAGS_DIR in a .env file to point at your archive directory.
type: bind
source: ${ROS_BAGS_DIR:-./bags}
target: /a2_ros_ws/bags
services:
a2_base:
image: ghcr.io/ethz-robotx/a2_ros/a2_base:main
pull_policy: always
entrypoint: ["true"]
a2_ros_dev:
<<: *common
image: a2_ros:dev
build:
context: .
dockerfile: ./environment/Dockerfile.dev
target: dev
args:
UID: ${HOST_UID:-1000}
GID: ${HOST_GID:-1000}
INPUT_GID: ${INPUT_GID:-107}
depends_on:
- zenoh_router_sim
- a2_base
volumes:
- *vol-x11
- *vol-xauth
- *vol-workspace
- *vol-bags
- type: volume
source: dev_bash_history
target: /home/ubuntu/.bash_history_dir
- type: volume
source: dev_colcon_build
target: /a2_ros_ws/build
- type: volume
source: dev_colcon_install
target: /a2_ros_ws/install
- type: volume
source: dev_colcon_log
target: /a2_ros_ws/log
- type: volume
source: dev_rosdep_cache
target: /home/ubuntu/.ros
# NUC (192.168.124.124). Deployed directly on the NUC.
# The router runs on pc2 (ZENOH_ROUTER_IP_ROBOT in .env). Start the router
# via the a2_ros_pc2 service on pc2 instead.
a2_ros_nuc:
<<: *common
build:
context: .
dockerfile: ./environment/Dockerfile.dev
target: robot
args:
UID: ${HOST_UID:-1000}
GID: ${HOST_GID:-1000}
INPUT_GID: ${INPUT_GID:-107}
depends_on:
- a2_base
shm_size: '512m'
volumes:
- *vol-x11
- *vol-xauth
- *vol-workspace
- *vol-bags
- type: volume
source: nuc_bash_history
target: /home/ubuntu/.bash_history_dir
- type: volume
source: nuc_colcon_build
target: /a2_ros_ws/build
- type: volume
source: nuc_colcon_install
target: /a2_ros_ws/install
- type: volume
source: nuc_colcon_log
target: /a2_ros_ws/log
- type: volume
source: nuc_rosdep_cache
target: /home/ubuntu/.ros
# ---- Zenoh discovery router ---------------------------------------------
# The Zenoh router (rmw_zenohd) is a per-machine discovery singleton. Start
# it before launching any sim nodes:
# docker compose up -d zenoh_router_sim
# It listens on tcp/0.0.0.0:7447 over the host network. Point client nodes at
# it with ZENOH_ROUTER_IP_SIM in your .env (default is localhost).
# NOTE: run only ONE router per host — they share TCP port 7447.
# Robot services (NUC, pc2) are in compose.nuc.yaml and compose.pc2.yaml.
zenoh_router_sim:
<<: *common
image: ghcr.io/ethz-robotx/a2_ros/a2_base:main
restart: unless-stopped
command: [ "ros2", "run", "rmw_zenoh_cpp", "rmw_zenohd" ]
# ---- KasmVNC desktop (opt-in) -------------------------------------------
# Starts a KasmVNC X server + XFCE desktop on display :20, served at
# https://localhost:8444 (user: ubuntu, password: VNC_PASSWORD).
# It mounts the workspace + the shared build/install volumes, so its desktop
# terminal is a full ROS environment (on the same Zenoh graph as a2_ros_dev,
# sharing the same built workspace). Two ways to use it:
# - work IN the browser desktop: open a terminal there, run sim/RViz/MuJoCo
# (DISPLAY=:20 is already the default), windows appear in the same desktop.
# - work FROM a2_ros_dev and render here, via the X-socket override:
# docker compose -f compose.yaml -f compose.vnc.yml --profile vnc up -d
# docker compose exec a2_ros_dev bash -lc 'DISPLAY=:20 rviz2'
# Reachable from the host only with Docker Desktop "host networking" enabled.
# Profile-gated; built from the `vnc` image stage (KasmVNC + XFCE).
vnc:
<<: *common
profiles: [ vnc ]
image: a2_ros:vnc
build:
context: .
dockerfile: ./environment/Dockerfile.dev
target: vnc
args:
UID: ${HOST_UID:-1000}
GID: ${HOST_GID:-1000}
restart: unless-stopped
# Start the X server, then allow local (same-host) clients so other
# containers sharing the X socket can connect, and idle on the session log.
command:
- bash
- -c
- "vncserver -kill :20 >/dev/null 2>&1 || true; rm -f /tmp/.X11-unix/X20 /tmp/.X20-lock; vncserver :20 && DISPLAY=:20 xhost +local: >/dev/null 2>&1; exec tail -F /home/ubuntu/.vnc/*.log"
volumes:
# Expose the X server's socket (/tmp/.X11-unix/X20) on a named volume so
# other containers (a2_ros_dev) can render to this display.
- type: volume
source: x11
target: /tmp/.X11-unix
# Workspace + shared build/install volumes, so the desktop terminal is a
# full ROS env sharing the same built workspace as a2_ros_dev.
- *vol-workspace
- type: volume
source: dev_colcon_build
target: /a2_ros_ws/build
- type: volume
source: dev_colcon_install
target: /a2_ros_ws/install
- type: volume
source: dev_colcon_log
target: /a2_ros_ws/log
volumes:
dev_bash_history:
dev_colcon_build:
dev_colcon_install:
dev_colcon_log:
dev_rosdep_cache:
nuc_bash_history:
nuc_colcon_build:
nuc_colcon_install:
nuc_colcon_log:
nuc_rosdep_cache:
# Shares the KasmVNC X socket (/tmp/.X11-unix) between the vnc server and
# a2_ros_dev (see compose.vnc.yml) so GUI apps in dev can render to display :20.
x11: