rostainer 0.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. rostainer-0.0.1.dist-info/METADATA +85 -0
  2. rostainer-0.0.1.dist-info/RECORD +50 -0
  3. rostainer-0.0.1.dist-info/WHEEL +4 -0
  4. rostainer-0.0.1.dist-info/entry_points.txt +2 -0
  5. rostainer-0.0.1.dist-info/licenses/LICENSE +21 -0
  6. rostainer_cli/__init__.py +29 -0
  7. rostainer_cli/_assets/.dockerignore +24 -0
  8. rostainer_cli/_assets/docker-compose.gpu-amd.yml +25 -0
  9. rostainer_cli/_assets/docker-compose.gpu-intel.yml +19 -0
  10. rostainer_cli/_assets/docker-compose.gpu-nvidia.yml +30 -0
  11. rostainer_cli/_assets/docker-compose.runtime.yml +78 -0
  12. rostainer_cli/_assets/docker-compose.yml +204 -0
  13. rostainer_cli/_assets/docker_entrypoint.py +1150 -0
  14. rostainer_cli/_assets/dummy_post_build.sh +10 -0
  15. rostainer_cli/_assets/dummy_pre_build.sh +7 -0
  16. rostainer_cli/_assets/dummy_shell_setup.sh +6 -0
  17. rostainer_cli/_assets/examples/envrc.example +5 -0
  18. rostainer_cli/_assets/examples/rostainer.toml.example +291 -0
  19. rostainer_cli/_assets/extra_dirs.py +158 -0
  20. rostainer_cli/_assets/install.py +454 -0
  21. rostainer_cli/_assets/pylsp-config.json +31 -0
  22. rostainer_cli/_assets/pylsp-wrapper +22 -0
  23. rostainer_cli/_assets/ros1.Dockerfile +161 -0
  24. rostainer_cli/_assets/ros2.Dockerfile +177 -0
  25. rostainer_cli/_assets/ros_log_pruner.py +164 -0
  26. rostainer_cli/_assets/runtime_entrypoint.py +261 -0
  27. rostainer_cli/_version.py +24 -0
  28. rostainer_cli/cli.py +146 -0
  29. rostainer_cli/cmd/__init__.py +40 -0
  30. rostainer_cli/cmd/init.py +115 -0
  31. rostainer_cli/cmd/logs.py +79 -0
  32. rostainer_cli/cmd/package.py +88 -0
  33. rostainer_cli/cmd/package_create.py +710 -0
  34. rostainer_cli/cmd/prune.py +272 -0
  35. rostainer_cli/cmd/rebuild.py +97 -0
  36. rostainer_cli/cmd/restart.py +89 -0
  37. rostainer_cli/cmd/shell.py +139 -0
  38. rostainer_cli/cmd/start.py +428 -0
  39. rostainer_cli/cmd/status.py +87 -0
  40. rostainer_cli/cmd/stop.py +88 -0
  41. rostainer_cli/compose_override.py +253 -0
  42. rostainer_cli/config.py +1020 -0
  43. rostainer_cli/docker_utils.py +755 -0
  44. rostainer_cli/extra_dirs.py +362 -0
  45. rostainer_cli/host_scripts.py +123 -0
  46. rostainer_cli/lockfile.py +106 -0
  47. rostainer_cli/log.py +126 -0
  48. rostainer_cli/mappings.py +207 -0
  49. rostainer_cli/ros2_daemon.py +214 -0
  50. rostainer_cli/update_check.py +232 -0
@@ -0,0 +1,85 @@
1
+ Metadata-Version: 2.5
2
+ Name: rostainer
3
+ Version: 0.0.1
4
+ Summary: A flexible, distro agnostic tool for ROS (1 and 2) development using Docker containers
5
+ Project-URL: Homepage, https://git.whoi.edu/bmillerklugman/rostainer
6
+ Author: rostainer contributors
7
+ License-Expression: MIT
8
+ License-File: LICENSE
9
+ Keywords: devcontainer,docker,robotics,ros,ros2
10
+ Classifier: Environment :: Console
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Operating System :: POSIX :: Linux
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Topic :: Software Development :: Embedded Systems
16
+ Classifier: Topic :: System :: Systems Administration
17
+ Requires-Python: >=3.8
18
+ Requires-Dist: tomli; python_version < '3.11'
19
+ Provides-Extra: docs
20
+ Requires-Dist: myst-parser; extra == 'docs'
21
+ Requires-Dist: shibuya; extra == 'docs'
22
+ Requires-Dist: sphinx>=7; extra == 'docs'
23
+ Provides-Extra: test
24
+ Requires-Dist: coverage; extra == 'test'
25
+ Description-Content-Type: text/markdown
26
+
27
+ # rostainer
28
+
29
+ [![pipeline status](https://git.whoi.edu/bmillerklugman/rostainer/badges/main/pipeline.svg)](https://git.whoi.edu/bmillerklugman/rostainer/-/commits/main)
30
+ [![coverage report](https://git.whoi.edu/bmillerklugman/rostainer/badges/main/coverage.svg)](https://git.whoi.edu/bmillerklugman/rostainer/-/commits/main)
31
+ [![PyPI](https://img.shields.io/pypi/v/rostainer.svg)](https://pypi.org/project/rostainer/)
32
+
33
+ A flexible, distro agnostic tool for ROS (1 and 2) development using
34
+ Docker containers.
35
+
36
+ Requires Docker and Python 3 on the host; target machines for
37
+ `rostainer package` deployments need only Docker. On Python 3.11+ the
38
+ CLI is standard-library only; on older Python (e.g. Ubuntu 22.04's
39
+ default 3.10) pipx also installs the small `tomli` package, for reading
40
+ `.rostainer.toml`.
41
+
42
+ ## Full documentation
43
+
44
+ This README only covers the quick start. Everything else - the full
45
+ `.rostainer.toml` settings reference, GPU acceleration, hardware access,
46
+ volume mounts, networking, packaging for deployment, LSP setup, and the
47
+ `rostainer_cli` API reference - lives in `docs/`. Build and open it
48
+ locally:
49
+
50
+ ```bash
51
+ pip install -r docs/requirements.txt
52
+ sphinx-build -b html docs docs/_build/html
53
+ python3 -m http.server -d docs/_build/html # then open http://localhost:8000
54
+ ```
55
+
56
+ ## Quick Start
57
+
58
+ ```bash
59
+ pipx install rostainer # or: uv tool install rostainer (see docs/)
60
+
61
+ mkdir my_ros_workspace && cd my_ros_workspace
62
+ rostainer init # scaffolds .rostainer.toml and src/
63
+ rostainer start # prompts for ROS distro/middleware
64
+ rostainer shell # drop into the running container
65
+ ```
66
+
67
+ ## Commands
68
+
69
+ - **`rostainer init`** - Initialize a new ROS workspace with example configs
70
+ - **`rostainer start`** - Start ROS environment (prompts for distro/middleware)
71
+ - **`rostainer restart`** - Restart ROS environment, keeping its build (fast)
72
+ - **`rostainer rebuild`** - Rebuild the workspace from scratch (`--image`: the
73
+ Docker image too)
74
+ - **`rostainer stop`** - Stop running ROS environment, for `start` to
75
+ resume quickly (`--rm`: remove the container; the build is kept either way)
76
+ - **`rostainer shell`** - Drop into bash shell in running container
77
+ - **`rostainer logs`** - Show a running container's logs, or just its build errors
78
+ - **`rostainer status`** - Show status of ROS environment
79
+ - **`rostainer prune`** - Remove unused build caches, old images and old package
80
+ bundles
81
+ - **`rostainer package`** - Build a deployable runtime image and install it
82
+ on a target machine
83
+
84
+ ## Credits
85
+ This toolkit created with help from LLMs (Claude + Gemini)
@@ -0,0 +1,50 @@
1
+ rostainer_cli/__init__.py,sha256=TWETLYq942CPhUrJzuQ5ZKZj6QqvZbBQnxKQNZxNRvg,1404
2
+ rostainer_cli/_version.py,sha256=8OsTLsIVB9D0HdPTmt5rVwyVUBe9xTVGkRslXicxzkM,520
3
+ rostainer_cli/cli.py,sha256=f9iySgazrT7bCBQpPwMB57ZL2Uk-SvmRsVniH1ieE4A,4464
4
+ rostainer_cli/compose_override.py,sha256=hB8KlFAB_0FI-OA3pXGsL2cGItuCf8nelDoO6WKebPQ,9132
5
+ rostainer_cli/config.py,sha256=igmKTH3Sui5noitwwxWQgXw_Rwukpp3xIiaGvxxMZLg,40898
6
+ rostainer_cli/docker_utils.py,sha256=FW7Mt4dyEhzPZWnj9GBiPLHdBzpPWKMBGx4tKOR9BYE,29902
7
+ rostainer_cli/extra_dirs.py,sha256=6uMNhUpG5F00DaUO2mD67BnwRD5ekPHm1xFtlD_fSNs,13701
8
+ rostainer_cli/host_scripts.py,sha256=SZNpLayhT8oHz_m81y4QQSBVfwM2JrpENZj7uDUJ6Tw,4344
9
+ rostainer_cli/lockfile.py,sha256=0PGPAqQkM_4Jm7pjJhhAJwpToZ6j04688rRxb-drueY,3807
10
+ rostainer_cli/log.py,sha256=gEgaRPGVJpYy8eZ9PQ8JQjn2zOqZtfWRLesQ3JA31FQ,4150
11
+ rostainer_cli/mappings.py,sha256=033HnPEJtOm5-WiPtTXelFBUOPqCZDS1akEvES69_c0,7641
12
+ rostainer_cli/ros2_daemon.py,sha256=N-nVXm7FPyonioVAlCNo0koju582hhLTk_8y2MjGlFA,7611
13
+ rostainer_cli/update_check.py,sha256=6iIqXesadr6S4mqkBVNt8ysc0rng14JIhIwFzUS40LE,8331
14
+ rostainer_cli/cmd/__init__.py,sha256=ecUcgVKQyx-PAPQR6Jkf44Fku5L3Y9Uv562EfPDsGg4,1664
15
+ rostainer_cli/cmd/init.py,sha256=VP9LlGKBnWoPpJgyjY0FhETGLTgAq0YiYTVD6gCC6HI,3594
16
+ rostainer_cli/cmd/logs.py,sha256=bq1MlVAy14RMwc1O2tK3c57JmdUA1pxP3M1wCU_rtCI,2675
17
+ rostainer_cli/cmd/package.py,sha256=3-ht9p6YwWxMa0AQ8LA-HU5LHO1687ifjHq17v0Gh6E,3361
18
+ rostainer_cli/cmd/package_create.py,sha256=JS0b3USfLu2PsWQcGAKfPQApxBa8YWa1RGFSl-C2gFw,26223
19
+ rostainer_cli/cmd/prune.py,sha256=qFxaMXDWs4ROZQdtCK0eIj6k02oGELOfDRnFk4do4BQ,9546
20
+ rostainer_cli/cmd/rebuild.py,sha256=bhJmM-FwiYgJPkUH0PLfky5ywd9vAm_stzJP7-J0XIw,3337
21
+ rostainer_cli/cmd/restart.py,sha256=KKazx2YLZXA-aGCEjxfjUDDHthtG8GOBAyunnD2r2qk,3002
22
+ rostainer_cli/cmd/shell.py,sha256=DgYGlCKoKkv0Le_YU9ma7AacyJm0CyEU8vsflWYYvuo,4338
23
+ rostainer_cli/cmd/start.py,sha256=nBVbrlVfBtWU3HLdhNxxDVQpeVRcB2q738ugUihuqow,15421
24
+ rostainer_cli/cmd/status.py,sha256=mz8TO6PYfbUsl7qIhnp2ZaXX40aQDEg593ek_St4-80,2896
25
+ rostainer_cli/cmd/stop.py,sha256=hb2ai_WZzw26-1oIF5U1tiLTfSxBfZiqhUZNMyPHkeA,2985
26
+ rostainer_cli/_assets/.dockerignore,sha256=VToflqPYfECE-yqnmoUcWMkLyMDwKKQWmKmGYrjRNws,835
27
+ rostainer_cli/_assets/docker-compose.gpu-amd.yml,sha256=q9-kwQ1fc9SZCdXjN-TgoY-DGa8DPLjBCSAy2kgjL4E,594
28
+ rostainer_cli/_assets/docker-compose.gpu-intel.yml,sha256=Asg9CLqHpzMrWLgwgJk8DjVNNA9djzFaE7SZJ9siKas,463
29
+ rostainer_cli/_assets/docker-compose.gpu-nvidia.yml,sha256=rleJ6GCvpRu8ZoVyY8xDk1LtzWi0p_vMoAEwIUZsY1A,784
30
+ rostainer_cli/_assets/docker-compose.runtime.yml,sha256=GkYiwrVgczyk56TJpzz0Qfg_XHXGFvNfPqMB_BMAnRw,3140
31
+ rostainer_cli/_assets/docker-compose.yml,sha256=6Ov0-BzOHOJXc22G_mYxiR9UGqr9xMOuzZW2DJ7XSO4,9176
32
+ rostainer_cli/_assets/docker_entrypoint.py,sha256=GLSSWkiFidFnCFWwC5-iKiX2rAdgQLb28tU-NEhyqIA,46475
33
+ rostainer_cli/_assets/dummy_post_build.sh,sha256=EWsGLZjbUfuZGGde6kRfb3CoK3nAMs60N_xPO9oVdms,401
34
+ rostainer_cli/_assets/dummy_pre_build.sh,sha256=RvQAyGvimYQK-JQ6ycZIGH-fGJQ_L1O9L735jKzDewQ,189
35
+ rostainer_cli/_assets/dummy_shell_setup.sh,sha256=k4IYfTninrn8IuewlZ11whdQa2MTXylXQrO5bpAkqPk,216
36
+ rostainer_cli/_assets/extra_dirs.py,sha256=Fu0qtZplluA8j86xhJ5xlam1wh0Ugr6HfltXLVhP58w,5952
37
+ rostainer_cli/_assets/install.py,sha256=C_9-q5AIQ_EezaFUE3gtaQx5wJL570E4AJq7Ka5lLKw,16526
38
+ rostainer_cli/_assets/pylsp-config.json,sha256=loIzM0R7WM9c3jRLr0mQWes-lny0SLj8RBbpHb3JG8c,517
39
+ rostainer_cli/_assets/pylsp-wrapper,sha256=B8LEh3uB1gazGb2Fxqv5rjUqxJJWl59i0ttUgkBw62E,549
40
+ rostainer_cli/_assets/ros1.Dockerfile,sha256=_Jcwmj3b9ggYILI5W7ebgub36uhiF8xiT335JQwSenw,6724
41
+ rostainer_cli/_assets/ros2.Dockerfile,sha256=oTYqsJrpBTqNMqCHHizwpu2N4Vmor9QipqJJQLQA2EM,7718
42
+ rostainer_cli/_assets/ros_log_pruner.py,sha256=bfHd5k96ZejxAjbneZmHpenPJQ-1q54QSjt1AhCBGZM,5592
43
+ rostainer_cli/_assets/runtime_entrypoint.py,sha256=8vDY9veeN0eVRP-NSui5h8h68ovP9Qhpt_5DI2d2gbU,9201
44
+ rostainer_cli/_assets/examples/envrc.example,sha256=-1ybpYTSOFQWZ50PYBB5rez6kl5LZcLAvNhQWIql4Fo,136
45
+ rostainer_cli/_assets/examples/rostainer.toml.example,sha256=CBNZ9QGdFQ4_6qmVj2W3G9iZ0sEmaLIOaD49cxoYJhE,13904
46
+ rostainer-0.0.1.dist-info/METADATA,sha256=25e2XqJSZjo8cwi2hcGtxksLj2uUBuFEj_-XwrbfASo,3636
47
+ rostainer-0.0.1.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
48
+ rostainer-0.0.1.dist-info/entry_points.txt,sha256=ArMmjWdkrT_WzB0Z63Cv_6-65GepWojNqdsTii4GUJ0,53
49
+ rostainer-0.0.1.dist-info/licenses/LICENSE,sha256=3FPhg8yi-z2-AxtXGlX6EMZkii-5PGMfRbEq169o4KU,1092
50
+ rostainer-0.0.1.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.32.4
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ rostainer = rostainer_cli.cli:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Woods Hole Oceanographic Institution
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,29 @@
1
+ """rostainer_cli: the rostainer command-line tool.
2
+
3
+ rostainer manages distro-agnostic ROS (1 and 2) development environments
4
+ backed by Docker, and packages them for reproducible deployment onto robots
5
+ or other target machines.
6
+
7
+ This package is the Python implementation of the ``rostainer`` CLI,
8
+ installed with pipx or uv (see ``docs/guide/installation.md``). It has no
9
+ external dependencies beyond the Python 3 standard library (plus the
10
+ ``tomli`` backport before Python 3.11).
11
+
12
+ Subpackages and modules:
13
+ :mod:`rostainer_cli.log` -- colored console logging helpers.
14
+ :mod:`rostainer_cli.config` -- ``.rostainer.toml`` discovery and loading.
15
+ :mod:`rostainer_cli.mappings` -- parsing of device/volume/port mapping strings.
16
+ :mod:`rostainer_cli.compose_override` -- Docker Compose override file generation.
17
+ :mod:`rostainer_cli.docker_utils` -- shared Docker/Compose invocation helpers.
18
+ :mod:`rostainer_cli.cli` -- the ``rostainer`` command dispatcher.
19
+ :mod:`rostainer_cli.update_check` -- "newer release available" warning.
20
+ :mod:`rostainer_cli.cmd` -- one module per ``rostainer`` subcommand.
21
+ """
22
+
23
+ from __future__ import annotations
24
+
25
+ try:
26
+ # Generated from git tags at build/install time (see pyproject.toml).
27
+ from rostainer_cli._version import __version__
28
+ except ImportError: # Running straight from a checkout that was never installed.
29
+ __version__ = "0.0.0.dev0"
@@ -0,0 +1,24 @@
1
+ .envrc
2
+ Dockerfile
3
+ *.Dockerfile
4
+ docker-compose.yml
5
+ .dockerignore
6
+
7
+ .git # Git version control directory
8
+ .gitignore # Git ignore file
9
+ .vscode # VS Code editor configuration
10
+ .idea # IntelliJ/PyCharm IDE configuration
11
+ __pycache__/ # Python compiled bytecode
12
+ *.pyc # Python compiled bytecode files
13
+ *.log # Log files
14
+ *.tmp # Temporary files
15
+ *.swp # Vim swap files
16
+ .DS_Store # macOS specific files
17
+ npm-debug.log # Node.js debug logs
18
+ node_modules/ # Node.js dependencies (if applicable)
19
+ build/ # Common build output directory
20
+ dist/ # Common distribution output directory
21
+ *.egg-info/ # Python packaging info
22
+ .pytest_cache/ # Pytest cache directory
23
+
24
+ .env
@@ -0,0 +1,25 @@
1
+ # AMD GPU override for docker-compose.yml
2
+ # This file is automatically included when gpu_vendor = "amd" in .rostainer.toml
3
+ # Requires: ROCm drivers installed on host
4
+ # Do not edit this file directly - configure GPU support in ros_docker_config.env
5
+
6
+ services:
7
+ ros1_app:
8
+ devices:
9
+ - /dev/dri:/dev/dri
10
+ - /dev/kfd:/dev/kfd
11
+ group_add:
12
+ - video
13
+ - render
14
+ environment:
15
+ ROC_ENABLE_PRE_VEGA: 1
16
+
17
+ ros2_app:
18
+ devices:
19
+ - /dev/dri:/dev/dri
20
+ - /dev/kfd:/dev/kfd
21
+ group_add:
22
+ - video
23
+ - render
24
+ environment:
25
+ ROC_ENABLE_PRE_VEGA: 1
@@ -0,0 +1,19 @@
1
+ # Intel GPU override for docker-compose.yml
2
+ # This file is automatically included when gpu_vendor = "intel" in .rostainer.toml
3
+ # Requires: Intel compute runtime installed on host
4
+ # Do not edit this file directly - configure GPU support in ros_docker_config.env
5
+
6
+ services:
7
+ ros1_app:
8
+ devices:
9
+ - /dev/dri:/dev/dri
10
+ group_add:
11
+ - video
12
+ - render
13
+
14
+ ros2_app:
15
+ devices:
16
+ - /dev/dri:/dev/dri
17
+ group_add:
18
+ - video
19
+ - render
@@ -0,0 +1,30 @@
1
+ # NVIDIA GPU override for docker-compose.yml
2
+ # This file is automatically included when gpu_vendor = "nvidia" in .rostainer.toml
3
+ # Requires: nvidia-container-toolkit installed on host
4
+
5
+ services:
6
+ ros1_app:
7
+ environment:
8
+ NVIDIA_VISIBLE_DEVICES: all
9
+ NVIDIA_DRIVER_CAPABILITIES: all
10
+ deploy:
11
+ resources:
12
+ reservations:
13
+ devices:
14
+ - driver: cdi
15
+ device_ids:
16
+ - nvidia.com/gpu=all
17
+ capabilities: [gpu]
18
+
19
+ ros2_app:
20
+ environment:
21
+ NVIDIA_VISIBLE_DEVICES: all
22
+ NVIDIA_DRIVER_CAPABILITIES: all
23
+ deploy:
24
+ resources:
25
+ reservations:
26
+ devices:
27
+ - driver: cdi
28
+ device_ids:
29
+ - nvidia.com/gpu=all
30
+ capabilities: [gpu]
@@ -0,0 +1,78 @@
1
+ # Runtime Docker Compose file for packaged deployments.
2
+ #
3
+ # Unlike docker-compose.yml, this has no 'build:' section - it only ever
4
+ # runs an image that was already built by 'rostainer package create' and
5
+ # loaded with 'docker load'. It must never try to pull or build
6
+ # 'ros:${ROS_DISTRO}-ros-base'.
7
+ x-shared-environment: &shared-environment
8
+ RUNTIME_COMMAND: ${RUNTIME_COMMAND:-}
9
+ USER_UID: ${USER_UID:-1000}
10
+ USER_GID: ${USER_GID:-1000}
11
+ USERNAME: ${USERNAME:-rosuser}
12
+ ROS_LOG_MAX_SIZE_MB: ${ROS_LOG_MAX_SIZE_MB:-1024}
13
+ ROS_LOG_MAX_AGE_DAYS: ${ROS_LOG_MAX_AGE_DAYS:-30}
14
+ # Optional watchdog (see runtime_entrypoint.supervise).
15
+ RUNTIME_HEALTHCHECK: ${RUNTIME_HEALTHCHECK:-}
16
+ RUNTIME_HEALTHCHECK_INTERVAL: ${RUNTIME_HEALTHCHECK_INTERVAL:-30}
17
+ RUNTIME_HEALTHCHECK_RETRIES: ${RUNTIME_HEALTHCHECK_RETRIES:-3}
18
+ RUNTIME_HEALTHCHECK_START_PERIOD: ${RUNTIME_HEALTHCHECK_START_PERIOD:-60}
19
+ # ROS 2 discovery (see 'ros_discovery_range' in .rostainer.toml).
20
+ ROS_AUTOMATIC_DISCOVERY_RANGE: ${ROS_AUTOMATIC_DISCOVERY_RANGE:-SUBNET}
21
+ ROS_STATIC_PEERS: ${ROS_STATIC_PEERS:-}
22
+ ROS_DOMAIN_ID: ${ROS_DOMAIN_ID:-0}
23
+ # Humble's equivalent of ROS_AUTOMATIC_DISCOVERY_RANGE=LOCALHOST.
24
+ ROS_LOCALHOST_ONLY: ${ROS_LOCALHOST_ONLY:-}
25
+ # Docker keeps a container's stdout/stderr (everything 'docker logs' shows)
26
+ # without any limit by default, which on a long-running deployment
27
+ # eventually fills the disk.
28
+ x-shared-logging: &shared-logging
29
+ driver: json-file
30
+ options:
31
+ max-size: ${DOCKER_LOG_MAX_SIZE:-10m}
32
+ max-file: "${DOCKER_LOG_MAX_FILES:-5}"
33
+ # Shows the watchdog's state in 'docker ps'. Restarting is the
34
+ # entrypoint's job: Docker never restarts an unhealthy container itself.
35
+ x-shared-healthcheck: &shared-healthcheck
36
+ test: ["CMD-SHELL", "[ ! -f /tmp/.runtime_unhealthy ]"]
37
+ interval: 10s
38
+ timeout: 5s
39
+ retries: 1
40
+
41
+ services:
42
+ ros1_runtime:
43
+ image: ${ROS_DOCKER_IMAGE_TAG}
44
+ container_name: ${ROS1_CONTAINER_NAME:-ros1_container}
45
+ profiles:
46
+ - ros1
47
+ tty: true
48
+ stdin_open: true
49
+ user: "${USER_UID:-1000}:${USER_GID:-1000}"
50
+ environment:
51
+ <<: *shared-environment
52
+ network_mode: ${NETWORK_MODE:-host}
53
+ # 'restart_policy' in .rostainer.toml; packages restart by default.
54
+ restart: ${RESTART_POLICY:-always}
55
+ healthcheck: *shared-healthcheck
56
+ logging: *shared-logging
57
+ # A real PID 1 that forwards SIGTERM (the runtime command, or 'tail -f
58
+ # /dev/null', may ignore it as PID 1) and reaps the background pruner.
59
+ init: true
60
+
61
+ ros2_runtime:
62
+ image: ${ROS_DOCKER_IMAGE_TAG}
63
+ container_name: ${ROS2_CONTAINER_NAME:-ros2_container}
64
+ profiles:
65
+ - ros2
66
+ tty: true
67
+ stdin_open: true
68
+ user: "${USER_UID:-1000}:${USER_GID:-1000}"
69
+ environment:
70
+ <<: *shared-environment
71
+ network_mode: ${NETWORK_MODE:-host}
72
+ # 'restart_policy' in .rostainer.toml; packages restart by default.
73
+ restart: ${RESTART_POLICY:-always}
74
+ healthcheck: *shared-healthcheck
75
+ logging: *shared-logging
76
+ # A real PID 1 that forwards SIGTERM (the runtime command, or 'tail -f
77
+ # /dev/null', may ignore it as PID 1) and reaps the background pruner.
78
+ init: true
@@ -0,0 +1,204 @@
1
+ x-shared-environment: &shared-environment
2
+ DISPLAY: ${DISPLAY}
3
+ QT_X11_NO_MITSHM: 1
4
+ HEALTHCHECK_READY_FILE: ${HEALTHCHECK_READY_FILE}
5
+ BUILD_SUCCESS_FILE: ${BUILD_SUCCESS_FILE}
6
+ BUILD_ERROR_LOG: ${BUILD_ERROR_LOG}
7
+ PRE_BUILD_SCRIPT: ${PRE_BUILD_SCRIPT}
8
+ POST_BUILD_SCRIPT: ${POST_BUILD_SCRIPT}
9
+ USER_UID: ${USER_UID:-1000}
10
+ USER_GID: ${USER_GID:-1000}
11
+ USERNAME: ${USERNAME:-rosuser}
12
+ ROS_LOG_MAX_SIZE_MB: ${ROS_LOG_MAX_SIZE_MB:-1024}
13
+ ROS_LOG_MAX_AGE_DAYS: ${ROS_LOG_MAX_AGE_DAYS:-30}
14
+ ROSDEP_INSTALL: ${ROSDEP_INSTALL:-true}
15
+ ROSDEP_SKIP_KEYS: ${ROSDEP_SKIP_KEYS:-}
16
+ PIP_INSTALL_REQUIREMENTS: ${PIP_INSTALL_REQUIREMENTS:-true}
17
+ # The ROS environment for non-interactive bash ('bash -c', scripts,
18
+ # 'docker exec <container> bash -c'), which never reaches the lines in
19
+ # ~/.bashrc; written by the entrypoint (docker_entrypoint.SHELL_ENV_PATH).
20
+ BASH_ENV: /home/${USERNAME:-rosuser}/.rostainer/env.sh
21
+ # 'build_on_start' in .rostainer.toml (dev containers only).
22
+ ROSTAINER_BUILD_ON_START: ${ROSTAINER_BUILD_ON_START:-auto}
23
+ # ROS 2 discovery (see 'ros_discovery_range' in .rostainer.toml).
24
+ ROS_AUTOMATIC_DISCOVERY_RANGE: ${ROS_AUTOMATIC_DISCOVERY_RANGE:-SUBNET}
25
+ ROS_STATIC_PEERS: ${ROS_STATIC_PEERS:-}
26
+ ROS_DOMAIN_ID: ${ROS_DOMAIN_ID:-0}
27
+ # Humble's equivalent of ROS_AUTOMATIC_DISCOVERY_RANGE=LOCALHOST.
28
+ ROS_LOCALHOST_ONLY: ${ROS_LOCALHOST_ONLY:-}
29
+ # Docker keeps a container's stdout/stderr (everything 'docker logs' shows)
30
+ # without any limit by default.
31
+ x-shared-logging: &shared-logging
32
+ driver: json-file
33
+ options:
34
+ max-size: ${DOCKER_LOG_MAX_SIZE:-10m}
35
+ max-file: "${DOCKER_LOG_MAX_FILES:-5}"
36
+ x-shared-healthcheck: &shared-healthcheck
37
+ test:
38
+ - CMD-SHELL
39
+ - |
40
+ if [ -f "${HEALTHCHECK_READY_FILE}" ]; then
41
+ exit 0
42
+ else
43
+ exit 1
44
+ fi
45
+ interval: 10s
46
+ timeout: 5s
47
+ retries: 60
48
+ # Effectively no limit on startup: failures don't count during the
49
+ # start period, and the first success ends it. So 'rostainer start'
50
+ # waits however long the build takes, until the entrypoint finishes
51
+ # or the container exits on an error.
52
+ start_period: 8760h
53
+ # How often to check during the start period (Docker 25+; older
54
+ # versions use 'interval'), so 'rostainer start' returns soon after
55
+ # the entrypoint finishes, not up to 'interval' later.
56
+ start_interval: 1s
57
+
58
+ services:
59
+ ros1_app:
60
+ image: ${ROS_DOCKER_IMAGE_TAG:-rostainer/ros1:base}
61
+ build:
62
+ context: .
63
+ dockerfile: ros1.Dockerfile
64
+ target: dev
65
+ args:
66
+ ROS_DISTRO_ARG: ${ROS_DISTRO_ARG}
67
+ USER_UID: ${USER_UID:-1000}
68
+ USER_GID: ${USER_GID:-1000}
69
+ USERNAME: ${USERNAME:-rosuser}
70
+ container_name: ${ROS1_CONTAINER_NAME}
71
+ profiles:
72
+ - ros1
73
+ tty: true
74
+ stdin_open: true
75
+ user: "${USER_UID:-1000}:${USER_GID:-1000}"
76
+ volumes:
77
+ - ${WORKSPACE_SRC_DIR}:/home/${USERNAME:-rosuser}/ros_ws/src
78
+ - ${SHELL_SETUP_SCRIPT}:/usr/local/bin/shell_setup.sh
79
+ - ${PRE_BUILD_SCRIPT}:/usr/local/bin/pre_build.sh
80
+ - ${POST_BUILD_SCRIPT}:/usr/local/bin/post_build.sh
81
+ - ./pylsp-wrapper:/usr/local/bin/pylsp-wrapper:ro
82
+ # The entrypoint from this rostainer install, not whichever version is
83
+ # baked into a cached image, so entrypoint changes apply without --rebuild.
84
+ - ./docker_entrypoint.py:/usr/local/bin/docker_entrypoint.py:ro
85
+ - ./ros_log_pruner.py:/usr/local/lib/rostainer/ros_log_pruner.py:ro
86
+ - ./pylsp-config.json:/docker_config/pylsp-config.json:ro
87
+ # Where rostainer leaves requests for the next start, e.g. 'rostainer
88
+ # start --no-build' (docker_utils.request_build_on_start).
89
+ - ${ROSTAINER_CONTROL_DIR}/ros1:/run/rostainer
90
+ - /tmp/.X11-unix:/tmp/.X11-unix:rw
91
+ # Build state, kept across container restarts/recreation (see the
92
+ # top-level 'volumes:' below). 'rostainer rebuild' removes them.
93
+ - ros1_build:/home/${USERNAME:-rosuser}/ros_ws/build
94
+ - ros1_devel:/home/${USERNAME:-rosuser}/ros_ws/devel
95
+ # Where pip's --user installs land (ROS 1 has no venv).
96
+ - ros1_pylocal:/home/${USERNAME:-rosuser}/.local
97
+ environment:
98
+ <<: *shared-environment
99
+ network_mode: ${NETWORK_MODE:-host}
100
+ # 'restart_policy' in .rostainer.toml; dev containers don't restart by default.
101
+ restart: ${RESTART_POLICY:-no}
102
+ healthcheck: *shared-healthcheck
103
+ labels:
104
+ # Which workspace this container belongs to, checked by rostainer
105
+ # before it touches an existing container (docker_utils.check_container_workspace).
106
+ rostainer.workspace: ${ROSTAINER_WORKSPACE:-}
107
+ # Marks a dev container, and which profile; rostainer finds this
108
+ # workspace's containers by these two labels (docker_utils.workspace_containers).
109
+ rostainer.profile: ros1
110
+ logging: *shared-logging
111
+ # Through python3, so the mounted file needn't be executable on the host.
112
+ entrypoint: ["python3", "/usr/local/bin/docker_entrypoint.py"]
113
+ # A real PID 1 that forwards SIGTERM: the entrypoint ends by exec'ing
114
+ # 'tail -f /dev/null', which as PID 1 ignores it, making every stop wait
115
+ # out Docker's 10s timeout.
116
+ init: true
117
+
118
+ ros2_app:
119
+ image: ${ROS_DOCKER_IMAGE_TAG:-rostainer/ros2:base}
120
+ build:
121
+ context: .
122
+ dockerfile: ros2.Dockerfile
123
+ target: dev
124
+ args:
125
+ ROS_DISTRO_ARG: ${ROS_DISTRO_ARG}
126
+ ROS_MIDDLEWARE_ARG: ${ROS_MIDDLEWARE_ARG}
127
+ USER_UID: ${USER_UID:-1000}
128
+ USER_GID: ${USER_GID:-1000}
129
+ USERNAME: ${USERNAME:-rosuser}
130
+ container_name: ${ROS2_CONTAINER_NAME}
131
+ profiles:
132
+ - ros2
133
+ stdin_open: true
134
+ user: "${USER_UID:-1000}:${USER_GID:-1000}"
135
+ volumes:
136
+ - ${WORKSPACE_SRC_DIR}:/home/${USERNAME:-rosuser}/ros_ws/src
137
+ - ${SHELL_SETUP_SCRIPT}:/usr/local/bin/shell_setup.sh
138
+ - ${PRE_BUILD_SCRIPT}:/usr/local/bin/pre_build.sh
139
+ - ${POST_BUILD_SCRIPT}:/usr/local/bin/post_build.sh
140
+ - ./pylsp-wrapper:/usr/local/bin/pylsp-wrapper:ro
141
+ # The entrypoint from this rostainer install, not whichever version is
142
+ # baked into a cached image, so entrypoint changes apply without --rebuild.
143
+ - ./docker_entrypoint.py:/usr/local/bin/docker_entrypoint.py:ro
144
+ - ./ros_log_pruner.py:/usr/local/lib/rostainer/ros_log_pruner.py:ro
145
+ - ./pylsp-config.json:/docker_config/pylsp-config.json:ro
146
+ # Where rostainer leaves requests for the next start, e.g. 'rostainer
147
+ # start --no-build' (docker_utils.request_build_on_start).
148
+ - ${ROSTAINER_CONTROL_DIR}/ros2:/run/rostainer
149
+ - /tmp/.X11-unix:/tmp/.X11-unix:rw
150
+ # Build state, kept across container restarts/recreation (see the
151
+ # top-level 'volumes:' below). 'rostainer rebuild' removes them.
152
+ - ros2_build:/home/${USERNAME:-rosuser}/ros_ws/build
153
+ - ros2_install:/home/${USERNAME:-rosuser}/ros_ws/install
154
+ - ros2_log:/home/${USERNAME:-rosuser}/ros_ws/log
155
+ - ros2_venv:/opt/venv
156
+ environment:
157
+ <<: *shared-environment
158
+ network_mode: ${NETWORK_MODE:-host}
159
+ # 'restart_policy' in .rostainer.toml; dev containers don't restart by default.
160
+ restart: ${RESTART_POLICY:-no}
161
+ healthcheck: *shared-healthcheck
162
+ labels:
163
+ # Which workspace this container belongs to, checked by rostainer
164
+ # before it touches an existing container (docker_utils.check_container_workspace).
165
+ rostainer.workspace: ${ROSTAINER_WORKSPACE:-}
166
+ # Marks a dev container, and which profile; rostainer finds this
167
+ # workspace's containers by these two labels (docker_utils.workspace_containers).
168
+ rostainer.profile: ros2
169
+ logging: *shared-logging
170
+ # Through python3, so the mounted file needn't be executable on the host.
171
+ entrypoint: ["python3", "/usr/local/bin/docker_entrypoint.py"]
172
+ # A real PID 1 that forwards SIGTERM: the entrypoint ends by exec'ing
173
+ # 'tail -f /dev/null', which as PID 1 ignores it, making every stop wait
174
+ # out Docker's 10s timeout.
175
+ init: true
176
+
177
+ # Named per container and distro by rostainer (ROSTAINER_STATE_VOLUME_PREFIX,
178
+ # see docker_utils.state_volume_names), so switching distros doesn't reuse
179
+ # another distro's build. Compose only creates the active profile's volumes.
180
+ # The labels tell 'rostainer prune' which workspace and distro each is for.
181
+ volumes:
182
+ ros1_build:
183
+ name: ${ROSTAINER_STATE_VOLUME_PREFIX:-rostainer}_build
184
+ labels: &state-volume-labels
185
+ rostainer.workspace: ${ROSTAINER_WORKSPACE:-}
186
+ rostainer.distro: ${ROS_DISTRO_ARG:-}
187
+ ros1_devel:
188
+ name: ${ROSTAINER_STATE_VOLUME_PREFIX:-rostainer}_devel
189
+ labels: *state-volume-labels
190
+ ros1_pylocal:
191
+ name: ${ROSTAINER_STATE_VOLUME_PREFIX:-rostainer}_pylocal
192
+ labels: *state-volume-labels
193
+ ros2_build:
194
+ name: ${ROSTAINER_STATE_VOLUME_PREFIX:-rostainer}_build
195
+ labels: *state-volume-labels
196
+ ros2_install:
197
+ name: ${ROSTAINER_STATE_VOLUME_PREFIX:-rostainer}_install
198
+ labels: *state-volume-labels
199
+ ros2_log:
200
+ name: ${ROSTAINER_STATE_VOLUME_PREFIX:-rostainer}_log
201
+ labels: *state-volume-labels
202
+ ros2_venv:
203
+ name: ${ROSTAINER_STATE_VOLUME_PREFIX:-rostainer}_venv
204
+ labels: *state-volume-labels