|
2 | 2 |
|
3 | 3 | This guide shows how to run the local sidecar daemon, provide a policy file, and verify health/status endpoints. |
4 | 4 |
|
| 5 | +--- |
| 6 | + |
| 7 | +## Sidecar Installation |
| 8 | + |
| 9 | +The sidecar (`predicate-authorityd`) is a lightweight Rust binary that handles policy evaluation and mandate signing. |
| 10 | + |
| 11 | +### Option A: Install via pip (recommended for Python users) |
| 12 | + |
| 13 | +```bash |
| 14 | +# Install SDK with sidecar extra - downloads binary automatically |
| 15 | +pip install predicate-authority[sidecar] |
| 16 | + |
| 17 | +# Or manually trigger download after installing core SDK |
| 18 | +pip install predicate-authority |
| 19 | +predicate-download-sidecar |
| 20 | +``` |
| 21 | + |
| 22 | +Binary location after install: |
| 23 | +- macOS: `~/Library/Application Support/predicate-authority/bin/predicate-authorityd` |
| 24 | +- Linux: `~/.local/share/predicate-authority/bin/predicate-authorityd` |
| 25 | +- Windows: `%LOCALAPPDATA%/predicate-authority/bin/predicate-authorityd.exe` |
| 26 | + |
| 27 | +### Option B: Download binary directly |
| 28 | + |
| 29 | +Download pre-built binaries from [GitHub Releases](https://github.com/PredicateSystems/predicate-authority-sidecar/releases): |
| 30 | + |
| 31 | +| Platform | Binary | |
| 32 | +|----------|--------| |
| 33 | +| macOS ARM64 (Apple Silicon) | `predicate-authorityd-darwin-arm64.tar.gz` | |
| 34 | +| macOS x64 (Intel) | `predicate-authorityd-darwin-x64.tar.gz` | |
| 35 | +| Linux x64 | `predicate-authorityd-linux-x64.tar.gz` | |
| 36 | +| Linux ARM64 | `predicate-authorityd-linux-arm64.tar.gz` | |
| 37 | +| Windows x64 | `predicate-authorityd-windows-x64.zip` | |
| 38 | + |
| 39 | +```bash |
| 40 | +# Example: macOS ARM64 |
| 41 | +curl -LO https://github.com/PredicateSystems/predicate-authority-sidecar/releases/latest/download/predicate-authorityd-darwin-arm64.tar.gz |
| 42 | +tar -xzf predicate-authorityd-darwin-arm64.tar.gz |
| 43 | +chmod +x predicate-authorityd |
| 44 | +./predicate-authorityd --version |
| 45 | +``` |
| 46 | + |
| 47 | +### Option C: Use from Python code |
| 48 | + |
| 49 | +```python |
| 50 | +from predicate_authority import run_sidecar, is_sidecar_available, download_sidecar |
| 51 | + |
| 52 | +# Download if needed |
| 53 | +if not is_sidecar_available(): |
| 54 | + download_sidecar() |
| 55 | + |
| 56 | +# Start as subprocess |
| 57 | +process = run_sidecar(port=8787, policy_file="policy.json") |
| 58 | + |
| 59 | +# Graceful shutdown |
| 60 | +process.terminate() |
| 61 | +process.wait() |
| 62 | +``` |
| 63 | + |
| 64 | +--- |
| 65 | + |
5 | 66 | ## 1) Sample `policy.json` |
6 | 67 |
|
7 | 68 | Create `examples/authorityd/policy.json`: |
@@ -31,87 +92,68 @@ Create `examples/authorityd/policy.json`: |
31 | 92 |
|
32 | 93 | ## 2) Start the daemon |
33 | 94 |
|
34 | | -Run from repo root: |
| 95 | +### Basic local mode |
35 | 96 |
|
36 | 97 | ```bash |
37 | | -PYTHONPATH=. predicate-authorityd \ |
| 98 | +./predicate-authorityd run \ |
38 | 99 | --host 127.0.0.1 \ |
39 | 100 | --port 8787 \ |
40 | 101 | --mode local_only \ |
41 | | - --policy-file examples/authorityd/policy.json \ |
42 | | - --policy-poll-interval-s 2.0 \ |
43 | | - --credential-store-file ./.predicate-authorityd/credentials.json |
| 102 | + --policy-file policy.json |
44 | 103 | ``` |
45 | 104 |
|
46 | | -By design, mandate/revocation cache is in-memory (ephemeral) unless you explicitly |
47 | | -enable persistence with `--mandate-store-file`. |
48 | | - |
49 | | -### Optional: enable persisted mandate/revocation cache (parity extension) |
50 | | - |
51 | | -Use this only when restart-recovery for local revocations/mandate lineage is required. |
52 | | -If omitted, default behavior remains ephemeral. |
| 105 | +### With local identity registry |
53 | 106 |
|
54 | 107 | ```bash |
55 | | -PYTHONPATH=. predicate-authorityd \ |
| 108 | +./predicate-authorityd run \ |
56 | 109 | --host 127.0.0.1 \ |
57 | 110 | --port 8787 \ |
58 | 111 | --mode local_only \ |
59 | | - --policy-file examples/authorityd/policy.json \ |
60 | | - --mandate-store-file ./.predicate-authorityd/mandates.json |
| 112 | + --policy-file policy.json \ |
| 113 | + --identity-file ./local-identities.json |
61 | 114 | ``` |
62 | 115 |
|
63 | | -### Optional: enable control-plane shipping |
| 116 | +### Cloud-connected mode (control-plane sync) |
64 | 117 |
|
65 | | -To automatically ship proof events and usage records to |
66 | | -`predicate-authority-control-plane`, set: |
| 118 | +Connect to Predicate Authority control-plane for policy sync, revocation push, and audit forwarding: |
67 | 119 |
|
68 | 120 | ```bash |
69 | | -export CONTROL_PLANE_URL="http://127.0.0.1:8080" |
70 | | -export CONTROL_PLANE_TENANT_ID="dev-tenant" |
71 | | -export CONTROL_PLANE_PROJECT_ID="dev-project" |
72 | | -export CONTROL_PLANE_API_KEY="<bearer-token>" |
| 121 | +export PREDICATE_API_KEY="your-api-key" |
73 | 122 |
|
74 | | -PYTHONPATH=. predicate-authorityd \ |
| 123 | +./predicate-authorityd run \ |
75 | 124 | --host 127.0.0.1 \ |
76 | 125 | --port 8787 \ |
77 | | - --mode local_only \ |
78 | | - --policy-file examples/authorityd/policy.json \ |
79 | | - --control-plane-enabled \ |
80 | | - --control-plane-fail-open |
| 126 | + --mode cloud_connected \ |
| 127 | + --policy-file policy.json \ |
| 128 | + --control-plane-url https://api.predicatesystems.dev \ |
| 129 | + --tenant-id your-tenant \ |
| 130 | + --project-id your-project \ |
| 131 | + --predicate-api-key $PREDICATE_API_KEY \ |
| 132 | + --sync-enabled |
81 | 133 | ``` |
82 | 134 |
|
83 | | -### Optional: enable long-poll policy/revocation sync from control-plane |
| 135 | +### Local IdP mode (development/air-gapped) |
84 | 136 |
|
85 | | -Use this when running `cloud_connected` mode and you want active policy/revocation |
86 | | -updates pushed through long-poll sync instead of waiting for file-based policy polling. |
| 137 | +For development or air-gapped environments without external IdP: |
87 | 138 |
|
88 | 139 | ```bash |
89 | | -export CONTROL_PLANE_URL="http://127.0.0.1:8080" |
90 | | -export CONTROL_PLANE_TENANT_ID="dev-tenant" |
91 | | -export CONTROL_PLANE_PROJECT_ID="dev-project" |
92 | | -export CONTROL_PLANE_API_KEY="<bearer-token>" |
| 140 | +export LOCAL_IDP_SIGNING_KEY="replace-with-strong-secret" |
93 | 141 |
|
94 | | -PYTHONPATH=. predicate-authorityd \ |
| 142 | +./predicate-authorityd run \ |
95 | 143 | --host 127.0.0.1 \ |
96 | 144 | --port 8787 \ |
97 | | - --mode cloud_connected \ |
98 | | - --policy-file examples/authorityd/policy.json \ |
99 | | - --control-plane-enabled \ |
100 | | - --control-plane-sync-enabled \ |
101 | | - --control-plane-sync-project-id "$CONTROL_PLANE_PROJECT_ID" \ |
102 | | - --control-plane-sync-environment "prod" \ |
103 | | - --control-plane-sync-wait-timeout-s 15 \ |
104 | | - --control-plane-sync-poll-interval-ms 200 |
| 145 | + --mode local_only \ |
| 146 | + --policy-file policy.json \ |
| 147 | + --identity-mode local-idp \ |
| 148 | + --local-idp-issuer "http://localhost/predicate-local-idp" \ |
| 149 | + --local-idp-audience "api://predicate-authority" |
105 | 150 | ``` |
106 | 151 |
|
107 | | -Quick checks: |
| 152 | +Quick health checks: |
108 | 153 |
|
109 | 154 | ```bash |
110 | | -# daemon sync health counters |
111 | | -curl -s http://127.0.0.1:8787/status | jq '.control_plane_sync_poll_count, .control_plane_sync_update_count, .control_plane_sync_error_count, .control_plane_last_sync_error' |
112 | | - |
113 | | -# daemon metrics includes control-plane sync counters |
114 | | -curl -s http://127.0.0.1:8787/metrics | rg "predicate_authority_control_plane_sync_total" |
| 155 | +curl -s http://127.0.0.1:8787/health | jq |
| 156 | +curl -s http://127.0.0.1:8787/status | jq |
115 | 157 | ``` |
116 | 158 |
|
117 | 159 | ### Signing key safety note (required until mandate `v2` claims) |
|
0 commit comments