fadenstack 0.4.2__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.
- faden_cli/__init__.py +16 -0
- faden_cli/__main__.py +9 -0
- faden_cli/bundle/shared/.gitignore +25 -0
- faden_cli/bundle/shared/LICENSE +187 -0
- faden_cli/bundle/shared/NOTICE +15 -0
- faden_cli/bundle/shared/OFFICIAL.md +9 -0
- faden_cli/bundle/shared/README.md +16 -0
- faden_cli/bundle/shared/agent-binaries/.gitignore +5 -0
- faden_cli/bundle/shared/alloy/config.alloy +40 -0
- faden_cli/bundle/shared/clickhouse/config.d/system-logs.xml +26 -0
- faden_cli/bundle/shared/docker-compose.gpu.yaml +34 -0
- faden_cli/bundle/shared/docker-compose.yaml +998 -0
- faden_cli/bundle/shared/grafana/dashboards/templates/vllm-runtime.json +2099 -0
- faden_cli/bundle/shared/grafana/provisioning/dashboards/dashboard.yml +10 -0
- faden_cli/bundle/shared/grafana/provisioning/dashboards/json/faden-overview.json +211 -0
- faden_cli/bundle/shared/grafana/provisioning/datasources/ds.yaml +9 -0
- faden_cli/bundle/shared/grafana/provisioning/datasources/prometheus.yaml +15 -0
- faden_cli/bundle/shared/initdb/01-init.sql +32 -0
- faden_cli/bundle/shared/loki/local-config.yaml +32 -0
- faden_cli/bundle/shared/nginx/locations.conf +245 -0
- faden_cli/bundle/shared/nginx/maintenance.html +239 -0
- faden_cli/bundle/shared/nginx/nginx-tls.conf +79 -0
- faden_cli/bundle/shared/nginx/nginx.conf +44 -0
- faden_cli/bundle/shared/nginx/rate-limits.conf +42 -0
- faden_cli/bundle/shared/nginx/security-headers.conf +22 -0
- faden_cli/bundle/shared/nginx/select-config.sh +37 -0
- faden_cli/bundle/shared/prometheus/prometheus.yml +40 -0
- faden_cli/bundle/shared/rabbitmq/definitions.json.example +37 -0
- faden_cli/bundle/shared/tls/README.md +30 -0
- faden_cli/cli.py +158 -0
- faden_cli/commands/__init__.py +1 -0
- faden_cli/commands/admin.py +161 -0
- faden_cli/commands/backup.py +159 -0
- faden_cli/commands/config.py +146 -0
- faden_cli/commands/deploy.py +949 -0
- faden_cli/commands/dev/__init__.py +1 -0
- faden_cli/commands/dev/dev_doctor.py +46 -0
- faden_cli/commands/dev/dev_down.py +241 -0
- faden_cli/commands/dev/dev_group.py +24 -0
- faden_cli/commands/dev/dev_init.py +710 -0
- faden_cli/commands/dev/dev_pull.py +297 -0
- faden_cli/commands/dev/dev_status.py +151 -0
- faden_cli/commands/dev/dev_up.py +1392 -0
- faden_cli/commands/doctor.py +225 -0
- faden_cli/commands/down.py +75 -0
- faden_cli/commands/logs_cmd.py +41 -0
- faden_cli/commands/maintenance.py +74 -0
- faden_cli/commands/module.py +113 -0
- faden_cli/commands/observe.py +95 -0
- faden_cli/commands/ports.py +91 -0
- faden_cli/commands/rebuild.py +158 -0
- faden_cli/commands/restore.py +139 -0
- faden_cli/commands/runtime_images.py +174 -0
- faden_cli/commands/status.py +71 -0
- faden_cli/commands/tls.py +722 -0
- faden_cli/commands/tune.py +37 -0
- faden_cli/commands/up.py +64 -0
- faden_cli/commands/upgrade.py +470 -0
- faden_cli/commands/version.py +78 -0
- faden_cli/core/__init__.py +1 -0
- faden_cli/core/api_client.py +77 -0
- faden_cli/core/backup.py +717 -0
- faden_cli/core/bootstrap.py +291 -0
- faden_cli/core/bundle.py +110 -0
- faden_cli/core/clickhouse.py +61 -0
- faden_cli/core/compose.py +484 -0
- faden_cli/core/console.py +106 -0
- faden_cli/core/detect.py +580 -0
- faden_cli/core/dev_modules.py +149 -0
- faden_cli/core/docker_env.py +147 -0
- faden_cli/core/edge.py +94 -0
- faden_cli/core/env_gen.py +598 -0
- faden_cli/core/git.py +219 -0
- faden_cli/core/install.py +288 -0
- faden_cli/core/installation.py +186 -0
- faden_cli/core/local_node.py +719 -0
- faden_cli/core/maintenance.py +82 -0
- faden_cli/core/private_files.py +133 -0
- faden_cli/core/registry.py +574 -0
- faden_cli/core/release_feed.py +342 -0
- faden_cli/core/rmq.py +135 -0
- faden_cli/core/runtime_images.py +309 -0
- faden_cli/core/schedule.py +278 -0
- faden_cli/core/settings.py +159 -0
- faden_cli/core/sysinfo.py +303 -0
- faden_cli/core/tls.py +790 -0
- faden_cli/core/tune.py +154 -0
- faden_cli/core/update_check.py +254 -0
- faden_cli/core/workspace.py +155 -0
- faden_cli/templates/env.j2 +33 -0
- faden_cli/tui/__init__.py +1 -0
- faden_cli/tui/widgets/__init__.py +1 -0
- faden_cli/tui/wizard/__init__.py +1 -0
- fadenstack-0.4.2.dist-info/METADATA +304 -0
- fadenstack-0.4.2.dist-info/RECORD +99 -0
- fadenstack-0.4.2.dist-info/WHEEL +4 -0
- fadenstack-0.4.2.dist-info/entry_points.txt +3 -0
- fadenstack-0.4.2.dist-info/licenses/LICENSE +187 -0
- fadenstack-0.4.2.dist-info/licenses/NOTICE +15 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"""HTTP client for the Fadenstack backend REST API.
|
|
2
|
+
|
|
3
|
+
Used by commands that need to interact with a running backend instance
|
|
4
|
+
(``provider``, ``user``, ``model``, ``config``, etc.). The client
|
|
5
|
+
reads ``api_url`` and ``api_token`` from the persisted config.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
from typing import Any
|
|
11
|
+
|
|
12
|
+
import httpx
|
|
13
|
+
|
|
14
|
+
from faden_cli.core.settings import FadenConfig
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class ApiClient:
|
|
18
|
+
"""Thin wrapper around ``httpx.Client`` targeting the backend API."""
|
|
19
|
+
|
|
20
|
+
def __init__(self, cfg: FadenConfig, *, timeout: float = 30.0) -> None:
|
|
21
|
+
self.base_url = cfg.api_url.rstrip("/")
|
|
22
|
+
self.token = cfg.api_token
|
|
23
|
+
self._client = httpx.Client(
|
|
24
|
+
base_url=self.base_url,
|
|
25
|
+
timeout=timeout,
|
|
26
|
+
headers=self._headers(),
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
def _headers(self) -> dict[str, str]:
|
|
30
|
+
headers: dict[str, str] = {"Accept": "application/json"}
|
|
31
|
+
if self.token:
|
|
32
|
+
headers["Authorization"] = f"Bearer {self.token}"
|
|
33
|
+
return headers
|
|
34
|
+
|
|
35
|
+
# ── HTTP verbs ────────────────────────────────────────────
|
|
36
|
+
|
|
37
|
+
def get(self, path: str, **kwargs: Any) -> httpx.Response:
|
|
38
|
+
"""Send a GET request."""
|
|
39
|
+
return self._client.get(path, **kwargs)
|
|
40
|
+
|
|
41
|
+
def post(self, path: str, **kwargs: Any) -> httpx.Response:
|
|
42
|
+
"""Send a POST request."""
|
|
43
|
+
return self._client.post(path, **kwargs)
|
|
44
|
+
|
|
45
|
+
def put(self, path: str, **kwargs: Any) -> httpx.Response:
|
|
46
|
+
"""Send a PUT request."""
|
|
47
|
+
return self._client.put(path, **kwargs)
|
|
48
|
+
|
|
49
|
+
def patch(self, path: str, **kwargs: Any) -> httpx.Response:
|
|
50
|
+
"""Send a PATCH request."""
|
|
51
|
+
return self._client.patch(path, **kwargs)
|
|
52
|
+
|
|
53
|
+
def delete(self, path: str, **kwargs: Any) -> httpx.Response:
|
|
54
|
+
"""Send a DELETE request."""
|
|
55
|
+
return self._client.delete(path, **kwargs)
|
|
56
|
+
|
|
57
|
+
def close(self) -> None:
|
|
58
|
+
"""Close the underlying HTTP client."""
|
|
59
|
+
self._client.close()
|
|
60
|
+
|
|
61
|
+
def __enter__(self) -> "ApiClient":
|
|
62
|
+
"""Support context manager protocol."""
|
|
63
|
+
return self
|
|
64
|
+
|
|
65
|
+
def __exit__(self, *_: Any) -> None:
|
|
66
|
+
"""Close on exit."""
|
|
67
|
+
self.close()
|
|
68
|
+
|
|
69
|
+
# ── Health check ──────────────────────────────────────────
|
|
70
|
+
|
|
71
|
+
def healthy(self) -> bool:
|
|
72
|
+
"""Check if the backend is reachable and healthy."""
|
|
73
|
+
try:
|
|
74
|
+
resp = self.get("/api/health")
|
|
75
|
+
return resp.status_code == 200 # noqa: PLR2004
|
|
76
|
+
except httpx.HTTPError:
|
|
77
|
+
return False
|