tangled
alpha
login
or
join now
aleeve.dev
/
ott
2
fork
atom
Scalable and distributed custom feed generator, ott - on that topic
2
fork
atom
overview
issues
pulls
pipelines
Small adjustments towards working MVP
aleeve.dev
4 months ago
b3b6e0d5
6c15e6be
+23
-18
5 changed files
expand all
collapse all
unified
split
crates
ott-xrpc
src
main.rs
helm
ott
templates
cloudflared_tunnel.yaml
pg_cluster.yaml
pg_migration.yaml
values.yaml
+14
-6
crates/ott-xrpc/src/main.rs
···
18
use ott_xrpc::{bsky::BskyClient, key::generate_key};
19
20
use tracing::info;
0
21
22
async fn handler(
23
ExtractServiceAuth(auth): ExtractServiceAuth,
···
43
44
#[tokio::main]
45
async fn main() {
0
0
0
0
0
0
46
let did_str = "did:web:ott.aleeve.dev";
47
let did = Did::new_static(did_str);
48
49
let verification_method = VerificationMethod {
50
-
id: "{did}#atproto".into(),
51
-
r#type: "Mutlikeybase".into(),
52
controller: Some("did:web:ott.aleeve.dev".into()),
53
public_key_multibase: Some(generate_key().into()),
54
extra_data: BTreeMap::default(),
55
};
56
57
let service = Service {
58
-
id: "".into(),
59
-
service_endpoint: Some("".into()),
60
-
r#type: "".into(),
61
extra_data: BTreeMap::default(),
62
};
63
···
78
.with_state(config)
79
.merge(did_web_router(did_doc));
80
81
-
let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap();
0
82
axum::serve(listener, app).await.unwrap();
83
}
···
18
use ott_xrpc::{bsky::BskyClient, key::generate_key};
19
20
use tracing::info;
21
+
use tracing_subscriber::EnvFilter;
22
23
async fn handler(
24
ExtractServiceAuth(auth): ExtractServiceAuth,
···
44
45
#[tokio::main]
46
async fn main() {
47
+
tracing_subscriber::fmt()
48
+
.with_ansi(true) // Colors enabled (default)
49
+
.with_max_level(tracing::Level::INFO)
50
+
.init();
51
+
52
+
info!("Setup");
53
let did_str = "did:web:ott.aleeve.dev";
54
let did = Did::new_static(did_str);
55
56
let verification_method = VerificationMethod {
57
+
id: format!("{}#atproto", did_str).into(),
58
+
r#type: "Mutlikey".into(),
59
controller: Some("did:web:ott.aleeve.dev".into()),
60
public_key_multibase: Some(generate_key().into()),
61
extra_data: BTreeMap::default(),
62
};
63
64
let service = Service {
65
+
id: "#bsky_fg".into(),
66
+
service_endpoint: Some("https://ott.aleeve.dev/".into()),
67
+
r#type: "BskyFeedGenerator".into(),
68
extra_data: BTreeMap::default(),
69
};
70
···
85
.with_state(config)
86
.merge(did_web_router(did_doc));
87
88
+
let listener = tokio::net::TcpListener::bind("0.0.0.0:8080").await.unwrap();
89
+
info!("Starting service");
90
axum::serve(listener, app).await.unwrap();
91
}
+1
-1
helm/ott/templates/cloudflared_tunnel.yaml
···
1
-
{{- if .Values.cloudflare.enabled }}
2
apiVersion: v1
3
kind: Secret
4
metadata:
···
1
+
{{- if .Values.cloudflared.enabled }}
2
apiVersion: v1
3
kind: Secret
4
metadata:
+2
helm/ott/templates/pg_cluster.yaml
···
9
size: 10Gi
10
enableSuperuserAccess: true
11
postgresql:
0
0
12
shared_preload_libraries:
13
- pg_cron
···
9
size: 10Gi
10
enableSuperuserAccess: true
11
postgresql:
12
+
parameters:
13
+
cron.database_name: "app"
14
shared_preload_libraries:
15
- pg_cron
+2
-7
helm/ott/templates/pg_migration.yaml
···
28
key: password
29
- name: DATABASE_URL
30
value: "postgres://$(DATABASE_USER):$(DATABASE_PASSWORD)@postgres-rw.default.svc.cluster.local:5432/app"
31
-
- name: POSTGRES_URL
32
-
value: "postgres://$(DATABASE_USER):$(DATABASE_PASSWORD)@postgres-rw.default.svc.cluster.local:5432/postgres"
33
command:
34
- /bin/sh
35
- -c
36
- |
37
echo "Waiting for database to be ready..."
38
-
for i in {1..30}; do
39
-
if pg_isready -h $DATABASE_URL; then
40
echo "Database is ready!"
41
break
42
fi
43
echo "Attempt $i/30: Database not ready yet, waiting..."
44
sleep 10
45
done
46
-
47
-
echo "Making sure extensions are installed"
48
-
psql "$POSTGRES_URL" -c "CREATE EXTENSION IF NOT EXISTS pg_cron;"
49
50
echo "Setting up migration"
51
./app
···
28
key: password
29
- name: DATABASE_URL
30
value: "postgres://$(DATABASE_USER):$(DATABASE_PASSWORD)@postgres-rw.default.svc.cluster.local:5432/app"
0
0
31
command:
32
- /bin/sh
33
- -c
34
- |
35
echo "Waiting for database to be ready..."
36
+
for i in $(seq 1 30); do
37
+
if pg_isready -d $DATABASE_URL; then
38
echo "Database is ready!"
39
break
40
fi
41
echo "Attempt $i/30: Database not ready yet, waiting..."
42
sleep 10
43
done
0
0
0
44
45
echo "Setting up migration"
46
./app
+4
-4
helm/ott/values.yaml
···
4
5
cloudflared:
6
enabled: true
7
-
token: {}
8
9
app_auth:
10
-
did: {}
11
-
key: {}
12
13
services:
14
likes_connector:
···
65
valueFrom:
66
secretKeyRef:
67
name: app-auth
68
-
key: KEY
···
4
5
cloudflared:
6
enabled: true
7
+
token: null
8
9
app_auth:
10
+
did: null
11
+
key: null
12
13
services:
14
likes_connector:
···
65
valueFrom:
66
secretKeyRef:
67
name: app-auth
68
+
key: key