progress-cli 0.10.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.
@@ -0,0 +1,3 @@
1
+ dist/
2
+ .venv/
3
+ __pycache__/
@@ -0,0 +1,52 @@
1
+ Metadata-Version: 2.5
2
+ Name: progress-cli
3
+ Version: 0.10.0
4
+ Summary: Progress Platform operations CLI — install, back up, restore, and run a dev environment
5
+ License: Apache-2.0
6
+ Requires-Python: >=3.11
7
+ Requires-Dist: httpx>=0.27
8
+ Requires-Dist: pyyaml>=6
9
+ Requires-Dist: rich>=13
10
+ Requires-Dist: typer>=0.12
11
+ Description-Content-Type: text/markdown
12
+
13
+ # progress-cli
14
+
15
+ The Progress Platform operations CLI: `progress init` (provision a host),
16
+ `progress backup` / `progress restore` (database snapshots, local or
17
+ remote), `progress update` (roll services to a new release), and
18
+ `progress dev` (hot-reload development stack from a checkout).
19
+
20
+ Full reference: <https://progresslabit.github.io/progress-platform/cli/>
21
+ (sources in `docs/cli/`). Design decisions: `km/decisions/0019-progress-cli-implementation.md`,
22
+ `km/decisions/0022-cli-engine-deploy-package.md`.
23
+
24
+ ## Install
25
+
26
+ ```bash
27
+ curl -fsSL https://progresslabit.github.io/progress-platform/install.sh | sudo sh # servers, all users
28
+ uv tool install progress-cli # or per user (pipx works too)
29
+ ```
30
+
31
+ or, from a checkout:
32
+
33
+ ```bash
34
+ uv tool install --from ./cli progress-cli
35
+ ```
36
+
37
+ ## Development
38
+
39
+ ```bash
40
+ cd cli
41
+ uv venv && uv pip install -e . --python .venv/bin/python
42
+ .venv/bin/progress --help
43
+ ```
44
+
45
+ The wheel holds only the CLI code. Release-specific files ship per
46
+ platform release in the `deploy:<tag>` image (`deploy/package.Dockerfile`,
47
+ `deploy/manifest.yaml`); editable installs read the live repo files
48
+ instead. Outside `progress dev`, the CLI must not read repo files except
49
+ through the package (`tests/cli/test_package.py`). Versioning: bump
50
+ `version` in `pyproject.toml`, tag `cli-vX.Y.Z`, CI publishes to PyPI. The CI drift
51
+ gate (`tests/cli/test_cli_help.py`) snapshots every command's `--help`
52
+ against `docs/cli/`.
@@ -0,0 +1,11 @@
1
+ """Progress Platform operations CLI."""
2
+ from importlib.metadata import PackageNotFoundError, version
3
+
4
+ try:
5
+ __version__ = version("progress-cli")
6
+ except PackageNotFoundError: # unpackaged checkout (tests): same single source
7
+ import tomllib
8
+ from pathlib import Path
9
+
10
+ __version__ = tomllib.loads(
11
+ (Path(__file__).parents[1] / "pyproject.toml").read_text())["project"]["version"]
@@ -0,0 +1,4 @@
1
+ """`python -m progress_cli` — used by `init` to re-run itself under sudo."""
2
+ from progress_cli.main import app
3
+
4
+ app(prog_name="progress")
@@ -0,0 +1,63 @@
1
+ """`progress backup` — dump ArangoDB into the db container's /db_backup
2
+ volume (on a production host that's the /opt/progress/db_backup bind
3
+ mount) and repoint the `latest` link."""
4
+ from __future__ import annotations
5
+
6
+ from datetime import datetime
7
+
8
+ import typer
9
+
10
+ from progress_cli.runner import (
11
+ CONTAINER_BACKUP_DIR, PROD_ROOT, arango_exec, arango_root_password,
12
+ console, find_arango_container, step,
13
+ )
14
+
15
+
16
+ def backup(
17
+ database: list[str] = typer.Option(None, "--db", "-d", help="Dump only these databases (default: all databases)"),
18
+ label: str = typer.Option(None, "--label", help="Snapshot directory name (default: local timestamp, e.g. 20260709-153000)"),
19
+ container: str = typer.Option(None, "--container", help="Database container name/ID override"),
20
+ ):
21
+ """Create a database snapshot with arangodump.
22
+
23
+ Writes to <snapshot> inside the db container's /db_backup volume and
24
+ updates the `latest` link to point at it. On a host installed by
25
+ `progress init` the snapshot lands in /opt/progress/db_backup/.
26
+ """
27
+ name = label or datetime.now().strftime("%Y%m%d-%H%M%S")
28
+
29
+ with step("Locating database container") as s:
30
+ db_container = container or find_arango_container()
31
+ s.done(db_container)
32
+
33
+ password = arango_root_password(db_container)
34
+ auth = ["--server.username", "root", "--server.password", password]
35
+
36
+ with step(f"Dumping to {name}") as s:
37
+ target = f"{CONTAINER_BACKUP_DIR}/{name}"
38
+ # arangodump only creates the leaf directory
39
+ arango_exec(db_container, "mkdir", "-p", target)
40
+ if database:
41
+ for db_name in database:
42
+ arango_exec(
43
+ db_container, "arangodump", *auth,
44
+ "--server.database", db_name,
45
+ "--output-directory", f"{target}/{db_name}",
46
+ )
47
+ s.done(", ".join(database))
48
+ else:
49
+ arango_exec(
50
+ db_container, "arangodump", *auth,
51
+ "--all-databases", "true",
52
+ "--output-directory", target,
53
+ )
54
+ s.done("all databases")
55
+
56
+ with step("Updating `latest` link") as s:
57
+ arango_exec(db_container, "ln", "-sfn", name,
58
+ f"{CONTAINER_BACKUP_DIR}/latest")
59
+ s.done(f"latest → {name}")
60
+
61
+ host_path = PROD_ROOT / "db_backup" / name
62
+ location = host_path if host_path.exists() else f"{db_container}:{CONTAINER_BACKUP_DIR}/{name}"
63
+ console.print(f"\n Snapshot: [bold]{location}[/]\n")