ros2_rmp/husarnet.yaml
2023-12-24 11:59:29 +01:00

62 lines
2.0 KiB
YAML

services:
### Husarnet VPN Container for remote access
husarnet:
image: husarnet/husarnet
restart: unless-stopped
volumes:
- /var/lib/husarnet # This will persist your Husarnet Client keys, thus IP of the container will be stable/the same between (re)boots
sysctls:
- net.ipv6.conf.all.disable_ipv6=0 # Husarnet is using IPv6 for the internal connections
cap_add:
- NET_ADMIN
devices:
- /dev/net/tun
env_file:
- ./husarnet/.env # create .env file in the same folder as Dockerfile and specify HOSTNAME and JOINCODE there
color_controller:
build:
dockerfile: husarnet/Dockerfile
volumes:
- ./husarnet/cyclonedds.xml:/cyclonedds.xml
command:
- bash
- -c
- |
export CYCLONEDDS_URI=file:///cyclonedds.xml
ros2 run my_demo_pkg color_controller
network_mode: service:husarnet
move_controller:
build:
dockerfile: husarnet/Dockerfile
volumes:
- ./husarnet/cyclonedds.xml:/cyclonedds.xml
command:
- bash
- -c
- |
export CYCLONEDDS_URI=file:///cyclonedds.xml
ros2 run my_demo_pkg move_controller
network_mode: service:husarnet
turtle_sim:
image: osrf/ros:galactic-desktop
privileged: true
environment:
# Allows graphical programs in the container.
- DISPLAY=${DISPLAY}
- QT_X11_NO_MITSHM=1
- NVIDIA_DRIVER_CAPABILITIES=all
volumes:
# Allows graphical programs in the container.
- /tmp/.X11-unix:/tmp/.X11-unix:rw
- ${XAUTHORITY:-$HOME/.Xauthority}:/root/.Xauthority
- ./husarnet/cyclonedds.xml:/cyclonedds.xml
command:
- bash
- -c
- |
export CYCLONEDDS_URI=file:///cyclonedds.xml
ros2 run turtlesim turtlesim_node
network_mode: service:husarnet # This is the most important line in this setup. This will put the Husarnet Client in the same network namespace as your app (in this example: turtle_sim)