| author | |
| committer | |
| log | 0701dbcf4c737821b522372cdf8419a1cf3a085d |
| tree | 2b713760b7efde6cc4e15d02962b703838b68d22 |
| parent | 308dd71916c2998f8ee2a241d8da499c31d9ad93 |
| signature | Signed by SSH key SHA256:52mNGHRsVFBDED9IAX5pe+LRWUefqTbxEReunq21QvU |
Protect the management panel with Snow SSO and expose the separately keyed client endpoint at cpa-api. Preserve existing service data and credentials.
Assisted-by: gpt-6.1-terra4 files changed, 9 insertions(+), 16 deletions(-)
service/cliproxy/service.pkl+2-3| ... | @@ -4,7 +4,6 @@ import "../../config/site.pkl" as site | ... | @@ -4,7 +4,6 @@ import "../../config/site.pkl" as site |
| 4 | import "../../config/OpenID.pkl" as sso | 4 | import "../../config/OpenID.pkl" as sso |
| 5 | 5 | ||
| 6 | name = "CLIProxyAPI" | 6 | name = "CLIProxyAPI" |
| 7 | enabled = false | ||
| 8 | tagline = "Codex and Claude API access" | 7 | tagline = "Codex and Claude API access" |
| 9 | access = "infra-admin" | 8 | access = "infra-admin" |
| 10 | stageIsolation = "fresh" | 9 | stageIsolation = "fresh" |
| ... | @@ -23,10 +22,10 @@ container { | ... | @@ -23,10 +22,10 @@ container { |
| 23 | tmpfs { "/tmp:rw,nosuid,nodev,noexec,size=64m" } | 22 | tmpfs { "/tmp:rw,nosuid,nodev,noexec,size=64m" } |
| 24 | http { | 23 | http { |
| 25 | containerPort = 8080 | 24 | containerPort = 8080 |
| 26 | subdomain = "cliproxy" | 25 | subdomain = "cpa" |
| 27 | authRole = "infra-admin" | 26 | authRole = "infra-admin" |
| 28 | checkPath = "/healthz" | 27 | checkPath = "/healthz" |
| 29 | plainHostnames { "cliproxy-api.\(site.domain)" } | 28 | plainHostnames { "cpa-api.\(site.domain)" } |
| 30 | } | 29 | } |
| 31 | volumes { | 30 | volumes { |
| 32 | ["/data"] {} | 31 | ["/data"] {} |
service/forward-auth/service.pkl+1-1| ... | @@ -14,7 +14,7 @@ requirements { | ... | @@ -14,7 +14,7 @@ requirements { |
| 14 | name = module.name | 14 | name = module.name |
| 15 | redirectUris { | 15 | redirectUris { |
| 16 | when (isPreview) { "https://\(module.id).\(site.domain)/snow.oauth2/callback" } | 16 | when (isPreview) { "https://\(module.id).\(site.domain)/snow.oauth2/callback" } |
| 17 | when (!isPreview) { for (host in new Listing<String> { "music"; "seedbox"; "ddns"; "redis"; "pg"; "snr"; "rdr"; "logs"; "metrics"; "traces"; "jkt"; "openclaw"; "cliproxy" }) { | 17 | when (!isPreview) { for (host in new Listing<String> { "music"; "seedbox"; "ddns"; "redis"; "pg"; "snr"; "rdr"; "logs"; "metrics"; "traces"; "jkt"; "openclaw"; "cpa" }) { |
| 18 | "https://\(host).\(site.domain)/snow.oauth2/callback" | 18 | "https://\(host).\(site.domain)/snow.oauth2/callback" |
| 19 | } } | 19 | } } |
| 20 | } | 20 | } |
tools/cliproxy-test.py+2-2| ... | @@ -31,7 +31,7 @@ PANEL = None | ... | @@ -31,7 +31,7 @@ PANEL = None |
| 31 | API_KEY = "a1" * 32 | 31 | API_KEY = "a1" * 32 |
| 32 | MANAGEMENT_KEY = "b2" * 32 | 32 | MANAGEMENT_KEY = "b2" * 32 |
| 33 | ADMIN_HOST = "cliproxy-preview-12345678.paperclover.net" | 33 | ADMIN_HOST = "cliproxy-preview-12345678.paperclover.net" |
| 34 | API_HOST = "cliproxy-preview-12345678-cliproxy-api.paperclover.net" | 34 | API_HOST = "cliproxy-preview-12345678-cpa-api.paperclover.net" |
| 35 | 35 | ||
| 36 | 36 | ||
| 37 | class ServiceTests(unittest.TestCase): | 37 | class ServiceTests(unittest.TestCase): |
| ... | @@ -59,7 +59,7 @@ class ServiceTests(unittest.TestCase): | ... | @@ -59,7 +59,7 @@ class ServiceTests(unittest.TestCase): |
| 59 | self.assertEqual(config["oauth"]["auth-dir"], "/data/auth") | 59 | self.assertEqual(config["oauth"]["auth-dir"], "/data/auth") |
| 60 | self.assertTrue(config["management"]["disable-auto-update-panel"]) | 60 | self.assertTrue(config["management"]["disable-auto-update-panel"]) |
| 61 | self.assertEqual(app["http"]["authRole"], "infra-admin") | 61 | self.assertEqual(app["http"]["authRole"], "infra-admin") |
| 62 | self.assertEqual(app["http"]["plainHostnames"], ['cliproxy-api.paperclover.net']) | 62 | self.assertEqual(app["http"]["plainHostnames"], ['cpa-api.paperclover.net']) |
| 63 | self.assertEqual(self.data["stageIsolation"], "fresh") | 63 | self.assertEqual(self.data["stageIsolation"], "fresh") |
| 64 | 64 | ||
| 65 | def test_rendered_job_has_only_nonroot_private_managed_storage(self): | 65 | def test_rendered_job_has_only_nonroot_private_managed_storage(self): |
tools/cliproxy.md+4-10| ... | @@ -1,17 +1,11 @@ | ... | @@ -1,17 +1,11 @@ |
| 1 | # CLIProxyAPI | 1 | # CLIProxyAPI |
| 2 | 2 | ||
| 3 | The service is parked with `enabled = false`: its job and public routes are | 3 | `cpa.paperclover.net` is the management panel, protected by Snow's |
| 4 | removed while the source, `/srv/prod/cliproxy`, and Nomad variables remain. | ||
| 5 | To resume, set `enabled = true` in `service/cliproxy/service.pkl` and use the | ||
| 6 | normal production deployment workflow; existing configuration and accounts are | ||
| 7 | retained. | ||
| 8 | |||
| 9 | `cliproxy.paperclover.net` is the management panel, protected by Snow's | ||
| 10 | `infra-admin` role. Snow sign-in opens it automatically; nginx supplies the | 4 | `infra-admin` role. Snow sign-in opens it automatically; nginx supplies the |
| 11 | independent management key to its management endpoints on the server. | 5 | independent management key to its management endpoints on the server. |
| 12 | `cliproxy-api.paperclover.net` is the client endpoint: use | 6 | `cpa-api.paperclover.net` is the client endpoint: use |
| 13 | `https://cliproxy-api.paperclover.net/v1` for OpenAI-compatible clients or | 7 | `https://cpa-api.paperclover.net/v1` for OpenAI-compatible clients or |
| 14 | `https://cliproxy-api.paperclover.net` for Claude-compatible clients. | 8 | `https://cpa-api.paperclover.net` for Claude-compatible clients. |
| 15 | 9 | ||
| 16 | Nomad variable `nomad/jobs/cliproxy` owns `api_key` and `management_key`. | 10 | Nomad variable `nomad/jobs/cliproxy` owns `api_key` and `management_key`. |
| 17 | Keep values in restricted private files or a password manager; do not paste them | 11 | Keep values in restricted private files or a password manager; do not paste them |