···11+cozy-ucosm
22+33+44+## gateway
55+66+- tailscale (exit node enabled)
77+ -> allow ipv4 and ipv6 forwarding
88+- caddy
99+1010+ ```bash
1111+ apt install golang
1212+ go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest
1313+ go/bin/xcaddy build \
1414+ --with github.com/caddyserver/cache-handler \
1515+ --with github.com/darkweak/storages/badger/caddy \
1616+ --with github.com/mholt/caddy-ratelimit
1717+ # then https://caddyserver.com/docs/running#manual-installation
1818+1919+ mkdir /var/cache/caddy-badger
2020+ chown -R caddy:caddy /var/cache/caddy-badger/
2121+ ```
2222+2323+ - `/etc/caddy/Caddyfile`
2424+2525+ ```
2626+ {
2727+ cache {
2828+ badger
2929+ api {
3030+ prometheus
3131+ }
3232+ }
3333+ }
3434+3535+ links.bsky.bad-example.com {
3636+ reverse_proxy link-aggregator:6789
3737+ respond /souin-api/metrics "denied" 403
3838+ cache {
3939+ ttl 3s
4040+ stale 1h
4141+ default_cache_control public, s-maxage=3
4242+ badger {
4343+ path /var/cache/caddy-badger/links
4444+ }
4545+ }
4646+ }
4747+4848+ gateway:80 {
4949+ metrics
5050+ cache
5151+ }
5252+ ```
5353+5454+5555+- victoriametrics
5656+5757+ ```bash
5858+ curl -LO https://github.com/VictoriaMetrics/VictoriaMetrics/releases/download/v1.109.1/victoria-metrics-linux-amd64-v1.109.1.tar.gz
5959+ tar xzf victoria-metrics-linux-amd64-v1.109.1.tar.gz
6060+ # and then https://docs.victoriametrics.com/quick-start/#starting-vm-single-from-a-binary
6161+ sudo mkdir /etc/victoria-metrics && sudo chown -R victoriametrics:victoriametrics /etc/victoria-metrics
6262+6363+ ```
6464+6565+ - `/etc/victoria-metrics/prometheus.yml`
6666+6767+ ```yaml
6868+global:
6969+ scrape_interval: '15s'
7070+7171+scrape_configs:
7272+ - job_name: 'link_aggregator'
7373+ static_configs:
7474+ - targets: ['link-aggregator:8765']
7575+ - job_name: 'gateway:caddy'
7676+ static_configs:
7777+ - targets: ['gateway:80/metrics']
7878+ - job_name: 'gateway:cache'
7979+ static_configs:
8080+ - targets: ['gateway:80/souin-api/metrics']
8181+ ```
8282+8383+ - `ExecStart` in `/etc/systemd/system/victoriametrics.service`:
8484+8585+ ```
8686+ ExecStart=/usr/local/bin/victoria-metrics-prod -storageDataPath=/var/lib/victoria-metrics -retentionPeriod=90d -selfScrapeInterval=1m -promscrape.config=/etc/victoria-metrics/prometheus.yml
8787+ ```
8888+8989+- grafana
9090+9191+ followed `https://grafana.com/docs/grafana/latest/setup-grafana/installation/debian/#install-grafana-on-debian-or-ubuntu`
9292+9393+ something something something then
9494+9595+ ```
9696+ sudo grafana-cli --pluginUrl https://github.com/VictoriaMetrics/victoriametrics-datasource/releases/download/v0.11.1/victoriametrics-datasource-v0.11.1.zip plugins install victoriametrics
9797+ ```
9898+9999+100100+101101+---
102102+103103+some todos
104104+105105+- [x] tailscale: exit node
106106+ - [!] link_aggregator: use exit node
107107+ -> worked, but reverted for now: tailscale on raspi was consuming ~50% cpu for the jetstream traffic. this might be near its max since it would have been catching up at the time (max jetstream throughput) but it feels a bit too much. we have to trust the jetstream server and link_aggregator doesn't (yet) make any other external connections, so for now the raspi connects directly from my home again.
108108+- [x] caddy: reverse proxy
109109+ - [x] build with cache and rate-limit plugins
110110+ - [x] configure systemd to keep it alive
111111+- [ ] configure caddy cache
112112+- [ ] configure caddy rate-limit
113113+- [ ] configure caddy to use a health check (once it's added)
114114+- [ ] configure caddy to only expose cache metrics to tailnet :/
115115+- [ ] make some grafana dashboards
116116+
+3
link_aggregator/readme.md
···106106- [ ] tokio metrics?
107107- [x] handle shutdown cleanly -- be nice to rocksdb
108108- [x] add user-agent to jetstream request
109109+- [ ] wow the shutdown stuff i wrote is really bad and doesn't work a lot
110110+- [ ] serve html for browser requests
111111+- [ ] add a health check endpoint
109112110113data fixes
111114- [ ] add rkey to linkers 🤦♀️