offbox 0.1.0__tar.gz

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 (180) hide show
  1. offbox-0.1.0/.dockerignore +6 -0
  2. offbox-0.1.0/.gitignore +230 -0
  3. offbox-0.1.0/.pre-commit-config.yaml +13 -0
  4. offbox-0.1.0/AGENTS.md +26 -0
  5. offbox-0.1.0/CHANGELOG.md +107 -0
  6. offbox-0.1.0/CODE_OF_CONDUCT.md +9 -0
  7. offbox-0.1.0/CONTRIBUTING.md +101 -0
  8. offbox-0.1.0/LICENSE +21 -0
  9. offbox-0.1.0/Makefile +14 -0
  10. offbox-0.1.0/PKG-INFO +140 -0
  11. offbox-0.1.0/README.md +110 -0
  12. offbox-0.1.0/SECURITY.md +7 -0
  13. offbox-0.1.0/docs/agents.md +86 -0
  14. offbox-0.1.0/docs/architecture.md +48 -0
  15. offbox-0.1.0/docs/benchmarks/2026-10-23-gcp.json +1732 -0
  16. offbox-0.1.0/docs/benchmarks/2026-10-23-gcp.md +84 -0
  17. offbox-0.1.0/docs/benchmarks/2026-10-23-hetzner.json +738 -0
  18. offbox-0.1.0/docs/benchmarks/2026-10-23-hetzner.md +112 -0
  19. offbox-0.1.0/docs/configuration.md +281 -0
  20. offbox-0.1.0/docs/installation.md +178 -0
  21. offbox-0.1.0/docs/limits.md +39 -0
  22. offbox-0.1.0/docs/providers.md +74 -0
  23. offbox-0.1.0/docs/repository-safety.md +15 -0
  24. offbox-0.1.0/docs/security.md +50 -0
  25. offbox-0.1.0/docs/troubleshooting.md +424 -0
  26. offbox-0.1.0/docs/universal-image.md +41 -0
  27. offbox-0.1.0/docs/writing-a-provider.md +50 -0
  28. offbox-0.1.0/examples/node-playwright/.gitignore +4 -0
  29. offbox-0.1.0/examples/node-playwright/README.md +29 -0
  30. offbox-0.1.0/examples/node-playwright/compose.yaml +15 -0
  31. offbox-0.1.0/examples/node-playwright/index.html +17 -0
  32. offbox-0.1.0/examples/node-playwright/main.js +15 -0
  33. offbox-0.1.0/examples/node-playwright/offbox.toml +14 -0
  34. offbox-0.1.0/examples/node-playwright/package-lock.json +847 -0
  35. offbox-0.1.0/examples/node-playwright/package.json +16 -0
  36. offbox-0.1.0/examples/node-playwright/playwright.config.js +12 -0
  37. offbox-0.1.0/examples/node-playwright/style.css +30 -0
  38. offbox-0.1.0/examples/node-playwright/tests/counter.spec.js +13 -0
  39. offbox-0.1.0/examples/python-compose/.dockerignore +4 -0
  40. offbox-0.1.0/examples/python-compose/.gitignore +3 -0
  41. offbox-0.1.0/examples/python-compose/Dockerfile +11 -0
  42. offbox-0.1.0/examples/python-compose/README.md +28 -0
  43. offbox-0.1.0/examples/python-compose/compose.yaml +34 -0
  44. offbox-0.1.0/examples/python-compose/offbox.toml +14 -0
  45. offbox-0.1.0/examples/python-compose/pyproject.toml +19 -0
  46. offbox-0.1.0/examples/python-compose/src/app/__init__.py +0 -0
  47. offbox-0.1.0/examples/python-compose/src/app/main.py +61 -0
  48. offbox-0.1.0/examples/python-compose/tests/test_items.py +31 -0
  49. offbox-0.1.0/examples/python-compose/uv.lock +431 -0
  50. offbox-0.1.0/host/.gitkeep +0 -0
  51. offbox-0.1.0/host/cloud-init.yaml.j2 +15 -0
  52. offbox-0.1.0/host/host-init.sh +230 -0
  53. offbox-0.1.0/images/universal/.gitkeep +0 -0
  54. offbox-0.1.0/images/universal/Dockerfile +101 -0
  55. offbox-0.1.0/images/universal/offbox-init +75 -0
  56. offbox-0.1.0/images/universal/offbox-run +131 -0
  57. offbox-0.1.0/providers/.gitkeep +0 -0
  58. offbox-0.1.0/providers/gcp/.terraform.lock.hcl +52 -0
  59. offbox-0.1.0/providers/gcp/main.tf +67 -0
  60. offbox-0.1.0/providers/gcp/outputs.tf +7 -0
  61. offbox-0.1.0/providers/gcp/provider.toml +9 -0
  62. offbox-0.1.0/providers/gcp/tests/provider.tftest.hcl +65 -0
  63. offbox-0.1.0/providers/gcp/variables.tf +33 -0
  64. offbox-0.1.0/providers/gcp/versions.tf +12 -0
  65. offbox-0.1.0/providers/hetzner/.terraform.lock.hcl +51 -0
  66. offbox-0.1.0/providers/hetzner/main.tf +32 -0
  67. offbox-0.1.0/providers/hetzner/outputs.tf +7 -0
  68. offbox-0.1.0/providers/hetzner/provider.toml +9 -0
  69. offbox-0.1.0/providers/hetzner/tests/provider.tftest.hcl +57 -0
  70. offbox-0.1.0/providers/hetzner/variables.tf +28 -0
  71. offbox-0.1.0/providers/hetzner/versions.tf +12 -0
  72. offbox-0.1.0/providers/ssh/provider.toml +4 -0
  73. offbox-0.1.0/pyproject.toml +105 -0
  74. offbox-0.1.0/src/offbox/__init__.py +2 -0
  75. offbox-0.1.0/src/offbox/__main__.py +4 -0
  76. offbox-0.1.0/src/offbox/cli/__init__.py +117 -0
  77. offbox-0.1.0/src/offbox/cli/config.py +39 -0
  78. offbox-0.1.0/src/offbox/cli/env.py +109 -0
  79. offbox-0.1.0/src/offbox/cli/exec.py +50 -0
  80. offbox-0.1.0/src/offbox/cli/host.py +313 -0
  81. offbox-0.1.0/src/offbox/cli/misc.py +132 -0
  82. offbox-0.1.0/src/offbox/cli/ports.py +44 -0
  83. offbox-0.1.0/src/offbox/config.py +189 -0
  84. offbox-0.1.0/src/offbox/console.py +63 -0
  85. offbox-0.1.0/src/offbox/doctor.py +174 -0
  86. offbox-0.1.0/src/offbox/drivers/__init__.py +0 -0
  87. offbox-0.1.0/src/offbox/drivers/base.py +40 -0
  88. offbox-0.1.0/src/offbox/drivers/none.py +114 -0
  89. offbox-0.1.0/src/offbox/drivers/tofu.py +59 -0
  90. offbox-0.1.0/src/offbox/errors.py +45 -0
  91. offbox-0.1.0/src/offbox/execute.py +772 -0
  92. offbox-0.1.0/src/offbox/host/__init__.py +89 -0
  93. offbox-0.1.0/src/offbox/host/activity.py +58 -0
  94. offbox-0.1.0/src/offbox/host/auto.py +322 -0
  95. offbox-0.1.0/src/offbox/host/cloudinit.py +44 -0
  96. offbox-0.1.0/src/offbox/host/create.py +198 -0
  97. offbox-0.1.0/src/offbox/host/destroy.py +151 -0
  98. offbox-0.1.0/src/offbox/host/init.py +196 -0
  99. offbox-0.1.0/src/offbox/host/ready.py +106 -0
  100. offbox-0.1.0/src/offbox/host/timer.py +227 -0
  101. offbox-0.1.0/src/offbox/host/usage.py +123 -0
  102. offbox-0.1.0/src/offbox/host/warnings.py +61 -0
  103. offbox-0.1.0/src/offbox/locking.py +27 -0
  104. offbox-0.1.0/src/offbox/logging.py +154 -0
  105. offbox-0.1.0/src/offbox/logs.py +135 -0
  106. offbox-0.1.0/src/offbox/naming.py +67 -0
  107. offbox-0.1.0/src/offbox/paths.py +55 -0
  108. offbox-0.1.0/src/offbox/ports.py +610 -0
  109. offbox-0.1.0/src/offbox/project.py +187 -0
  110. offbox-0.1.0/src/offbox/providers.py +117 -0
  111. offbox-0.1.0/src/offbox/py.typed +0 -0
  112. offbox-0.1.0/src/offbox/runner.py +291 -0
  113. offbox-0.1.0/src/offbox/runtime.py +887 -0
  114. offbox-0.1.0/src/offbox/setup.py +181 -0
  115. offbox-0.1.0/src/offbox/share.py +286 -0
  116. offbox-0.1.0/src/offbox/ssh.py +179 -0
  117. offbox-0.1.0/src/offbox/state.py +157 -0
  118. offbox-0.1.0/src/offbox/status.py +378 -0
  119. offbox-0.1.0/src/offbox/sync.py +380 -0
  120. offbox-0.1.0/src/offbox/timings.py +69 -0
  121. offbox-0.1.0/src/offbox/tools.py +227 -0
  122. offbox-0.1.0/src/offbox/uninstall.py +114 -0
  123. offbox-0.1.0/tests/fixtures/cloud-init.yaml +15 -0
  124. offbox-0.1.0/tests/fixtures/compose/README.md +3 -0
  125. offbox-0.1.0/tests/fixtures/compose/ports-array.json +5 -0
  126. offbox-0.1.0/tests/fixtures/compose/ports-ndjson.json +3 -0
  127. offbox-0.1.0/tests/fixtures/docker/README.md +3 -0
  128. offbox-0.1.0/tests/fixtures/docker/container-inspect-containerd-store.json +17 -0
  129. offbox-0.1.0/tests/fixtures/docker/manifest-verbose-oci.json +100 -0
  130. offbox-0.1.0/tests/fixtures/mutagen/README.md +9 -0
  131. offbox-0.1.0/tests/fixtures/mutagen/v0.18.1-problems.json +83 -0
  132. offbox-0.1.0/tests/fixtures/status-schema.json +273 -0
  133. offbox-0.1.0/tests/smoke/Dockerfile +15 -0
  134. offbox-0.1.0/tests/smoke/controller.py +698 -0
  135. offbox-0.1.0/tests/smoke/controller.sh +23 -0
  136. offbox-0.1.0/tests/smoke/host.sh +37 -0
  137. offbox-0.1.0/tests/smoke/run.sh +169 -0
  138. offbox-0.1.0/tests/smoke/signal.sh +38 -0
  139. offbox-0.1.0/tests/smoke/test-guards.sh +105 -0
  140. offbox-0.1.0/tests/unit/conftest.py +30 -0
  141. offbox-0.1.0/tests/unit/fakes.py +141 -0
  142. offbox-0.1.0/tests/unit/test_auto_hosts.py +749 -0
  143. offbox-0.1.0/tests/unit/test_cli.py +129 -0
  144. offbox-0.1.0/tests/unit/test_core.py +175 -0
  145. offbox-0.1.0/tests/unit/test_doctor.py +281 -0
  146. offbox-0.1.0/tests/unit/test_examples.py +73 -0
  147. offbox-0.1.0/tests/unit/test_exec_cli.py +40 -0
  148. offbox-0.1.0/tests/unit/test_exec_env_security.py +137 -0
  149. offbox-0.1.0/tests/unit/test_exec_preflight.py +436 -0
  150. offbox-0.1.0/tests/unit/test_exec_secret_logging.py +73 -0
  151. offbox-0.1.0/tests/unit/test_exec_worktree.py +269 -0
  152. offbox-0.1.0/tests/unit/test_execute.py +361 -0
  153. offbox-0.1.0/tests/unit/test_gcp.py +32 -0
  154. offbox-0.1.0/tests/unit/test_hosts.py +1220 -0
  155. offbox-0.1.0/tests/unit/test_install.py +258 -0
  156. offbox-0.1.0/tests/unit/test_locking.py +98 -0
  157. offbox-0.1.0/tests/unit/test_logs.py +205 -0
  158. offbox-0.1.0/tests/unit/test_misc_cli.py +135 -0
  159. offbox-0.1.0/tests/unit/test_none_driver.py +154 -0
  160. offbox-0.1.0/tests/unit/test_ports.py +689 -0
  161. offbox-0.1.0/tests/unit/test_ports_hardening.py +100 -0
  162. offbox-0.1.0/tests/unit/test_project.py +179 -0
  163. offbox-0.1.0/tests/unit/test_providers.py +73 -0
  164. offbox-0.1.0/tests/unit/test_ready.py +83 -0
  165. offbox-0.1.0/tests/unit/test_runner.py +142 -0
  166. offbox-0.1.0/tests/unit/test_runner_live.py +232 -0
  167. offbox-0.1.0/tests/unit/test_runtime.py +1007 -0
  168. offbox-0.1.0/tests/unit/test_runtime_hardening.py +208 -0
  169. offbox-0.1.0/tests/unit/test_setup.py +343 -0
  170. offbox-0.1.0/tests/unit/test_share.py +410 -0
  171. offbox-0.1.0/tests/unit/test_ssh.py +69 -0
  172. offbox-0.1.0/tests/unit/test_state_locking.py +58 -0
  173. offbox-0.1.0/tests/unit/test_state_recovery.py +57 -0
  174. offbox-0.1.0/tests/unit/test_status.py +374 -0
  175. offbox-0.1.0/tests/unit/test_stream_process.py +170 -0
  176. offbox-0.1.0/tests/unit/test_sync.py +415 -0
  177. offbox-0.1.0/tests/unit/test_timings.py +107 -0
  178. offbox-0.1.0/tests/unit/test_tools.py +191 -0
  179. offbox-0.1.0/tests/unit/test_uninstall.py +420 -0
  180. offbox-0.1.0/uv.lock +753 -0
@@ -0,0 +1,6 @@
1
+ **
2
+ !images/universal/Dockerfile
3
+ !images/universal/offbox-init
4
+ !images/universal/offbox-run
5
+ !tests/smoke/Dockerfile
6
+ !tests/smoke/host.sh
@@ -0,0 +1,230 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ *.lcov
51
+ .hypothesis/
52
+ .pytest_cache/
53
+ cover/
54
+
55
+ # Translations
56
+ *.mo
57
+ *.pot
58
+
59
+ # Django stuff:
60
+ *.log
61
+ local_settings.py
62
+ db.sqlite3
63
+ db.sqlite3-journal
64
+
65
+ # Flask stuff:
66
+ instance/
67
+ .webassets-cache
68
+
69
+ # Scrapy stuff:
70
+ .scrapy
71
+
72
+ # Sphinx documentation
73
+ docs/_build/
74
+
75
+ # PyBuilder
76
+ .pybuilder/
77
+ target/
78
+
79
+ # Jupyter Notebook
80
+ .ipynb_checkpoints
81
+
82
+ # IPython
83
+ profile_default/
84
+ ipython_config.py
85
+
86
+ # pyenv
87
+ # For a library or package, you might want to ignore these files since the code is
88
+ # intended to run in multiple environments; otherwise, check them in:
89
+ # .python-version
90
+
91
+ # pipenv
92
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
93
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
94
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
95
+ # install all needed dependencies.
96
+ # Pipfile.lock
97
+
98
+ # uv
99
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
100
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
101
+ # commonly ignored for libraries.
102
+ # uv.lock
103
+
104
+ # poetry
105
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
106
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
107
+ # commonly ignored for libraries.
108
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
109
+ # poetry.lock
110
+ # poetry.toml
111
+
112
+ # pdm
113
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
114
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
115
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
116
+ # pdm.lock
117
+ # pdm.toml
118
+ .pdm-python
119
+ .pdm-build/
120
+
121
+ # pixi
122
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
123
+ # pixi.lock
124
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
125
+ # in the .venv directory. It is recommended not to include this directory in version control.
126
+ .pixi/*
127
+ !.pixi/config.toml
128
+
129
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
130
+ __pypackages__/
131
+
132
+ # Celery stuff
133
+ celerybeat-schedule*
134
+ celerybeat.pid
135
+
136
+ # Redis
137
+ *.rdb
138
+ *.aof
139
+ *.pid
140
+
141
+ # RabbitMQ
142
+ mnesia/
143
+ rabbitmq/
144
+ rabbitmq-data/
145
+
146
+ # ActiveMQ
147
+ activemq-data/
148
+
149
+ # SageMath parsed files
150
+ *.sage.py
151
+
152
+ # Environments
153
+ .env
154
+ .envrc
155
+ .venv
156
+ env/
157
+ venv/
158
+ ENV/
159
+ env.bak/
160
+ venv.bak/
161
+
162
+ # Spyder project settings
163
+ .spyderproject
164
+ .spyproject
165
+
166
+ # Rope project settings
167
+ .ropeproject
168
+
169
+ # mkdocs/Zensical documentation
170
+ /site
171
+
172
+ # mypy
173
+ .mypy_cache/
174
+ .dmypy.json
175
+ dmypy.json
176
+
177
+ # Pyre type checker
178
+ .pyre/
179
+
180
+ # pytype static type analyzer
181
+ .pytype/
182
+
183
+ # Cython debug symbols
184
+ cython_debug/
185
+
186
+ # PyCharm
187
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
188
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
189
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
190
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
191
+ # .idea/
192
+
193
+ # Abstra
194
+ # Abstra is an AI-powered process automation framework.
195
+ # Ignore directories containing user credentials, local state, and settings.
196
+ # Learn more at https://abstra.io/docs
197
+ .abstra/
198
+
199
+ # Visual Studio Code
200
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore that
201
+ # can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
202
+ # and can be added to the global gitignore or merged into this file. However, if you prefer, you
203
+ # could uncomment the following to ignore the entire vscode folder
204
+ # .vscode/
205
+ # Temporary file for partial code execution
206
+ tempCodeRunnerFile.py
207
+
208
+ # Ruff stuff:
209
+ .ruff_cache/
210
+
211
+ # PyPI configuration file
212
+ .pypirc
213
+
214
+ # Marimo
215
+ marimo/_static/
216
+ marimo/_lsp/
217
+ __marimo__/
218
+
219
+ # Streamlit
220
+ .streamlit/secrets.toml
221
+
222
+ # Local agent task snapshots and results
223
+ .agent/
224
+
225
+ # Generated provider workspaces can contain private cloud-init data.
226
+ .terraform/
227
+ *.tfstate
228
+ *.tfstate.*
229
+ *.tfplan
230
+ offbox.auto.tfvars.json
@@ -0,0 +1,13 @@
1
+ repos:
2
+ - repo: local
3
+ hooks:
4
+ - id: ruff-format
5
+ name: ruff format
6
+ entry: uv run --frozen ruff format
7
+ language: system
8
+ types_or: [python, pyi]
9
+ - id: ruff-check
10
+ name: ruff check
11
+ entry: uv run --frozen ruff check
12
+ language: system
13
+ types_or: [python, pyi]
offbox-0.1.0/AGENTS.md ADDED
@@ -0,0 +1,26 @@
1
+ # Repository instructions
2
+
3
+ ## Commands
4
+
5
+ Use uv for Python tooling. Run `uv sync --frozen` to install locked dependencies. Before pushing, run `make check` and `make test`. Use `make fmt` for formatting and lint fixes and `uv build` for distributions. Validation uses deterministic unit tests, static checks, builds and one focused Linux Docker/SSH smoke job. Do not create billable resources or add real-cloud tests.
6
+
7
+ ## Code rules
8
+
9
+ - No comments by default. A comment explains why, never what, and only if deleting it would lose a fact. Prefer better names. Short docstrings only on public functions whose contract is not obvious.
10
+ - No `print` outside `src/offbox/console.py`. That module owns stdout/stderr; use module loggers elsewhere: `logger = logging.getLogger(__name__)`. Human messages go to stderr, parseable results to stdout.
11
+ - Annotate every signature, including `-> None`. No `Any` in annotations. `# type: ignore[code]` is allowed only with a reason.
12
+ - Use typed Pydantic models at boundaries: config files, state files, provider outputs and `--json` output. Do not pass raw dicts between modules.
13
+ - Raise `OffboxError` subclasses, never bare `Exception`. No broad `except` that hides a failure. When catching to add context, use `raise ... from e`.
14
+ - All subprocesses go through `Runner`. Use argv lists, never `shell=True`.
15
+ - No speculative abstractions, feature flags for unused features, or compatibility shims. Fix root causes.
16
+ - Tests are deterministic. No `time.sleep` in unit tests; inject `Clock`/`Runner`. No `pytest.skip()` without a reason. No assertions that cannot fail. Do not end a test on `assert x is not None`; assert the actual value.
17
+ - Define `DEFAULT_IMAGE` only in `src/offbox/__init__.py`. Other defaults and generated documentation refer to that constant.
18
+ - Package root `host/`, `images/` and `providers/` resources under `offbox/_data/`; access them using `importlib.resources`.
19
+
20
+ ## Git and PRs
21
+
22
+ - Use conventional commit messages: `feat:`, `fix:`, `docs:`, `test:`, `chore:`.
23
+ - Keep each PR focused on one change, targeting `master`. The PR description says what changed and how it was verified, including the commands run.
24
+ - `make check` and `make test` must pass locally before pushing.
25
+ - Never commit secrets; tests never need real credentials. Do not create billable resources for tests.
26
+ - Keep local agent task scratch under the ignored `.agent/` directory.
@@ -0,0 +1,107 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here.
4
+
5
+ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [0.1.0] - 2026-10-26
10
+
11
+ First public release.
12
+
13
+ ### Added
14
+
15
+ - Hetzner/OpenTofu provisioning and existing-SSH host initialization with pinned SSH host keys and recoverable local provider state.
16
+ - Per-worktree privileged environments with separate Docker daemons, resource limits, persistent data, ownership checks and garbage collection.
17
+ - Public universal amd64 image with pinned development tools, Docker Compose, browser dependencies and execution/readiness shims.
18
+ - Two-way-safe Mutagen synchronization, mandatory Git exclusion, dependency-file hashing and explicit project setup commands.
19
+ - Streaming command execution with scoped environment variables, stdin/TTY modes, preserved exit codes and bounded signal cleanup.
20
+ - Stable loopback port allocation, SSH forward restoration and port swaps across environments.
21
+ - Typed health reports, scoped logs, guided setup and local uninstall that preserves remote hosts.
22
+ - Configuration, architecture, provider, security and troubleshooting guides, plus FastAPI/Postgres and Vite/Playwright examples.
23
+ - Focused Linux Docker/SSH smoke validation without cloud credentials or billable cloud resources.
24
+ - Google Cloud provisioning with a dedicated per-host network, Ubuntu cloud-init, no attached VM service account, standard Google authentication and mocked Terraform contract tests.
25
+ - A Google Cloud benchmark of both sample apps and a same-VM comparison measuring a 12.2% median command latency reduction from batching checks, with verified cloud cleanup.
26
+ - Opt-in `--timings` summaries for provisioning, synchronization, setup, forwarding and command execution, without changing stdout or exit codes.
27
+ - A real Hetzner benchmark of both sample applications, including timings, resource observations, billing estimates and verified cleanup.
28
+ - Committed provider lock files for Hetzner and Google Cloud with Terraform and OpenTofu checksums for Linux and macOS on amd64/arm64.
29
+ - A mocked Hetzner provider contract test, plus OpenTofu validation and contract tests in CI.
30
+ - Package metadata (authors, classifiers, keywords, documentation and changelog links) and upper bounds for runtime dependencies.
31
+ - Issue and pull request templates and a code of conduct.
32
+ - A one-line installer (`install.sh`) for macOS, Linux and WSL2 that installs uv if needed, installs offbox and starts `offbox setup`, and an installation guide with step-by-step platform and provider instructions.
33
+ - `offbox setup` downloads pinned, SHA-256-verified Mutagen 0.18.1 when no Mutagen 0.18.x is installed, and offers to create a dedicated `~/.ssh/offbox_ed25519` key when no key exists.
34
+ - `host init --host-key-fingerprint` (also on `setup`) verifies an existing server's key against a fingerprint obtained out of band.
35
+ - `host destroy --forget` removes the local record of an unreachable existing-SSH host.
36
+ - `exec.env` names are approved by `offbox up`; `exec` refuses names that changed since and refuses provider credential variables.
37
+ - Help text for every CLI option, and `exec --help` shows the `-- COMMAND` form.
38
+ - A git mirror pushes `HEAD`, the remote's default branch and `git.refs` into `/work/.git` so git-based tooling works in the environment, and `[files] copy` copies named home-directory files such as gcloud credentials into it; new copies and refs need approval by `offbox up`.
39
+ - Commands run by offbox see `OFFBOX_ENV` set to the environment name.
40
+ - Project settings can also come from `[project]` tables in the user `config.toml`, an uncommitted `offbox.local.toml` and `OFFBOX_<SECTION>_<KEY>` environment variables, merged per key with later sources winning.
41
+ - `offbox config [--json]` shows every effective project setting with its source and variable name.
42
+ - Auto-managed hosts: `auto = true` on a host preset creates the VM on the first `offbox up` that needs it and destroys it when its last environment is removed or after `idle` (default `2h`) without use, guarded by a shared usage lock so running commands never lose their host. `offbox host reap [--dry-run] [--json]` reaps idle hosts and abandoned creations, `--install-timer` schedules it every 15 minutes, and `env.host` selects a project's host by name.
43
+
44
+ ### Changed
45
+
46
+ - The git mirror is on by default and also mirrors the remote's default branch (`origin/HEAD`); set `git.mirror = false` to opt out. Environments without a recorded mirror approval accept the default mirror without a new `up`; others need one `offbox up`.
47
+ - Fix lines that named `offbox.toml` now point to `offbox config`, because a value can come from any settings source.
48
+ - The state file gains host lifecycle fields; after upgrading, older offbox versions can no longer read it.
49
+ - Host bootstrap waits up to 10 minutes for apt/dpkg locks, enables unattended upgrades last, and keeps installed containerd and Docker plugin versions when rerun so `host init` does not restart Docker.
50
+ - The universal image base is pinned by digest, upgrades Ubuntu packages during the build and is rebuilt weekly without layer cache.
51
+ - The README describes the problem offbox solves, measured results, comparisons and common questions; development details moved to CONTRIBUTING.md.
52
+ - `host destroy` always runs the cloud destroy, treating local Mutagen and SSH cleanup failures as warnings, and reinitializes the provider workspace first so a cleared cache cannot block it.
53
+ - `uninstall --yes` refuses while cloud hosts remain unless `--abandon-cloud-hosts` is given; existing-SSH host teardown also removes the `offbox` sudoers entry and authorized key.
54
+ - `up --fresh` requires confirmation or `--yes`, `doctor` fails when no host is configured, and `setup --action check` no longer edits SSH configuration.
55
+ - Warm `exec` runs one remote preflight instead of three probes and restores port forwards alongside the command; readiness polling is faster.
56
+ - `up` warns when CPU, memory, shared-memory or image settings differ from the running container.
57
+ - Automatic Compose forwards are capped at 32 per environment.
58
+ - State and cache directories are private (0700), and the previous state file is kept as `state.json.bak`.
59
+
60
+ ### Fixed
61
+
62
+ - Ctrl-C, SIGTERM and SIGHUP relay into remote process groups works again: `offbox-run` used a `kill -s NAME -- -PGID` form that the image's procps-ng rejects.
63
+ - A non-TTY `offbox exec` killed without a chance to relay (SIGKILL, lost network) no longer leaves its remote command running.
64
+ - Changing `install.command` reinstalls dependencies on the next `exec`, not only changes to the `install.when` files.
65
+
66
+ - Interrupting provisioning no longer kills OpenTofu mid-apply; Ctrl-C after a VM exists prints the `host destroy` command and exits 130.
67
+ - An unreadable state file reports the backup and the manual `tofu destroy` commands for each provider workspace.
68
+ - Generated SSH configuration disables agent and X11 forwarding and offers only the configured key, so user-wide `Host *` settings no longer apply to offbox hosts; `host init` quotes the known-hosts path.
69
+ - Every `--env` and `exec.env` value is redacted from logs and verbose output as `NAME=value`, regardless of the variable name; secret-named and long values are also redacted on their own.
70
+ - `exec` no longer waits for another worktree's `up`, concurrent `exec` calls in one worktree wait for a running installation instead of failing, and port-restore errors no longer prevent the command from running.
71
+ - Closing the terminal relays termination to the remote command instead of orphaning it.
72
+ - Concurrent invocations no longer fail while pruning old log files; `logs --follow` reads incrementally.
73
+ - `ports --swap` works when the port's current owner is stopped.
74
+ - The image freshness check recognises Docker's containerd image store digests.
75
+ - Fix lines on non-terminal stderr are no longer wrapped at 80 columns.
76
+ - `uninstall` stops a Mutagen daemon started from the downloaded copy before removing it.
77
+ - A failed host bootstrap writes `/var/lib/offbox/failed`, and `host create` reports it immediately with the end of the cloud-init log instead of waiting for the 15-minute readiness timeout.
78
+ - Host bootstrap and the image verify the Docker apt signing key fingerprint before trusting it.
79
+ - Host bootstrap reloads SSH with `try-reload-or-restart`, which works with Ubuntu 24.04 socket activation, and no longer locks the `offbox` account, which sshd rejects when `UsePAM` is off.
80
+ - Commands run through `offbox exec` use umask 022 instead of inheriting 077, so build outputs are no longer owner-only.
81
+ - The inner Docker daemon log is capped at 10 MiB with one rotated file.
82
+ - Wheels and host provider workspaces no longer include local `.terraform/` directories, Terraform state, editor swap files or provider tests.
83
+ - Existing-host teardown validates resource ownership, preserves adopted networks and refuses foreign network members before deletion; environment cleanup handles root-owned source directories.
84
+ - Environment shutdown forwards signals to dockerd and waits within the outer stop deadline.
85
+ - Routine command and forwarding lock contention uses bounded waits; unconfirmed SSH completion includes per-run recovery guidance.
86
+ - Public contribution workflows use restricted credentials and publication jobs; release tags remain blocked while publishing is deferred.
87
+ - Batched port discovery streams large responses instead of passing them as process arguments; empty install markers report the correct recovery action.
88
+ - Cloud host creation refreshes early SSH connections and verifies Docker access before reporting readiness, so bootstrap's Docker-group changes take effect.
89
+ - `up` no longer holds the host lock while waiting for another installation, a busy host lock no longer prints a port-restore warning during `exec`, and an interrupted `exec` waits at most one second for port restore.
90
+ - `up` no longer reports a settings change for containers created before settings were recorded; `host create` and `host init` default to `~/.ssh/offbox_ed25519` when `~/.ssh/id_ed25519` is missing, matching `setup`.
91
+ - The installer prints the PATH line to add when it cannot update the shell profile, finds uv in `UV_INSTALL_DIR` or `XDG_BIN_HOME`, and reports an unfinished `offbox setup` without failing.
92
+ - Execution combines dependency hash/marker reads and owned-container/Compose port discovery into fresh probes, removing two sequential SSH round trips without skipping checks.
93
+
94
+ ## [0.0.1] - 2026-10-23
95
+
96
+ Initial source skeleton; not published to PyPI.
97
+
98
+ ### Added
99
+
100
+ - Typed Python CLI skeleton with `offbox --version`, `offbox version` and `python -m offbox`.
101
+ - Locked uv dependencies, formatting, linting, strict type checks and unit tests.
102
+ - Linux/macOS CI and trusted-publisher release workflow.
103
+ - Contributor instructions and packaging configuration for future host, image and provider resources.
104
+
105
+ [Unreleased]: https://github.com/o-avdieiev/offbox/compare/v0.1.0...master
106
+ [0.1.0]: https://github.com/o-avdieiev/offbox/releases/tag/v0.1.0
107
+ [0.0.1]: https://github.com/o-avdieiev/offbox/tree/37ba5be5c132161441ca045def3edb5da26e9065
@@ -0,0 +1,9 @@
1
+ # Code of conduct
2
+
3
+ This project follows the [Contributor Covenant, version 2.1](https://www.contributor-covenant.org/version/2/1/code_of_conduct/). Everyone taking part in issues, pull requests and discussions is expected to uphold it.
4
+
5
+ ## Reporting
6
+
7
+ Report unacceptable behavior to the maintainer, [@o-avdieiev](https://github.com/o-avdieiev), through a private channel. For a report that should not be public, use [GitHub's private reporting form](https://github.com/o-avdieiev/offbox/security/advisories/new) and say that it concerns conduct. All reports are reviewed and kept confidential.
8
+
9
+ The maintainer may remove, edit or reject comments, commits, code, issues and other contributions that do not follow this code of conduct, and may temporarily or permanently restrict participation, following the enforcement guidelines of the Contributor Covenant.
@@ -0,0 +1,101 @@
1
+ # Contributing
2
+
3
+ Open a pull request from a fork for changes; no cloud credentials are needed. Fork CI requires maintainer approval before it runs. See [repository safeguards](docs/repository-safety.md) and [private security reporting](SECURITY.md).
4
+
5
+ ## Development
6
+
7
+ Install [uv](https://docs.astral.sh/uv/getting-started/installation/) and Python 3.12 or newer, then run:
8
+
9
+ ```sh
10
+ uv sync --frozen
11
+ make check
12
+ make test
13
+ ```
14
+
15
+ `uv.lock` is committed. Change dependencies with uv and include the updated lockfile.
16
+
17
+ | Command | Purpose |
18
+ | --- | --- |
19
+ | `make fmt` | Format Python and apply Ruff lint fixes |
20
+ | `make check` | Check formatting, lint and strict mypy/Pyright types |
21
+ | `make test` | Deterministic unit tests; excludes the subprocess marker |
22
+ | `uv build` | Build the source distribution and wheel |
23
+
24
+ Unit CI covers Ubuntu and macOS with Python 3.12 and 3.13. Validation also runs lint, strict type checks, distribution builds, ShellCheck, provider schema validation with mocked Terraform and OpenTofu tests, image builds and one focused native Linux Docker smoke job. Do not add real-cloud tests or require real cloud credentials for tests. Cloud API provisioning and VM bootstrap are not exercised by CI; browser, OOM and performance tests are outside its scope.
25
+
26
+ Provider checks run without cloud credentials:
27
+
28
+ ```sh
29
+ terraform fmt -check -recursive providers
30
+ terraform -chdir=providers/hetzner init -backend=false
31
+ terraform -chdir=providers/hetzner validate
32
+ terraform -chdir=providers/hetzner test
33
+ terraform -chdir=providers/gcp init -backend=false
34
+ terraform -chdir=providers/gcp validate
35
+ terraform -chdir=providers/gcp test
36
+ ```
37
+
38
+ Each provider commits a `.terraform.lock.hcl` covering Linux and macOS on amd64/arm64. The file holds entries for both `registry.terraform.io` and `registry.opentofu.org`; `init` drops the other tool's entry, so restore the file before committing. After changing a provider version constraint, refresh both entries with `terraform providers lock` and `tofu providers lock` for `linux_amd64`, `linux_arm64`, `darwin_amd64` and `darwin_arm64`, then combine them. CI checks providers with both Terraform and OpenTofu.
39
+
40
+ Separately approved [Hetzner](docs/benchmarks/2026-10-23-hetzner.md) and [Google Cloud](docs/benchmarks/2026-10-23-gcp.md) benchmarks exercised provisioning and both sample apps, including browser tests, then verified cloud cleanup. Measurements and comparison limits are recorded in the reports.
41
+
42
+ The Docker smoke job builds and loads the universal image from the current checkout. It uses disposable SSH keys and containers to exercise real SSH, Mutagen, stream/status/signal handling, forwarding and two isolated Compose stacks. It does not create cloud resources or establish VM bootstrap or browser behavior. Its cleanup uses fixture ownership labels and markers; failure logs are retained as a short-lived Actions artifact. The fixture is intended for a disposable native amd64 Linux runner with a Docker daemon and `/srv/offbox/envs` available. Its commands are in [smoke.yaml](.github/workflows/smoke.yaml); do not run it on an existing Offbox host. Unit tests remain independent of Docker and network access.
43
+
44
+ Runtime tool checks target OpenSSH >=8.0, Git >=2.30 and Mutagen 0.18.x. Provisioning uses OpenTofu >=1.8 or Terraform >=1.6, with a checksum-verified OpenTofu 1.10.6 fallback for macOS/Linux on amd64/arm64. Unit tests inject tool results and downloads; they do not require these tools or network access. See [the agent guide](docs/agents.md) for diagnostics and exit codes.
45
+
46
+ Local pre-commit hooks use the locked Ruff installation:
47
+
48
+ ```sh
49
+ uvx pre-commit install
50
+ uvx pre-commit run --all-files
51
+ ```
52
+
53
+ ## Pull requests
54
+
55
+ Read [AGENTS.md](AGENTS.md) for code rules. Use conventional commits (`feat:`, `fix:`, `docs:`, `test:`, `chore:`) and keep each PR focused on one change, targeting `master`. Describe what changed and how you verified it, including the commands you ran and relevant output. Run `make check` and `make test` before pushing. Never commit secrets. Tests never need real credentials or billable cloud resources.
56
+
57
+ The repository keeps host scripts, image files and provider definitions at the root. Hatch maps them into wheels under `offbox/_data/host`, `offbox/_data/images` and `offbox/_data/providers`, excluding local `.terraform/` directories, state files, editor swap files and provider tests; runtime code must use `importlib.resources` to locate them. The universal image is built separately from the Python wheel.
58
+
59
+ ## Future one-time PyPI setup
60
+
61
+ The package is not yet published to PyPI, and `v*` release tags are blocked until the maintainer enables publishing. Source installs, wheel builds and master-branch GHCR publication are available. The following setup applies to the first release.
62
+
63
+ The maintainer must configure a [pending trusted publisher](https://docs.pypi.org/trusted-publishers/creating-a-project-through-oidc/) before the first release. A pending publisher does not reserve the project name; the first successful upload creates it.
64
+
65
+ 1. Sign in to the maintainer's PyPI account with two-factor authentication enabled.
66
+ 2. Open [PyPI publishing settings](https://pypi.org/manage/account/publishing/) and add a pending publisher with these exact values:
67
+
68
+ | Field | Value |
69
+ | --- | --- |
70
+ | PyPI project name | `offbox` |
71
+ | GitHub owner | `o-avdieiev` |
72
+ | Repository | `offbox` |
73
+ | Workflow filename | `release.yaml` |
74
+ | Environment name | `pypi` |
75
+
76
+ 3. The `pypi` environment is restricted to `v*` tags. Review its approval policy and explicitly update the release-tag ruleset that currently blocks those tags before the first release.
77
+ 4. Ensure GitHub Actions is enabled. Only the artifact-consuming publish job requests `id-token: write` for OIDC and `contents: write` for the GitHub release; build/test jobs use read-only permissions. No PyPI API token or password is needed.
78
+
79
+ For later releases, manage the publisher under the existing PyPI project's Publishing settings. See [PyPI's trusted-publisher documentation](https://docs.pypi.org/trusted-publishers/adding-a-publisher/).
80
+
81
+ ## Release
82
+
83
+ 1. Set `__version__` in `src/offbox/__init__.py` and add the matching dated section in `CHANGELOG.md`.
84
+ 2. Run `uv sync --frozen`, `make check`, `make test` and `uv build`. Install the wheel in an isolated environment and check both version forms.
85
+ 3. Merge the release PR after CI succeeds. For the first release, confirm that the PyPI setup above is complete.
86
+ 4. Once publishing is enabled, create and push a tag matching the package version. This starts `.github/workflows/release.yaml`.
87
+ 5. The workflow checks the tag against the package version, extracts that version's changelog section, builds and smoke-tests the wheel, then runs `uv publish --trusted-publishing always`. It creates the GitHub release using the same changelog section and attaches the distributions.
88
+ 6. Verify `uvx --refresh offbox --version` prints the released version and inspect the release on PyPI and GitHub.
89
+
90
+ Release publication requires the maintainer's PyPI account setup; building and testing locally does not publish anything. See the GHCR setup below before the first universal-image publication.
91
+
92
+
93
+ ## Universal image and one-time GHCR setup
94
+
95
+ The image workflow builds `linux/amd64` from `images/universal/Dockerfile`. Pull requests build without pushing. Changes to the image, its workflow or the package image constant on `master` publish the compatibility tag from `DEFAULT_IMAGE` and `sha-<short commit>`. Release tags also publish the corresponding semantic version. The workflow reads the repository name and compatibility tag from the package constant, so an image default changes in one place.
96
+
97
+ After the first successful publication, open the repository's linked `offbox-universal` package on GitHub, choose **Package settings → Change visibility → Public**, and confirm the change. This is a one-time maintainer action; hosts need anonymous pull access. Ensure the package is linked to this repository and its Actions access allows this repository to write. The workflow uses only `GITHUB_TOKEN` with `packages: write`; no cloud credential or registry password is needed. See [GitHub's package visibility instructions](https://docs.github.com/en/packages/learn-github-packages/configuring-a-packages-access-control-and-visibility).
98
+
99
+ Image compatibility series `1` is distinct from the CLI release number. A future CLI `v0.1.0` release publishes image aliases `:0.1.0` and `:1.0.0` in addition to the compatibility and commit tags. A weekly scheduled run on `master` rebuilds and republishes the compatibility and commit tags so the image picks up Ubuntu security updates.
100
+
101
+ Each successful build writes the actual compressed OCI image size to its Actions summary and an `image-size` artifact. Include the measured result in PRs that change the image; the target is below 3 GB. The report sums the compressed layer and configuration descriptors for the amd64 image and excludes attestations. Build/static checks do not prove nested Docker, browser or signal behavior at runtime. See [the image build guide](docs/universal-image.md) for contents and process contracts.
offbox-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Oleksii Avdieiev
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.
offbox-0.1.0/Makefile ADDED
@@ -0,0 +1,14 @@
1
+ .PHONY: fmt check test
2
+
3
+ fmt:
4
+ uv run --frozen ruff format
5
+ uv run --frozen ruff check --fix
6
+
7
+ check:
8
+ uv run --frozen ruff format --check
9
+ uv run --frozen ruff check
10
+ uv run --frozen mypy
11
+ uv run --frozen pyright
12
+
13
+ test:
14
+ uv run --frozen pytest -m "not subprocess"