Skip to content

Commit 058d1a2

Browse files
committed
deploy stuff
1 parent b683ddc commit 058d1a2

File tree

5 files changed

+123
-51
lines changed

5 files changed

+123
-51
lines changed

.env.example

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Docker Compose runtime environment
2+
# Copy to .env.prod and fill in values for production deployment
3+
4+
# Registry hostname (used to pull images)
5+
REGISTRY_HOST=booskie-box.coin-aldebaran.ts.net
6+
7+
# ClickHouse connection (indexer)
8+
CLICKHOUSE_URL=https://your-clickhouse-host:8443
9+
CLICKHOUSE_DATABASE=weaver
10+
CLICKHOUSE_USER=default
11+
CLICKHOUSE_PASSWORD=your-password-here

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
/alloy
88
.direnv
99
.env
10+
.env.prod
1011
.devenv
1112
CLAUDE.md
1213
AGENTS.md

Dockerfile

Lines changed: 0 additions & 36 deletions
This file was deleted.

crates/weaver-app/Dockerfile

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Build stage with cargo-chef for dependency caching
2+
FROM rust:1-trixie AS chef
3+
# Pin nightly version for reproducibility
4+
RUN rustup default nightly-2025-12-04 && rustup component add rust-src --toolchain nightly-2025-12-04
5+
RUN cargo install cargo-chef
6+
WORKDIR /app
7+
8+
FROM chef AS planner
9+
COPY . .
10+
RUN cargo chef prepare --recipe-path recipe.json
11+
12+
FROM chef AS builder
13+
14+
# Install build dependencies
15+
RUN apt-get update && apt-get install -y \
16+
pkg-config \
17+
libssl-dev \
18+
&& rm -rf /var/lib/apt/lists/*
19+
20+
# Install wasm target and tools
21+
RUN rustup target add wasm32-unknown-unknown
22+
RUN cargo install wasm-bindgen-cli
23+
24+
# Install dioxus-cli
25+
RUN curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
26+
RUN cargo binstall dioxus-cli --root /usr/local -y --force
27+
28+
# Cook dependencies first (cached layer)
29+
COPY --from=planner /app/recipe.json recipe.json
30+
RUN cargo chef cook --release --recipe-path recipe.json
31+
32+
# Copy source code
33+
COPY . .
34+
35+
# Use production env for build-time constants
36+
RUN cp crates/weaver-app/.env-prod crates/weaver-app/.env
37+
38+
# Build wasm workers
39+
RUN RUSTFLAGS='--cfg getrandom_backend="wasm_js"' cargo build -p weaver-app --bin editor_worker --bin embed_worker \
40+
--target wasm32-unknown-unknown --release \
41+
--no-default-features --features "web"
42+
43+
# Run wasm-bindgen on workers
44+
RUN wasm-bindgen target/wasm32-unknown-unknown/release/editor_worker.wasm \
45+
--out-dir crates/weaver-app/public \
46+
--target no-modules \
47+
--no-typescript
48+
RUN wasm-bindgen target/wasm32-unknown-unknown/release/embed_worker.wasm \
49+
--out-dir crates/weaver-app/public \
50+
--target no-modules \
51+
--no-typescript
52+
53+
# Bundle the app
54+
RUN dx bundle --release --debug-symbols false -p weaver-app
55+
56+
# Runtime stage
57+
FROM debian:bookworm-slim
58+
59+
RUN apt-get update && apt-get install -y \
60+
ca-certificates \
61+
libssl3 \
62+
&& rm -rf /var/lib/apt/lists/*
63+
64+
WORKDIR /app
65+
66+
# Copy the bundled app
67+
COPY --from=builder /app/target/dx/weaver-app/release/web/ /app/
68+
69+
ENV PORT=8080
70+
ENV IP=0.0.0.0
71+
72+
EXPOSE 8080
73+
74+
ENTRYPOINT ["/app/weaver-app"]

docker-compose.yml

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
services:
2+
# Docker registry for local image hosting
3+
registry:
4+
image: registry:2
5+
container_name: weaver-registry
6+
ports:
7+
- "5000:5000"
8+
volumes:
9+
- registry_data:/var/lib/registry
10+
restart: unless-stopped
11+
212
# Tap - AT Protocol sync utility
3-
# Build from local indigo checkout, or use pre-built image
413
tap:
514
container_name: weaver-tap
615
image: ghcr.io/bluesky-social/indigo/tap:latest
@@ -13,49 +22,62 @@ services:
1322
TAP_BIND: ":2480"
1423
TAP_DISABLE_ACKS: "false"
1524
TAP_LOG_LEVEL: info
16-
# Filter to weaver collections only
17-
#TAP_SIGNAL_COLLECTION: sh.weaver.edit.root
1825
TAP_SIGNAL_COLLECTION: sh.tangled.actor.profile
1926
TAP_COLLECTION_FILTERS: "sh.weaver.*,app.bsky.actor.profile,sh.tangled.*,pub.leaflet.*"
2027
healthcheck:
2128
test: ["CMD", "wget", "-q", "--spider", "http://localhost:2480/health"]
2229
interval: 20s
2330
timeout: 5s
2431
retries: 3
32+
restart: unless-stopped
2533

26-
# Weaver indexer - consumes from tap or direct firehose
34+
# Weaver indexer - consumes from tap
2735
indexer:
2836
container_name: weaver-indexer
29-
build:
30-
context: .
31-
dockerfile: crates/weaver-index/Dockerfile
32-
command: ["run"]
37+
image: ${REGISTRY_HOST:-localhost}:5000/weaver-index:latest
3338
ports:
3439
- "3000:3000"
3540
environment:
36-
RUST_LOG: debug,weaver_index=debug,hyper_util::client::legacy::pool=info
37-
# ClickHouse connection (set these for your cloud/homelab instance)
41+
RUST_LOG: info,weaver_index=debug,hyper_util::client::legacy::pool=info
3842
CLICKHOUSE_URL: ${CLICKHOUSE_URL}
3943
CLICKHOUSE_DATABASE: ${CLICKHOUSE_DATABASE:-weaver}
4044
CLICKHOUSE_USER: ${CLICKHOUSE_USER}
4145
CLICKHOUSE_PASSWORD: ${CLICKHOUSE_PASSWORD}
42-
# Source mode: "firehose" or "tap"
4346
INDEXER_SOURCE: tap
44-
# Tap connection (when INDEXER_SOURCE=tap)
4547
TAP_URL: ws://tap:2480/channel
4648
TAP_SEND_ACKS: "true"
47-
# Firehose connection (when INDEXER_SOURCE=firehose)
4849
FIREHOSE_RELAY_URL: wss://bsky.network
49-
# Collection filters
5050
INDEXER_COLLECTIONS: "sh.weaver.*,app.bsky.actor.profile,sh.tangled.*,pub.leaflet.*"
5151
depends_on:
5252
tap:
5353
condition: service_healthy
5454
healthcheck:
55-
test: ["CMD", "wget", "-q", "--spider", "http://localhost:2480/xrpc/_health"]
55+
test: ["CMD", "wget", "-q", "--spider", "http://localhost:3000/xrpc/_health"]
56+
interval: 20s
57+
timeout: 5s
58+
retries: 3
59+
restart: unless-stopped
60+
61+
# Weaver app - web frontend
62+
weaver-app:
63+
container_name: weaver-app
64+
image: ${REGISTRY_HOST:-localhost}:5000/weaver-app:latest
65+
ports:
66+
- "8080:8080"
67+
environment:
68+
PORT: 8080
69+
IP: 0.0.0.0
70+
RUST_LOG: info
71+
depends_on:
72+
indexer:
73+
condition: service_healthy
74+
healthcheck:
75+
test: ["CMD", "wget", "-q", "--spider", "http://localhost:8080/"]
5676
interval: 20s
5777
timeout: 5s
5878
retries: 3
79+
restart: unless-stopped
5980

6081
volumes:
82+
registry_data:
6183
tap_data:

0 commit comments

Comments
 (0)