Constellation, Spacedust, Slingshot, UFOs: atproto crates and services for microcosm
1# UFOs 2 3_work in progress_ 4 5 6 7---- 8 9cross-compile for raspi 1: 10 11set up `cross` 12 13```bash 14# build and deploy 15 16cross build --release --target arm-unknown-linux-gnueabihf && scp ../target/arm-unknown-linux-gnueabihf/release/ufos angel-hair.local:ufos 17``` 18 19for bonilla (rp4) 20 21```bash 22cross build --release --target armv7-unknown-linux-gnueabihf && scp ../target/armv7-unknown-linux-gnueabihf/release/ufos pi@bonilla.local:ufos 23``` 24 25glibc will cause problems when switching between (`GLIBC_2.25` message). clean up (next build will be slowww) 26 27```bash 28cargo clean 29``` 30 31for bonilla but 64-bit? (rp4) 32```bash 33cross build --release --target aarch64-unknown-linux-gnu && scp ../target/aarch64-unknown-linux-gnu/release/ufos pi@bonilla.local:ufos 34# ^^ fails due to linker? 35 36cross build --release --target aarch64-unknown-linux-musl && scp ../target/aarch64-unknown-linux-musl/release/ufos pi@bonilla.local:ufos 37# seems to work 38 39rsync -avhP ufos-bff-rl/ pi@bonilla:/mnt/ufos-db/ 40 41RUST_LOG=info ./ufos --jetstream us-west-2 --data /mnt/ufos-db/ 42``` 43 44nginx forward proxy for websocket (run this on another host): 45 46```nginx 47 48 49worker_processes 2; 50 51pid nginx.pid; 52 53events { 54 worker_connections 2000; 55 56 # use [ kqueue | epoll | /dev/poll | select | poll ]; 57 # use kqueue; 58} 59 60http { 61 default_type application/octet-stream; 62 63 64 log_format main '$remote_addr - $remote_user [$time_local] ' 65 '"$request" $status $bytes_sent ' 66 '"$http_referer" "$http_user_agent" ' 67 '"$gzip_ratio"'; 68 69 log_format download '$remote_addr - $remote_user [$time_local] ' 70 '"$request" $status $bytes_sent ' 71 '"$http_referer" "$http_user_agent" ' 72 '"$http_range" "$sent_http_content_range"'; 73 74 client_header_timeout 3m; 75 client_body_timeout 3m; 76 send_timeout 3m; 77 78 client_header_buffer_size 1k; 79 large_client_header_buffers 4 4k; 80 81 gzip on; 82 gzip_min_length 1100; 83 gzip_buffers 4 8k; 84 gzip_types text/plain; 85 86 output_buffers 1 32k; 87 postpone_output 1460; 88 89 sendfile on; 90 tcp_nopush on; 91 tcp_nodelay on; 92 send_lowat 12000; 93 94 keepalive_timeout 75 20; 95 96 upstream websocket { 97 server jetstream2.us-west.bsky.network:443; 98 } 99 100 server { 101 listen 8080; 102 103 access_log /dev/null; 104 105 location / { 106 proxy_pass https://websocket; 107 proxy_http_version 1.1; 108 proxy_set_header Upgrade $http_upgrade; 109 proxy_set_header Connection "upgrade"; 110 } 111 } 112 113} 114``` 115 116running 117 118```bash 119RUST_LOG=info ./ufos --jetstream ws://192.168.1.139:8080/subscribe --jetstream-force --jetstream-no-zstd --data /mnt/ufos-data-blah/ 120``` 121 122try without info-level logs for better perf 123 124running on bonilla 125 126```bash 127./ufos --jetstream us-west-2 --jetstream-force --data /mnt/ufos-data-no-compression-2/ 128``` 129 130(reusing data dir from angel-hair) 131 132 133ipv6 is having some trouble. but also maybe there's a deadlock somewhere 134 135```bash 136sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1 137``` 138 139 140--- 141 142## fuzzing 143 144got bit by https://github.com/cloudflare/cardinality-estimator/pull/12, so now we have a fuzz target. 145 146install cargo-fuzz and then 147 148```bash 149RUSTFLAGS="-Z sanitizer=address" cargo +nightly fuzz run cardinality_estimator 150``` 151 152to fuzz the counts value things