arkhai-vms-storefront 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.
- arkhai_vms_storefront-0.1.0/.gitignore +223 -0
- arkhai_vms_storefront-0.1.0/Dockerfile +157 -0
- arkhai_vms_storefront-0.1.0/Dockerfile.dockerignore +38 -0
- arkhai_vms_storefront-0.1.0/Makefile +90 -0
- arkhai_vms_storefront-0.1.0/PKG-INFO +40 -0
- arkhai_vms_storefront-0.1.0/entrypoint.sh +34 -0
- arkhai_vms_storefront-0.1.0/pyproject.toml +159 -0
- arkhai_vms_storefront-0.1.0/scripts/download_models.sh +67 -0
- arkhai_vms_storefront-0.1.0/scripts/import_resources_csv.py +92 -0
- arkhai_vms_storefront-0.1.0/scripts/patch_puffer_eval.py +77 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/__init__.py +25 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/cli.py +117 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/cli_common.py +90 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/cli_logs.py +313 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/cli_portfolio.py +58 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/cli_publish.py +1266 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/container.py +46 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/controllers/__init__.py +0 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/controllers/admin_controller.py +718 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/controllers/deals_controller.py +124 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/controllers/listings_controller.py +280 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/controllers/negotiate_controller.py +130 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/controllers/negotiations_controller.py +111 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/controllers/settle_controller.py +240 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/controllers/system_controller.py +94 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/data/alkahest_anvil_addresses.json +80 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/data/hosts.sample.csv +3 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/data/kvm1-host.csv +2 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/data/kvm1-machine.csv +2 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/data/resources.sample.csv +6 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/groups/__init__.py +0 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/groups/config.py +274 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/groups/escrow.py +385 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/groups/network.py +51 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/middleware/__init__.py +0 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/middleware/admin_auth.py +43 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/middleware/buyer_auth.py +109 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/middleware/seller_auth.py +108 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/negotiation_watchdog.py +138 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/server.py +142 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/services/__init__.py +0 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/services/admin_settle_service.py +154 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/services/alkahest_service.py +65 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/services/capacity_client.py +334 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/services/claims_runtime.py +224 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/services/fulfillment_service.py +198 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/services/listing_service.py +574 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/services/publication_service.py +190 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/services/system_service.py +296 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/settings.toml +177 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/startup.py +225 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/utils/__init__.py +1 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/utils/config.py +213 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/utils/escrow_verification.py +14 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/utils/failure_policy.py +387 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/utils/logging_config.py +95 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/utils/migrations.py +387 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/utils/multi_registry_client.py +8 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/utils/refund.py +8 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/utils/settlement_jobs.py +352 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/utils/sqlite_client.py +1160 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/utils/sync_negotiation.py +740 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/utils/test_env.py +27 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/utils/token_transfer.py +8 -0
- arkhai_vms_storefront-0.1.0/src/market_storefront/utils/zerotier.py +253 -0
- arkhai_vms_storefront-0.1.0/storefront.alice.toml +59 -0
- arkhai_vms_storefront-0.1.0/storefront.bob.toml +79 -0
- arkhai_vms_storefront-0.1.0/tests/__init__.py +0 -0
- arkhai_vms_storefront-0.1.0/tests/_settings_overrides.py +42 -0
- arkhai_vms_storefront-0.1.0/tests/fake_site.py +287 -0
- arkhai_vms_storefront-0.1.0/tests/integration/__init__.py +0 -0
- arkhai_vms_storefront-0.1.0/tests/integration/conftest.py +14 -0
- arkhai_vms_storefront-0.1.0/tests/integration/test_abandon_truncation.py +93 -0
- arkhai_vms_storefront-0.1.0/tests/integration/test_admin_api.py +683 -0
- arkhai_vms_storefront-0.1.0/tests/integration/test_deals_controller.py +174 -0
- arkhai_vms_storefront-0.1.0/tests/integration/test_listings_api.py +666 -0
- arkhai_vms_storefront-0.1.0/tests/integration/test_negotiate_controller.py +501 -0
- arkhai_vms_storefront-0.1.0/tests/integration/test_negotiations_api.py +413 -0
- arkhai_vms_storefront-0.1.0/tests/integration/test_registry_client_contract.py +319 -0
- arkhai_vms_storefront-0.1.0/tests/integration/test_settle_controller.py +282 -0
- arkhai_vms_storefront-0.1.0/tests/integration/test_settlement_claims.py +106 -0
- arkhai_vms_storefront-0.1.0/tests/integration/test_storefront_client.py +122 -0
- arkhai_vms_storefront-0.1.0/tests/unit/__init__.py +0 -0
- arkhai_vms_storefront-0.1.0/tests/unit/services/__init__.py +0 -0
- arkhai_vms_storefront-0.1.0/tests/unit/services/test_admin_settle_service.py +252 -0
- arkhai_vms_storefront-0.1.0/tests/unit/services/test_negotiation_service.py +270 -0
- arkhai_vms_storefront-0.1.0/tests/unit/services/test_system_service.py +160 -0
- arkhai_vms_storefront-0.1.0/tests/unit/test_accepted_escrows_csv_dsl.py +225 -0
- arkhai_vms_storefront-0.1.0/tests/unit/test_accepted_escrows_synthesis.py +272 -0
- arkhai_vms_storefront-0.1.0/tests/unit/test_admin_auth.py +137 -0
- arkhai_vms_storefront-0.1.0/tests/unit/test_alkahest.py +137 -0
- arkhai_vms_storefront-0.1.0/tests/unit/test_alkahest_config.py +86 -0
- arkhai_vms_storefront-0.1.0/tests/unit/test_architecture_imports.py +114 -0
- arkhai_vms_storefront-0.1.0/tests/unit/test_bundled_inventory.py +48 -0
- arkhai_vms_storefront-0.1.0/tests/unit/test_claims_hooks.py +118 -0
- arkhai_vms_storefront-0.1.0/tests/unit/test_cli_publish_helpers.py +871 -0
- arkhai_vms_storefront-0.1.0/tests/unit/test_cli_serve.py +32 -0
- arkhai_vms_storefront-0.1.0/tests/unit/test_compute_allocations.py +347 -0
- arkhai_vms_storefront-0.1.0/tests/unit/test_config_loader.py +291 -0
- arkhai_vms_storefront-0.1.0/tests/unit/test_dummy.py +23 -0
- arkhai_vms_storefront-0.1.0/tests/unit/test_escrow_fields_policy.py +415 -0
- arkhai_vms_storefront-0.1.0/tests/unit/test_escrow_verification.py +932 -0
- arkhai_vms_storefront-0.1.0/tests/unit/test_extract_initial_price.py +99 -0
- arkhai_vms_storefront-0.1.0/tests/unit/test_failure_policy.py +165 -0
- arkhai_vms_storefront-0.1.0/tests/unit/test_file_policy_discovery.py +172 -0
- arkhai_vms_storefront-0.1.0/tests/unit/test_fulfillment_service.py +227 -0
- arkhai_vms_storefront-0.1.0/tests/unit/test_heartbeat_gated_listings.py +129 -0
- arkhai_vms_storefront-0.1.0/tests/unit/test_hosts.py +553 -0
- arkhai_vms_storefront-0.1.0/tests/unit/test_identity_dispatch.py +222 -0
- arkhai_vms_storefront-0.1.0/tests/unit/test_listing_token_extraction.py +76 -0
- arkhai_vms_storefront-0.1.0/tests/unit/test_multi_registry_client.py +468 -0
- arkhai_vms_storefront-0.1.0/tests/unit/test_negotiation_thread.py +564 -0
- arkhai_vms_storefront-0.1.0/tests/unit/test_negotiation_watchdog.py +140 -0
- arkhai_vms_storefront-0.1.0/tests/unit/test_order_pause_state.py +267 -0
- arkhai_vms_storefront-0.1.0/tests/unit/test_publications.py +186 -0
- arkhai_vms_storefront-0.1.0/tests/unit/test_publications_wiring.py +186 -0
- arkhai_vms_storefront-0.1.0/tests/unit/test_publish_round_with_templates.py +441 -0
- arkhai_vms_storefront-0.1.0/tests/unit/test_recipient_arbiter_demand.py +53 -0
- arkhai_vms_storefront-0.1.0/tests/unit/test_refund.py +239 -0
- arkhai_vms_storefront-0.1.0/tests/unit/test_remote_capacity_client.py +265 -0
- arkhai_vms_storefront-0.1.0/tests/unit/test_resource_csv_importer.py +235 -0
- arkhai_vms_storefront-0.1.0/tests/unit/test_resources.py +224 -0
- arkhai_vms_storefront-0.1.0/tests/unit/test_rl_middleware.py +373 -0
- arkhai_vms_storefront-0.1.0/tests/unit/test_settlement_jobs.py +527 -0
- arkhai_vms_storefront-0.1.0/tests/unit/test_sync_negotiation_escrow_normalization.py +197 -0
- arkhai_vms_storefront-0.1.0/tests/unit/test_sync_negotiation_seller_round_hook.py +164 -0
- arkhai_vms_storefront-0.1.0/tests/unit/test_token_integration.py +15 -0
- arkhai_vms_storefront-0.1.0/tests/unit/test_token_transfer.py +124 -0
- arkhai_vms_storefront-0.1.0/tests/unit/test_two_phase_reserve.py +223 -0
- arkhai_vms_storefront-0.1.0/tests/unit/test_vm_negotiation_strategy.py +430 -0
- arkhai_vms_storefront-0.1.0/tests/unit/test_vm_provision_terms.py +80 -0
- arkhai_vms_storefront-0.1.0/uv.lock +3396 -0
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
.vscode/
|
|
2
|
+
|
|
3
|
+
# Project-local scratch files, private notes, and generated diagnostics.
|
|
4
|
+
.scm-local/
|
|
5
|
+
|
|
6
|
+
# Visible transfer staging for snap-confined tools such as Multipass.
|
|
7
|
+
scm-clean-room-transfer/
|
|
8
|
+
|
|
9
|
+
# Legacy local rehearsal params (private keys, RPC URLs, etc.).
|
|
10
|
+
.rehearsal-params.local.md
|
|
11
|
+
.rehearsal-params.local.*
|
|
12
|
+
|
|
13
|
+
### Python ###
|
|
14
|
+
# Byte-compiled / optimized / DLL files
|
|
15
|
+
__pycache__/
|
|
16
|
+
*.py[cod]
|
|
17
|
+
*$py.class
|
|
18
|
+
|
|
19
|
+
# C extensions
|
|
20
|
+
*.so
|
|
21
|
+
|
|
22
|
+
# Distribution / packaging
|
|
23
|
+
.Python
|
|
24
|
+
build/
|
|
25
|
+
develop-eggs/
|
|
26
|
+
dist/
|
|
27
|
+
downloads/
|
|
28
|
+
eggs/
|
|
29
|
+
.eggs/
|
|
30
|
+
lib/
|
|
31
|
+
lib64/
|
|
32
|
+
parts/
|
|
33
|
+
sdist/
|
|
34
|
+
var/
|
|
35
|
+
wheels/
|
|
36
|
+
share/python-wheels/
|
|
37
|
+
*.egg-info/
|
|
38
|
+
.installed.cfg
|
|
39
|
+
*.egg
|
|
40
|
+
MANIFEST
|
|
41
|
+
|
|
42
|
+
# PyInstaller
|
|
43
|
+
# Usually these files are written by a python script from a template
|
|
44
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
45
|
+
*.manifest
|
|
46
|
+
*.spec
|
|
47
|
+
|
|
48
|
+
# Installer logs
|
|
49
|
+
pip-log.txt
|
|
50
|
+
pip-delete-this-directory.txt
|
|
51
|
+
|
|
52
|
+
# Unit test / coverage reports
|
|
53
|
+
htmlcov/
|
|
54
|
+
.tox/
|
|
55
|
+
.nox/
|
|
56
|
+
.coverage
|
|
57
|
+
.coverage.*
|
|
58
|
+
.cache
|
|
59
|
+
nosetests.xml
|
|
60
|
+
coverage.xml
|
|
61
|
+
*.cover
|
|
62
|
+
*.py,cover
|
|
63
|
+
.hypothesis/
|
|
64
|
+
.pytest_cache/
|
|
65
|
+
cover/
|
|
66
|
+
|
|
67
|
+
# Translations
|
|
68
|
+
*.mo
|
|
69
|
+
*.pot
|
|
70
|
+
|
|
71
|
+
# Django stuff:
|
|
72
|
+
*.log
|
|
73
|
+
*.log.[0-9]*
|
|
74
|
+
local_settings.py
|
|
75
|
+
db.sqlite3
|
|
76
|
+
db.sqlite3-journal
|
|
77
|
+
|
|
78
|
+
# Flask stuff:
|
|
79
|
+
instance/
|
|
80
|
+
.webassets-cache
|
|
81
|
+
|
|
82
|
+
# Scrapy stuff:
|
|
83
|
+
.scrapy
|
|
84
|
+
|
|
85
|
+
# Sphinx documentation
|
|
86
|
+
docs/_build/
|
|
87
|
+
|
|
88
|
+
# PyBuilder
|
|
89
|
+
.pybuilder/
|
|
90
|
+
target/
|
|
91
|
+
|
|
92
|
+
# Jupyter Notebook
|
|
93
|
+
.ipynb_checkpoints
|
|
94
|
+
|
|
95
|
+
# IPython
|
|
96
|
+
profile_default/
|
|
97
|
+
ipython_config.py
|
|
98
|
+
|
|
99
|
+
# pyenv
|
|
100
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
101
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
102
|
+
# .python-version
|
|
103
|
+
|
|
104
|
+
# pipenv
|
|
105
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
106
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
107
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
108
|
+
# install all needed dependencies.
|
|
109
|
+
#Pipfile.lock
|
|
110
|
+
|
|
111
|
+
# poetry
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
113
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
114
|
+
# commonly ignored for libraries.
|
|
115
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
116
|
+
#poetry.lock
|
|
117
|
+
|
|
118
|
+
# pdm
|
|
119
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
120
|
+
#pdm.lock
|
|
121
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
122
|
+
# in version control.
|
|
123
|
+
# https://pdm.fming.dev/#use-with-ide
|
|
124
|
+
.pdm.toml
|
|
125
|
+
|
|
126
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
127
|
+
__pypackages__/
|
|
128
|
+
|
|
129
|
+
# Celery stuff
|
|
130
|
+
celerybeat-schedule
|
|
131
|
+
celerybeat.pid
|
|
132
|
+
|
|
133
|
+
# SageMath parsed files
|
|
134
|
+
*.sage.py
|
|
135
|
+
|
|
136
|
+
# Environments
|
|
137
|
+
.env
|
|
138
|
+
.env.*
|
|
139
|
+
.venv
|
|
140
|
+
env/
|
|
141
|
+
venv/
|
|
142
|
+
ENV/
|
|
143
|
+
env.bak/
|
|
144
|
+
venv.bak/
|
|
145
|
+
|
|
146
|
+
# Spyder project settings
|
|
147
|
+
.spyderproject
|
|
148
|
+
.spyproject
|
|
149
|
+
|
|
150
|
+
# Rope project settings
|
|
151
|
+
.ropeproject
|
|
152
|
+
|
|
153
|
+
# mkdocs documentation
|
|
154
|
+
/site
|
|
155
|
+
|
|
156
|
+
# mypy
|
|
157
|
+
.mypy_cache/
|
|
158
|
+
.dmypy.json
|
|
159
|
+
dmypy.json
|
|
160
|
+
|
|
161
|
+
# Pyre type checker
|
|
162
|
+
.pyre/
|
|
163
|
+
|
|
164
|
+
# pytype static type analyzer
|
|
165
|
+
.pytype/
|
|
166
|
+
|
|
167
|
+
# Cython debug symbols
|
|
168
|
+
cython_debug/
|
|
169
|
+
|
|
170
|
+
# PyCharm
|
|
171
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
172
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
173
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
174
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
175
|
+
#.idea/
|
|
176
|
+
|
|
177
|
+
### Python Patch ###
|
|
178
|
+
# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
|
|
179
|
+
poetry.toml
|
|
180
|
+
|
|
181
|
+
# ruff
|
|
182
|
+
.ruff_cache/
|
|
183
|
+
|
|
184
|
+
# LSP config files
|
|
185
|
+
pyrightconfig.json
|
|
186
|
+
|
|
187
|
+
# Infra
|
|
188
|
+
infra/*/*.tfvars
|
|
189
|
+
infra/*/*.tfstate
|
|
190
|
+
infra/*/*.tfstate.backup
|
|
191
|
+
infra/*/.terraform*
|
|
192
|
+
infra/*/*.plan
|
|
193
|
+
*.db
|
|
194
|
+
# PufferRL Experiments
|
|
195
|
+
experiments/
|
|
196
|
+
wandb/
|
|
197
|
+
!.env.sample
|
|
198
|
+
!.env.docker-compose
|
|
199
|
+
!.env.*.docker-compose
|
|
200
|
+
!.env.*.docker-compose
|
|
201
|
+
!.env.docker-compose
|
|
202
|
+
.cursor/
|
|
203
|
+
|
|
204
|
+
# Cloud Function
|
|
205
|
+
node_modules
|
|
206
|
+
|
|
207
|
+
# Puffer artifacts — ignore any resources/ dir or symlink at any depth
|
|
208
|
+
**/resources
|
|
209
|
+
pr-message-puffer.md
|
|
210
|
+
dev-env/state/state.json
|
|
211
|
+
shared-env/*
|
|
212
|
+
helm/Chart.lock
|
|
213
|
+
helm/charts/*.tgz
|
|
214
|
+
helm/.port-forward.pids
|
|
215
|
+
provisioning-service/settings.local.toml
|
|
216
|
+
provisioning-service/src/config/config-local.yml
|
|
217
|
+
.snapshot/*
|
|
218
|
+
|
|
219
|
+
# Per-env deployment scratch dirs (carry keys + per-env configs)
|
|
220
|
+
deploy-base-sepolia/
|
|
221
|
+
|
|
222
|
+
# Claude Code per-project state
|
|
223
|
+
.claude/
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# --platform=linux/amd64 is intentional: production targets Linux x86_64.
|
|
2
|
+
# Keep this pin in all FROM lines.
|
|
3
|
+
|
|
4
|
+
# Stage 1: Install Python dependencies using uv
|
|
5
|
+
FROM --platform=linux/amd64 ghcr.io/astral-sh/uv:python3.12-bookworm-slim AS builder
|
|
6
|
+
|
|
7
|
+
# No UV_COMPILE_BYTECODE here: this image builds under x86 emulation
|
|
8
|
+
# and uv's post-install bytecode-compile python workers deadlock under
|
|
9
|
+
# Rosetta sporadically — a wedged build, not a slow one. Cold starts
|
|
10
|
+
# pay a small first-import cost instead.
|
|
11
|
+
ENV UV_LINK_MODE=copy
|
|
12
|
+
ENV UV_HTTP_TIMEOUT=120
|
|
13
|
+
# PyPI intermittently serves 5xx even for index lookups that should
|
|
14
|
+
# 404 (internal package names resolved from /dist); back off through
|
|
15
|
+
# the flap instead of failing the build after the default 3 tries.
|
|
16
|
+
ENV UV_HTTP_RETRIES=10
|
|
17
|
+
|
|
18
|
+
RUN apt-get update && apt-get install -y --no-install-recommends git g++ && rm -rf /var/lib/apt/lists/*
|
|
19
|
+
|
|
20
|
+
WORKDIR /app
|
|
21
|
+
|
|
22
|
+
# Copy the pre-built wheels from the monorepo .dist/ directory.
|
|
23
|
+
# These are built on the host by `make dist` before `docker build`.
|
|
24
|
+
COPY .dist/ /.dist/
|
|
25
|
+
|
|
26
|
+
COPY domains/vms/storefront/pyproject.toml domains/vms/storefront/uv.lock domains/vms/storefront/entrypoint.sh ./
|
|
27
|
+
# The lock records the internal-wheel find-links dir relative to the repo
|
|
28
|
+
# (../../../.dist), which cannot normalize from /app. Point it at the
|
|
29
|
+
# in-image wheel dir instead. (uv re-canonicalizes the path on every
|
|
30
|
+
# relock, so this is normalized here rather than in the committed lock.)
|
|
31
|
+
RUN sed -E -i 's|registry = "[^"]*\.dist"|registry = "/.dist"|' uv.lock
|
|
32
|
+
|
|
33
|
+
# Pass the GCP service account JSON key from GitHub Actions secrets to authenticate
|
|
34
|
+
# against GCP Artifact Registry for the alkahest-py private Python package.
|
|
35
|
+
ARG GAR_STG_READER_KEY=""
|
|
36
|
+
ARG INSTALL_RL_DEPS=false
|
|
37
|
+
|
|
38
|
+
RUN --mount=type=cache,target=/root/.cache/uv \
|
|
39
|
+
if [ -n "${GAR_STG_READER_KEY}" ]; then \
|
|
40
|
+
export UV_INDEX_ALKAHEST_GAR_USERNAME="_json_key" && \
|
|
41
|
+
export UV_INDEX_ALKAHEST_GAR_PASSWORD="$(echo "${GAR_STG_READER_KEY}" | tr -d '\n' | python3 -c 'import sys,json; print(json.dumps(json.loads(sys.stdin.read())))' 2>/dev/null || echo "${GAR_STG_READER_KEY}")"; \
|
|
42
|
+
fi && \
|
|
43
|
+
if [ "${INSTALL_RL_DEPS}" = "true" ]; then \
|
|
44
|
+
uv sync --no-sources --no-dev --no-install-project --extra rl --find-links /.dist \
|
|
45
|
+
--refresh-package arkhai-core \
|
|
46
|
+
--refresh-package arkhai-core-storefront \
|
|
47
|
+
--refresh-package arkhai-core-registry-client \
|
|
48
|
+
--refresh-package arkhai-core-storefront-client \
|
|
49
|
+
--refresh-package arkhai-kit-policy \
|
|
50
|
+
--refresh-package arkhai-kit-alkahest \
|
|
51
|
+
--refresh-package arkhai-kit-identity \
|
|
52
|
+
--refresh-package arkhai-kit-config \
|
|
53
|
+
--refresh-package arkhai-vms-storefront \
|
|
54
|
+
--refresh-package arkhai-vms-provisioning; \
|
|
55
|
+
else \
|
|
56
|
+
uv sync --no-sources --no-dev --no-install-project --find-links /.dist \
|
|
57
|
+
--refresh-package arkhai-core \
|
|
58
|
+
--refresh-package arkhai-core-storefront \
|
|
59
|
+
--refresh-package arkhai-core-registry-client \
|
|
60
|
+
--refresh-package arkhai-core-storefront-client \
|
|
61
|
+
--refresh-package arkhai-kit-policy \
|
|
62
|
+
--refresh-package arkhai-kit-alkahest \
|
|
63
|
+
--refresh-package arkhai-kit-identity \
|
|
64
|
+
--refresh-package arkhai-kit-config \
|
|
65
|
+
--refresh-package arkhai-vms-storefront \
|
|
66
|
+
--refresh-package arkhai-vms-provisioning; \
|
|
67
|
+
fi
|
|
68
|
+
|
|
69
|
+
# Stage 2: Lean runtime image
|
|
70
|
+
FROM --platform=linux/amd64 ghcr.io/astral-sh/uv:python3.12-bookworm-slim AS runtime
|
|
71
|
+
|
|
72
|
+
# ENV does not cross FROM — this stage runs uv sync too (see the builder
|
|
73
|
+
# stage for why the retries are raised).
|
|
74
|
+
ENV UV_HTTP_RETRIES=10
|
|
75
|
+
|
|
76
|
+
USER root
|
|
77
|
+
|
|
78
|
+
RUN apt-get update && \
|
|
79
|
+
apt-get install -y --no-install-recommends curl gnupg iproute2 kmod sudo git && \
|
|
80
|
+
curl -s https://install.zerotier.com | bash && \
|
|
81
|
+
rm -rf /var/lib/apt/lists/* && \
|
|
82
|
+
mkdir -p /var/lib/zerotier-one && \
|
|
83
|
+
printf '{\n "settings": {\n "allowManagementFrom": [ "127.0.0.1", "::1" ]\n }\n}\n' \
|
|
84
|
+
> /var/lib/zerotier-one/local.conf && \
|
|
85
|
+
rm -f /var/lib/zerotier-one/identity.public /var/lib/zerotier-one/identity.secret && \
|
|
86
|
+
useradd -m -s /bin/sh appuser && \
|
|
87
|
+
echo 'appuser ALL=(root) NOPASSWD: /usr/sbin/zerotier-one, /usr/sbin/zerotier-cli' \
|
|
88
|
+
> /etc/sudoers.d/appuser && \
|
|
89
|
+
chmod 0440 /etc/sudoers.d/appuser && \
|
|
90
|
+
mkdir -p /app && \
|
|
91
|
+
chown appuser /app
|
|
92
|
+
|
|
93
|
+
USER appuser
|
|
94
|
+
WORKDIR /app
|
|
95
|
+
|
|
96
|
+
EXPOSE 9993/udp
|
|
97
|
+
|
|
98
|
+
COPY --chown=appuser:appuser --from=builder /app/.venv ./.venv
|
|
99
|
+
ENV PATH="/app/.venv/bin:$PATH"
|
|
100
|
+
# /app is the WORKDIR; domains/ is copied here. Console-script entry points
|
|
101
|
+
# don't inherit CWD on sys.path, so we set PYTHONPATH explicitly.
|
|
102
|
+
ENV PYTHONPATH="/app"
|
|
103
|
+
# Dynaconf-driven config layering looks for the storefront TOML under
|
|
104
|
+
# $XDG_CONFIG_HOME/arkhai/. Bind-mount the operator's TOML at
|
|
105
|
+
# /etc/arkhai/storefront.toml.
|
|
106
|
+
ENV XDG_CONFIG_HOME="/etc"
|
|
107
|
+
|
|
108
|
+
# Copy application code. The market_storefront package is shipped at
|
|
109
|
+
# /app/src/market_storefront so it's importable via the venv-installed
|
|
110
|
+
# package; the domains/ tree is copied in for compute-domain policy
|
|
111
|
+
# callables that the storefront's PolicyManager discovers at startup.
|
|
112
|
+
COPY --chown=appuser:appuser domains/vms/storefront/src ./src
|
|
113
|
+
COPY --chown=appuser:appuser domains/vms/storefront/scripts ./scripts
|
|
114
|
+
COPY --chown=appuser:appuser domains/ ./domains/
|
|
115
|
+
|
|
116
|
+
# Complete the two-phase uv install: deps were installed with
|
|
117
|
+
# --no-install-project in the builder stage (for layer caching);
|
|
118
|
+
# now install the project itself so the `market-storefront` console
|
|
119
|
+
# script is written to .venv/bin/.
|
|
120
|
+
# /.dist/ carries the internal wheels needed for --find-links resolution.
|
|
121
|
+
COPY --chown=appuser:appuser domains/vms/storefront/pyproject.toml domains/vms/storefront/uv.lock ./
|
|
122
|
+
# Same lock normalization as the builder stage (see comment there).
|
|
123
|
+
RUN sed -E -i 's|registry = "[^"]*\.dist"|registry = "/.dist"|' uv.lock
|
|
124
|
+
# Copy wheels directly from the build context (not from the builder stage).
|
|
125
|
+
# Using --from=builder here would serve a cached /.dist that Docker baked at
|
|
126
|
+
# the last full builder rebuild, silently ignoring any make dist updates since.
|
|
127
|
+
# Sourcing from the build context means this layer invalidates whenever
|
|
128
|
+
# .dist/ changes on disk, which is exactly what we want.
|
|
129
|
+
COPY .dist/ /.dist/
|
|
130
|
+
# --no-sources: the pyproject's [tool.uv.sources] editable workspace paths
|
|
131
|
+
# (../../../core, ../../../kit/*) exist for local dev only and cannot
|
|
132
|
+
# resolve inside the image; every internal package installs from its
|
|
133
|
+
# /.dist wheel instead.
|
|
134
|
+
RUN --mount=type=cache,target=/root/.cache/uv \
|
|
135
|
+
uv sync --no-sources --no-dev --find-links /.dist \
|
|
136
|
+
--refresh-package arkhai-core \
|
|
137
|
+
--refresh-package arkhai-core-storefront \
|
|
138
|
+
--refresh-package arkhai-core-registry-client \
|
|
139
|
+
--refresh-package arkhai-core-storefront-client \
|
|
140
|
+
--refresh-package arkhai-kit-policy \
|
|
141
|
+
--refresh-package arkhai-kit-alkahest \
|
|
142
|
+
--refresh-package arkhai-kit-identity \
|
|
143
|
+
--refresh-package arkhai-kit-config \
|
|
144
|
+
--refresh-package arkhai-vms-storefront \
|
|
145
|
+
--refresh-package arkhai-vms-provisioning
|
|
146
|
+
|
|
147
|
+
ARG PORT=8080
|
|
148
|
+
ENV PORT=${PORT}
|
|
149
|
+
EXPOSE ${PORT}
|
|
150
|
+
|
|
151
|
+
COPY --chown=appuser:appuser domains/vms/storefront/entrypoint.sh ./entrypoint.sh
|
|
152
|
+
RUN chmod +x ./entrypoint.sh
|
|
153
|
+
|
|
154
|
+
ARG MODEL_VERSION=""
|
|
155
|
+
ENV MODEL_VERSION=${MODEL_VERSION}
|
|
156
|
+
|
|
157
|
+
CMD ["./entrypoint.sh"]
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# BuildKit per-Dockerfile ignore (requires DOCKER_BUILDKIT=1).
|
|
2
|
+
# Deny everything, then allowlist what the build needs.
|
|
3
|
+
|
|
4
|
+
*
|
|
5
|
+
|
|
6
|
+
# ── Internal package wheels (built by make dist before docker build) ─
|
|
7
|
+
!.dist/
|
|
8
|
+
|
|
9
|
+
# ── VM storefront ────────────────────────────────────────────────────
|
|
10
|
+
!domains/
|
|
11
|
+
!domains/vms/
|
|
12
|
+
!domains/vms/storefront/
|
|
13
|
+
!domains/vms/storefront/pyproject.toml
|
|
14
|
+
!domains/vms/storefront/uv.lock
|
|
15
|
+
!domains/vms/storefront/src/**
|
|
16
|
+
!domains/vms/storefront/scripts/**
|
|
17
|
+
!domains/vms/storefront/packages/**
|
|
18
|
+
!domains/vms/storefront/entrypoint.sh
|
|
19
|
+
|
|
20
|
+
# ── core / kit / domains (imported by storefront at runtime) ─────────
|
|
21
|
+
!core/
|
|
22
|
+
!core/**
|
|
23
|
+
!domains/**
|
|
24
|
+
!kit/
|
|
25
|
+
!kit/identity/**
|
|
26
|
+
!kit/alkahest/**
|
|
27
|
+
!kit/config/**
|
|
28
|
+
!kit/policy/**
|
|
29
|
+
|
|
30
|
+
# ── Global excludes ──────────────────────────────────────────────────
|
|
31
|
+
**/.git
|
|
32
|
+
**/.venv
|
|
33
|
+
**/__pycache__
|
|
34
|
+
**/*.pyc
|
|
35
|
+
**/.env*
|
|
36
|
+
**/.DS_Store
|
|
37
|
+
**/.pytest_cache
|
|
38
|
+
**/*.db
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
IMAGE_NAME ?= arkhai
|
|
2
|
+
IMAGE_TAG ?= storefront
|
|
3
|
+
GIT_SUFFIX := $(shell git rev-parse --short HEAD)
|
|
4
|
+
|
|
5
|
+
# Path to the monorepo .dist/ wheel directory, relative to domains/vms/storefront/.
|
|
6
|
+
# Used by uv when resolving pure-Python internal packages
|
|
7
|
+
# (arkhai-kit-policy, arkhai-vms-provisioning) that are
|
|
8
|
+
# distributed as wheels rather than editable source installs. The
|
|
9
|
+
# Dockerfile passes --find-links /dist on the uv sync CLI instead;
|
|
10
|
+
# this variable is for local development only.
|
|
11
|
+
DIST_DIR ?= $(abspath $(CURDIR)/../../../.dist)
|
|
12
|
+
|
|
13
|
+
.PHONY: build build-images build-no-cache deploy deploy-storefront init reinit test test-unit test-integration
|
|
14
|
+
|
|
15
|
+
init: ## Resolve deps and create .venv. Run once after checkout or after changing pyproject.toml.
|
|
16
|
+
uv sync --find-links $(DIST_DIR)
|
|
17
|
+
|
|
18
|
+
reinit: ## Force-reinstall internal wheels without bumping versions. Use after make dist-*.
|
|
19
|
+
uv sync --find-links $(DIST_DIR) \
|
|
20
|
+
--upgrade-package arkhai-vms-provisioning \
|
|
21
|
+
--upgrade-package arkhai-core-storefront-client \
|
|
22
|
+
--upgrade-package arkhai-core-registry-client \
|
|
23
|
+
--reinstall-package arkhai-vms-provisioning \
|
|
24
|
+
--reinstall-package arkhai-core-storefront-client \
|
|
25
|
+
--reinstall-package arkhai-core-registry-client
|
|
26
|
+
|
|
27
|
+
# build deliberately does NOT depend on reinit. reinit drives a host-side
|
|
28
|
+
# `uv sync` that resolves the [rl] extra (incl. torch) across whatever
|
|
29
|
+
# uv considers "supported platforms" for this project — on x86_64 Linux
|
|
30
|
+
# that decides no torch wheel exists and aborts, blocking the Docker
|
|
31
|
+
# build that doesn't need torch at all (INSTALL_RL_DEPS=false). The
|
|
32
|
+
# Docker build has its own self-contained `uv sync --find-links /dist`
|
|
33
|
+
# inside the builder stage; the host venv isn't on its critical path.
|
|
34
|
+
# Run `make reinit` explicitly when iterating on internal wheels in the
|
|
35
|
+
# local venv.
|
|
36
|
+
build: build-images
|
|
37
|
+
|
|
38
|
+
build-images:
|
|
39
|
+
docker build --ulimit nofile=65536 -f Dockerfile --build-arg INSTALL_RL_DEPS=false -t ${IMAGE_NAME}:${IMAGE_TAG} ../../..
|
|
40
|
+
docker tag ${IMAGE_NAME}:${IMAGE_TAG} ${IMAGE_NAME}:${IMAGE_TAG}-$(GIT_SUFFIX)
|
|
41
|
+
|
|
42
|
+
build-no-cache: ## Full Docker cache bust — use when .dist/ changes are not picked up by build-images.
|
|
43
|
+
docker build --no-cache --ulimit nofile=65536 -f Dockerfile --build-arg INSTALL_RL_DEPS=false -t ${IMAGE_NAME}:${IMAGE_TAG} ../../..
|
|
44
|
+
docker tag ${IMAGE_NAME}:${IMAGE_TAG} ${IMAGE_NAME}:${IMAGE_TAG}-$(GIT_SUFFIX)
|
|
45
|
+
|
|
46
|
+
test: reinit test-unit test-integration ## Run all tests
|
|
47
|
+
|
|
48
|
+
test-unit: ## Run unit tests
|
|
49
|
+
uv run --find-links $(DIST_DIR) pytest tests/unit/ -v
|
|
50
|
+
|
|
51
|
+
test-integration: ## Run integration tests (no real infrastructure required — event queue seam)
|
|
52
|
+
ENABLE_EVENT_QUEUE=true \
|
|
53
|
+
AGENT_WALLET_ADDRESS="" \
|
|
54
|
+
uv run --find-links $(DIST_DIR) pytest tests/integration/ -v
|
|
55
|
+
|
|
56
|
+
deploy: deploy-storefront
|
|
57
|
+
|
|
58
|
+
# Buyers are pure HTTP clients (the `market` CLI / domains.vms.buyer
|
|
59
|
+
# library); they don't run a storefront. Use `make deploy-storefront`
|
|
60
|
+
# to bring up the seller; run `market buy ...` from the host or another
|
|
61
|
+
# container against `http://bob-storefront:8001`.
|
|
62
|
+
## RESOURCES_CSV_FILE: host path to the compute resource inventory CSV.
|
|
63
|
+
## Bind-mounted read-only into the container so the storefront can seed
|
|
64
|
+
## its resources table on startup via seller.resources_csv_path in config.
|
|
65
|
+
## Defaults to the dev inventory shipped in the source tree.
|
|
66
|
+
RESOURCES_CSV_FILE ?= $(CURDIR)/src/market_storefront/data/kvm1-machine.csv
|
|
67
|
+
|
|
68
|
+
deploy-storefront:
|
|
69
|
+
docker run --rm -d --name bob-storefront \
|
|
70
|
+
--network market -p 8001:8001 \
|
|
71
|
+
--cap-add NET_ADMIN --cap-add SYS_MODULE --device /dev/net/tun:/dev/net/tun \
|
|
72
|
+
-e XDG_CONFIG_HOME=/etc \
|
|
73
|
+
-v $(CURDIR)/storefront.bob.toml:/etc/arkhai/storefront.toml:ro \
|
|
74
|
+
-v $(RESOURCES_CSV_FILE):/app/resources.csv:ro \
|
|
75
|
+
arkhai:storefront
|
|
76
|
+
|
|
77
|
+
deploy-dev:
|
|
78
|
+
docker run --rm -it --name bob-storefront \
|
|
79
|
+
--network market -p 8001:8001 \
|
|
80
|
+
--cap-add NET_ADMIN --cap-add SYS_MODULE --device /dev/net/tun:/dev/net/tun \
|
|
81
|
+
-e XDG_CONFIG_HOME=/etc \
|
|
82
|
+
-v $(CURDIR)/storefront.bob.toml:/etc/arkhai/storefront.toml:ro \
|
|
83
|
+
-v $(RESOURCES_CSV_FILE):/app/resources.csv:ro \
|
|
84
|
+
arkhai:storefront
|
|
85
|
+
|
|
86
|
+
stop:
|
|
87
|
+
docker kill bob-storefront
|
|
88
|
+
|
|
89
|
+
status:
|
|
90
|
+
curl -s -X GET http://localhost:8001/api/v1/system/status -H "X-Admin-Key: test-api-key" | jq .
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: arkhai-vms-storefront
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Provider-side storefront server: hosts /orders, /negotiate, /settle, /alerts/resource endpoints. The provider-side counterpart to arkhai-vms-buyer.
|
|
5
|
+
Author-email: Your Name <your@email.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Requires-Python: >=3.12
|
|
8
|
+
Requires-Dist: alkahest-py>=0.4.0
|
|
9
|
+
Requires-Dist: arkhai-core
|
|
10
|
+
Requires-Dist: arkhai-core-registry-client>=0.7.0
|
|
11
|
+
Requires-Dist: arkhai-core-storefront
|
|
12
|
+
Requires-Dist: arkhai-core-storefront-client>=0.15.0
|
|
13
|
+
Requires-Dist: arkhai-kit-alkahest
|
|
14
|
+
Requires-Dist: arkhai-kit-config
|
|
15
|
+
Requires-Dist: arkhai-kit-identity
|
|
16
|
+
Requires-Dist: arkhai-kit-policy
|
|
17
|
+
Requires-Dist: arkhai-vms-provisioning>=0.4.0
|
|
18
|
+
Requires-Dist: dynaconf>=3.0.0
|
|
19
|
+
Requires-Dist: eth-account>=0.13.0
|
|
20
|
+
Requires-Dist: fastapi-utils>=0.8.0
|
|
21
|
+
Requires-Dist: fastapi~=0.115.8
|
|
22
|
+
Requires-Dist: google-cloud-logging<4.0.0,>=3.12.0
|
|
23
|
+
Requires-Dist: httpx>=0.27
|
|
24
|
+
Requires-Dist: opentelemetry-exporter-gcp-trace<2.0.0,>=1.9.0
|
|
25
|
+
Requires-Dist: psycopg2-binary<3.0.0,>=2.9.10
|
|
26
|
+
Requires-Dist: rich>=13.7.0
|
|
27
|
+
Requires-Dist: typer>=0.12.0
|
|
28
|
+
Requires-Dist: uvicorn~=0.34.0
|
|
29
|
+
Requires-Dist: web3>=7.14.0
|
|
30
|
+
Requires-Dist: websockets>=15.0.1
|
|
31
|
+
Provides-Extra: jupyter
|
|
32
|
+
Requires-Dist: jupyter<2.0.0,>=1.0.0; extra == 'jupyter'
|
|
33
|
+
Provides-Extra: lint
|
|
34
|
+
Requires-Dist: codespell<3.0.0,>=2.2.0; extra == 'lint'
|
|
35
|
+
Requires-Dist: mypy<2.0.0,>=1.15.0; extra == 'lint'
|
|
36
|
+
Requires-Dist: ruff<1.0.0,>=0.4.6; extra == 'lint'
|
|
37
|
+
Requires-Dist: types-pyyaml<7.0.0,>=6.0.12.20240917; extra == 'lint'
|
|
38
|
+
Requires-Dist: types-requests<3.0.0,>=2.32.0.20240914; extra == 'lint'
|
|
39
|
+
Provides-Extra: rl
|
|
40
|
+
Requires-Dist: torch>=2.7.0; extra == 'rl'
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
# Container entrypoint for the storefront agent.
|
|
3
|
+
#
|
|
4
|
+
# Pattern: bring up the ZeroTier daemon, then exec whatever was passed
|
|
5
|
+
# as args. If no args, fall back to `market-storefront serve` — that's
|
|
6
|
+
# the one-shot docker-compose case.
|
|
7
|
+
#
|
|
8
|
+
# This split lets Helm run the same image with two different commands:
|
|
9
|
+
# init container: ./entrypoint.sh market-storefront register --chain-id ...
|
|
10
|
+
# main container: ./entrypoint.sh market-storefront serve
|
|
11
|
+
#
|
|
12
|
+
# The ZeroTier daemon is the one piece that can't move into the CLI:
|
|
13
|
+
# it's a side-process that has to keep running alongside `serve` (and
|
|
14
|
+
# is needed by `register` too, when seller.zerotier_network is set).
|
|
15
|
+
#
|
|
16
|
+
# The `market-storefront` console script is installed into
|
|
17
|
+
# /app/.venv/bin/ by `uv sync` in the builder stage and is on PATH
|
|
18
|
+
# (see Dockerfile: ENV PATH="/app/.venv/bin:$PATH").
|
|
19
|
+
|
|
20
|
+
set -eu
|
|
21
|
+
|
|
22
|
+
echo "Starting ZeroTier daemon (fail-soft)..."
|
|
23
|
+
sudo zerotier-one -d || echo "ZeroTier daemon could not start (no caps?). Continuing."
|
|
24
|
+
for i in $(seq 1 10); do
|
|
25
|
+
[ -f /var/lib/zerotier-one/zerotier-one.port ] && break
|
|
26
|
+
sleep 1
|
|
27
|
+
done
|
|
28
|
+
|
|
29
|
+
if [ "$#" -gt 0 ]; then
|
|
30
|
+
exec "$@"
|
|
31
|
+
fi
|
|
32
|
+
|
|
33
|
+
echo "Starting storefront server..."
|
|
34
|
+
exec market-storefront serve
|