Skip to content

Commit 74676cc

Browse files
authored
prototype: Add debug UI for bundlestore and S3 (#5)
* Add debug UI * Update GHA * Fixes * Add missing envvars
1 parent 57ef10c commit 74676cc

File tree

28 files changed

+3395
-5
lines changed

28 files changed

+3395
-5
lines changed

.env.example

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,13 @@ TIPS_MAINTENANCE_RPC_NODE=http://localhost:2222
2626
TIPS_MAINTENANCE_KAFKA_BROKERS=localhost:9092
2727
TIPS_MAINTENANCE_KAFKA_TOPIC=tips-audit
2828
TIPS_MAINTENANCE_POLL_INTERVAL_MS=250
29-
TIPS_MAINTENANCE_LOG_LEVEL=info
29+
TIPS_MAINTENANCE_LOG_LEVEL=info
30+
31+
# TIPS UI
32+
TIPS_DATABASE_URL=postgresql://postgres:postgres@localhost:5432/postgres
33+
TIPS_UI_AWS_REGION=us-east-1
34+
TIPS_UI_S3_BUCKET_NAME=tips
35+
TIPS_UI_S3_CONFIG_TYPE=manual
36+
TIPS_UI_S3_ENDPOINT=http://localhost:7000
37+
TIPS_UI_S3_ACCESS_KEY_ID=minioadmin
38+
TIPS_UI_S3_SECRET_ACCESS_KEY=minioadmin
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
name: CI
1+
name: Rust
2+
permissions:
3+
contents: read
24

35
on:
46
push:

.github/workflows/ui.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: UI
2+
permissions:
3+
contents: read
4+
5+
on:
6+
push:
7+
branches: [ master ]
8+
paths: ['ui/**']
9+
pull_request:
10+
branches: [ master ]
11+
paths: ['ui/**']
12+
13+
jobs:
14+
lint:
15+
name: Lint
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- uses: actions/setup-node@v4
20+
with:
21+
node-version: '20'
22+
cache: 'yarn'
23+
cache-dependency-path: ui/yarn.lock
24+
- run: cp .env.example ui/.env
25+
- run: cd ui && yarn install
26+
- run: cd ui && yarn lint
27+
28+
type-check:
29+
name: Type Check
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@v4
33+
- uses: actions/setup-node@v4
34+
with:
35+
node-version: '20'
36+
cache: 'yarn'
37+
cache-dependency-path: ui/yarn.lock
38+
- run: cp .env.example ui/.env
39+
- run: cd ui && yarn install
40+
- run: cd ui && npx tsc --noEmit
41+
42+
build:
43+
name: Build
44+
runs-on: ubuntu-latest
45+
steps:
46+
- uses: actions/checkout@v4
47+
- uses: actions/setup-node@v4
48+
with:
49+
node-version: '20'
50+
cache: 'yarn'
51+
cache-dependency-path: ui/yarn.lock
52+
- run: cp .env.example ui/.env
53+
- run: cd ui && yarn install
54+
- run: cd ui && yarn build

.gitignore

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Rust
22
/target/
33

4+
# NextJS
5+
/ui/.next
6+
/ui/node_modules
7+
48
# Local Dev
59
/data/
610

@@ -14,4 +18,8 @@ Thumbs.db
1418

1519
# Environment variables
1620
.env
17-
.env.local
21+
/ui/.env
22+
23+
# Claude
24+
/.claude
25+
/ui/.claude

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,6 @@ The main entry point that provides a JSON-RPC API for receiving transactions and
2424

2525
### 🔨 Maintenance (`crates/maintenance`)
2626
A service that maintains the health of the TIPS DataStore, by removing stale or included bundles.
27+
28+
### 🖥️ UI (`ui`)
29+
A debug UI for viewing the state of the bundle store and S3.

justfile

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,34 @@
11
### DEVELOPMENT COMMANDS ###
22
ci:
3+
# Rust
34
cargo fmt --all -- --check
45
cargo clippy -- -D warnings
56
cargo build
67
cargo test
8+
# UI
9+
cd ui && npm run lint
10+
cd ui && npm run build
711

812
fix:
13+
# Rust
914
cargo fmt --all
1015
cargo clippy --fix --allow-dirty --allow-staged
16+
# UI
17+
cd ui && npx biome check --fix
1118

1219
create-migration name:
1320
touch crates/datastore/migrations/$(date +%s)_{{ name }}.sql
1421

15-
sync:
22+
sync: deps-reset
1623
### DATABASE ###
1724
cargo sqlx prepare -D postgresql://postgres:postgres@localhost:5432/postgres --workspace --all --no-dotenv
25+
cd ui && npx drizzle-kit pull --dialect=postgresql --url=postgresql://postgres:postgres@localhost:5432/postgres
26+
cd ui && mv ./drizzle/relations.ts ./src/db/
27+
cd ui && mv ./drizzle/schema.ts ./src/db/
28+
cd ui && rm -rf ./drizzle
1829
### ENV ###
1930
cp .env.example .env
31+
cp .env.example ./ui/.env
2032

2133
### RUN SERVICES ###
2234
deps-reset:
@@ -32,4 +44,7 @@ ingress:
3244
cargo run --bin tips-ingress
3345

3446
maintenance:
35-
cargo run --bin tips-maintenance
47+
cargo run --bin tips-maintenance
48+
49+
ui:
50+
cd ui && yarn dev

ui/.gitignore

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.*
7+
.yarn/*
8+
!.yarn/patches
9+
!.yarn/plugins
10+
!.yarn/releases
11+
!.yarn/versions
12+
13+
# testing
14+
/coverage
15+
16+
# next.js
17+
/.next/
18+
/out/
19+
20+
# production
21+
/build
22+
23+
# misc
24+
.DS_Store
25+
*.pem
26+
27+
# debug
28+
npm-debug.log*
29+
yarn-debug.log*
30+
yarn-error.log*
31+
.pnpm-debug.log*
32+
33+
# env files (can opt-in for committing if needed)
34+
.env*
35+
36+
# vercel
37+
.vercel
38+
39+
# typescript
40+
*.tsbuildinfo
41+
next-env.d.ts

ui/biome.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/2.2.0/schema.json",
3+
"vcs": {
4+
"enabled": true,
5+
"clientKind": "git",
6+
"useIgnoreFile": true
7+
},
8+
"files": {
9+
"ignoreUnknown": true,
10+
"includes": ["**", "!node_modules", "!.next", "!dist", "!build"]
11+
},
12+
"formatter": {
13+
"enabled": true,
14+
"indentStyle": "space",
15+
"indentWidth": 2
16+
},
17+
"linter": {
18+
"enabled": true,
19+
"rules": {
20+
"recommended": true,
21+
"suspicious": {
22+
"noUnknownAtRules": "off"
23+
}
24+
},
25+
"domains": {
26+
"next": "recommended",
27+
"react": "recommended"
28+
}
29+
},
30+
"assist": {
31+
"actions": {
32+
"source": {
33+
"organizeImports": "on"
34+
}
35+
}
36+
}
37+
}

ui/drizzle.config.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { defineConfig } from "drizzle-kit";
2+
3+
export default defineConfig({
4+
schema: "./src/db/schema.ts",
5+
out: "./drizzle",
6+
dialect: "postgresql",
7+
dbCredentials: {
8+
url:
9+
process.env.TIPS_DATABASE_URL ||
10+
"postgresql://postgres:postgres@localhost:5432/postgres",
11+
},
12+
});

ui/next.config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import type { NextConfig } from "next";
2+
3+
const nextConfig: NextConfig = {
4+
/* config options here */
5+
};
6+
7+
export default nextConfig;

0 commit comments

Comments
 (0)