Server tools to backfill, tail, mirror, and verify PLC logs

update docs for v0.3, forwarding writes upstream

+38 -12
+1 -1
Cargo.lock
··· 28 28 29 29 [[package]] 30 30 name = "allegedly" 31 - version = "0.2.1" 31 + version = "0.3.0" 32 32 dependencies = [ 33 33 "anyhow", 34 34 "async-compression",
+1 -1
Cargo.toml
··· 2 2 name = "allegedly" 3 3 description = "public ledger server tools and services (for the PLC)" 4 4 license = "MIT OR Apache-2.0" 5 - version = "0.2.1" 5 + version = "0.3.0" 6 6 edition = "2024" 7 7 default-run = "allegedly" 8 8
+11 -6
readme.md
··· 26 26 sudo allegedly mirror \ 27 27 --upstream "https://plc.directory" \ 28 28 --wrap "http://127.0.0.1:3000" \ 29 + --wrap-pg-cert "/opt/allegedly/postgres-cert.pem" \ 29 30 --acme-domain "plc.wtf" \ 31 + --acme-domain "alt.plc.wtf" \ 32 + --experimental-acme-domain "experimental.plc.wtf" \ 30 33 --acme-cache-path ./acme-cache \ 31 - --acme-directory-url "https://acme-staging-v02.api.letsencrypt.org/directory" 34 + --acme-directory-url "https://acme-staging-v02.api.letsencrypt.org/directory" \ 35 + --acme-ipv6 \ 36 + --experimental-write-upstream 32 37 ``` 33 38 34 39 ··· 68 73 69 74 ### new things 70 75 71 - - experimental: websocket version of /export 72 - - experimental: accept writes by forwarding them upstream 73 - - experimental: serve a tlog 74 - - experimental: embed a log database directly for fast and efficient mirroring 75 - - experimental: support multiple upstreams? 76 + - [ ] experimental: websocket version of /export 77 + - [x] experimental: accept writes by forwarding them upstream 78 + - [ ] experimental: serve a tlog 79 + - [ ] experimental: embed a log database directly for fast and efficient mirroring 80 + - [ ] experimental: support multiple upstreams? 76 81 77 82 - [ ] new command todo: `zip` or `check` or `diff`: compare two plc logs over some time range 78 83 - [ ] new command to consider: `scatter` or something: broadcast plc writes to multiple upstreams
+25 -4
src/mirror.rs
··· 25 25 } 26 26 27 27 #[handler] 28 - fn hello(Data(State { upstream, .. }): Data<&State>) -> String { 28 + fn hello( 29 + Data(State { 30 + upstream, 31 + experimental: exp, 32 + .. 33 + }): Data<&State>, 34 + req: &Request, 35 + ) -> String { 36 + let post_info = match (exp.write_upstream, &exp.acme_domain, req.uri().host()) { 37 + (false, _, _) => " - POST /* Always rejected. This is a mirror.".to_string(), 38 + (_, None, _) => { 39 + " - POST /:did Create a PLC op. Allegedly will forward it upstream.".to_string() 40 + } 41 + (_, Some(d), Some(f)) if f == d => { 42 + " - POST /:did Create a PLC op. Allegedly will forward it upstream.".to_string() 43 + } 44 + (_, Some(d), _) => format!( 45 + r#"\ 46 + - POST /* Rejected, but experimental upstream op forwarding is 47 + available at `POST {d}/:did`!"# 48 + ), 49 + }; 50 + 29 51 format!( 30 52 r#"{} 31 53 ··· 45 67 - GET /* Proxies to wrapped server; see PLC API docs: 46 68 https://web.plc.directory/api/redoc 47 69 48 - - POST /* Always rejected. This is a mirror. 70 + tip: try `GET /{{did}}` to resolve an identity 49 71 50 - 51 - tip: try `GET /{{did}}` to resolve an identity 72 + {post_info} 52 73 53 74 54 75 Allegedly is a suite of open-source CLI tools from for working with PLC logs,