Monorepo for Tangled
at local-dev 61 lines 1.7 kB view raw
1# jetstream: AT Protocol event firehose proxy for local development. 2# 3# Subscribes to a PDS's com.atproto.sync.subscribeRepos and re-broadcasts 4# events over WebSocket in a simplified JSON format. 5# 6# Key env vars: 7# JETSTREAM_WS_URL — upstream ATProto firehose URL 8# JETSTREAM_LISTEN_ADDR — WebSocket listen address (default :6008) 9# JETSTREAM_DATA_DIR — PebbleDB cursor storage directory 10{ 11 lib, 12 buildGoModule, 13 fetchFromGitHub, 14}: 15buildGoModule { 16 pname = "jetstream"; 17 version = "0-unstable-2024-06-18"; 18 19 src = fetchFromGitHub { 20 owner = "bluesky-social"; 21 repo = "jetstream"; 22 rev = "a003f34cdb510c37d7245f0965814a6168243812"; 23 hash = "sha256-VMSOHTTLr+wFI0NQthGJvlj1oQkTlFSjWkfbRRLqM0A="; 24 }; 25 26 vendorHash = "sha256-UvJQ27BZ9Pri8zhY+T40qvH+g5ZInENQqSby+Z+lReg="; 27 28 proxyVendor = true; 29 30 subPackages = ["cmd/jetstream"]; 31 32 # CGO is needed for PebbleDB's zstd compression (DataDog/czstd) 33 env.CGO_ENABLED = 1; 34 35 # Disable the 15-second liveness checker that kills Jetstream when idle. 36 # It's designed for Docker (restart on crash) but we run natively. 37 # In local dev there may be long periods with no events. 38 postPatch = '' 39 substituteInPlace cmd/jetstream/main.go \ 40 --replace-fail 'close(livenessKill)' '// disabled for local-dev: close(livenessKill)' 41 ''; 42 43 # The go.sum needs updating for newer Go toolchains 44 overrideModAttrs = _: { 45 preBuild = '' 46 go mod tidy 47 ''; 48 }; 49 50 preBuild = '' 51 go mod tidy 52 ''; 53 54 meta = { 55 description = "AT Protocol event firehose proxy"; 56 homepage = "https://github.com/bluesky-social/jetstream"; 57 license = lib.licenses.mit; 58 platforms = lib.platforms.unix; 59 mainProgram = "jetstream"; 60 }; 61}