Compare commits

...

2 commits

Author SHA1 Message Date
099af0b9ce add relay and jetstream ngx configs 2024-11-27 04:06:11 +00:00
55895e63c6 add jetstream service 2024-11-27 04:00:54 +00:00
9 changed files with 101 additions and 0 deletions

3
.gitmodules vendored
View file

@ -1,3 +1,6 @@
[submodule "relay"]
path = relay
url = https://git.lavender.software/cerulea/relay.git
[submodule "jetstream/src"]
path = jetstream/src
url = https://github.com/bluesky-social/jetstream.git

1
jetstream/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/data

23
jetstream/flake.lock Normal file
View file

@ -0,0 +1,23 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 0,
"narHash": "sha256-df3dJApLPhd11AlueuoN0Q4fHo/hagP75LlM5K1sz9g=",
"path": "/nix/store/ly4s3hw35dd1c2vsd694y2715pc1d2c1-source",
"type": "path"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

14
jetstream/flake.nix Normal file
View file

@ -0,0 +1,14 @@
{
description = "jetstream";
outputs = { self, nixpkgs }: let
pkgs = import nixpkgs { system = "x86_64-linux"; };
in {
devShells."x86_64-linux".default = pkgs.mkShell {
buildInputs = [
pkgs.go
pkgs.stdenv
];
};
};
}

3
jetstream/run.sh Executable file
View file

@ -0,0 +1,3 @@
#!/usr/bin/env bash
./src/jetstream --ws-url 'ws://127.0.0.1:3000/xrpc/com.atproto.sync.subscribeRepos' --liveness-ttl 10000m --listen-addr "127.0.0.1:6008" --metrics-listen-addr "127.0.0.1:6009"

1
jetstream/src Submodule

@ -0,0 +1 @@
Subproject commit 0ab10bd041fe1fdf682d3964b20d944905c4862d

View file

@ -2,3 +2,5 @@
mkdir out 2>/dev/null || true
deno run ./default.ts > out/default.conf
deno run ./relay.ts > out/relay.conf
deno run ./jetstream.ts > out/jetstream.conf

27
ngx/jetstream.ts Normal file
View file

@ -0,0 +1,27 @@
import ngx from "jsr:@char/ngx@0.2";
export const config = ngx("", [
ngx("map $http_upgrade $connection_upgrade", [
"default upgrade",
"'' close"
]),
[],
ngx("server", [
[
ngx.serverName("jetstream.cerulea.blue"),
ngx.listen(),
ngx.letsEncrypt("jetstream.cerulea.blue"),
],
ngx("location /", [
"client_max_body_size 100M",
"proxy_pass http://127.0.0.1:6008",
"proxy_http_version 1.1",
"proxy_set_header Upgrade $http_upgrade",
"proxy_set_header Connection $connection_upgrade",
"proxy_set_header Host $host",
"proxy_read_timeout 300s",
]),
]),
]);
if (import.meta.main) console.log(config.build());

27
ngx/relay.ts Normal file
View file

@ -0,0 +1,27 @@
import ngx from "jsr:@char/ngx@0.2";
export const config = ngx("", [
ngx("map $http_upgrade $connection_upgrade", [
"default upgrade",
"'' close"
]),
[],
ngx("server", [
[
ngx.serverName("relay.cerulea.blue"),
ngx.listen(),
ngx.letsEncrypt("relay.cerulea.blue"),
],
ngx("location /", [
"client_max_body_size 1G",
"proxy_pass http://127.0.0.1:3000",
"proxy_http_version 1.1",
"proxy_set_header Upgrade $http_upgrade",
"proxy_set_header Connection $connection_upgrade",
"proxy_set_header Host $host",
"proxy_read_timeout 300s",
]),
]),
]);
if (import.meta.main) console.log(config.build());