feat(diigo-cache): production deployment with tailscale, systemd, and nix
diigo binds the session cookie to the IP it was issued to, so a Cloudflare deployment can't use a cookie minted in the browser. Run diigo-cache and webapp in one workerd on bldbox instead. The flake bundles each worker with wrangler's dry run, so the modules match what `wrangler deploy` ships, and generates the workerd config from the bundles. workerd comes from nixpkgs' wrangler, the only packaged one. A smoke check serves the home page and mints a webapp instance, which covers the WEBAPP binding and Durable Object storage. The service is a system unit with DynamicUser, so the webapp state holding the cookie isn't readable by processes running as the user. It listens on loopback behind tailscale serve: HTTPS, which PasswordCredential needs, at the tailnet name only. Operator docs in doc/; unsettled points recorded as IBIS issues. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
9c3eaa9819
commit
857816166e
14 files changed
+580
-2
No files matched your search
@@ -0,0 +1,26 @@
|
||||
[Unit]
|
||||
Description=diigo-cache and webapp (workerd)
|
||||
Requires=diigo-cache.socket
|
||||
|
||||
[Service]
|
||||
# the profile path survives upgrades; see doc/install.md
|
||||
ExecStart=/nix/var/nix/profiles/diigo-cache/bin/diigo-cache-serve -S http=3 -d cache-state=/var/lib/diigo-cache/cache -d webapp-state=/var/lib/diigo-cache/webapp
|
||||
DynamicUser=yes
|
||||
StateDirectory=diigo-cache diigo-cache/cache diigo-cache/webapp
|
||||
StateDirectoryMode=0700
|
||||
# webapp fetches diigo.com; nothing else needs the network
|
||||
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
|
||||
ProtectSystem=strict
|
||||
ProtectHome=yes
|
||||
PrivateTmp=yes
|
||||
PrivateDevices=yes
|
||||
ProtectKernelTunables=yes
|
||||
ProtectKernelModules=yes
|
||||
ProtectControlGroups=yes
|
||||
RestrictNamespaces=yes
|
||||
LockPersonality=yes
|
||||
CapabilityBoundingSet=
|
||||
SystemCallFilter=@system-service
|
||||
# V8 uses memory protection keys; without these, SIGSYS at startup
|
||||
SystemCallFilter=pkey_alloc pkey_mprotect pkey_free
|
||||
# not MemoryDenyWriteExecute: V8's JIT needs W+X
|
||||
Reference in new issue
Block a user