Skip to content

Commit 69fdfca

Browse files
committed
build steps in readme + test_config
1 parent aa00234 commit 69fdfca

File tree

4 files changed

+117
-0
lines changed

4 files changed

+117
-0
lines changed

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,33 @@ go build -o main -tags=production
3333
# Default: http://localhost:3000
3434
```
3535

36+
### 🏃‍♂️ Quick Start with Hybrid Setup (PostgreSQL + ClickHouse)
37+
38+
For testing the staging flow with PostgreSQL for orchestration/staging and ClickHouse for main storage:
39+
40+
```bash
41+
# 1. Build the application
42+
go build -o insight .
43+
44+
# 2. Start databases (PostgreSQL + ClickHouse)
45+
docker compose up -d
46+
47+
# 3. Run the orchestrator with test configuration
48+
./insight orchestrator --config configs/test_config.yml
49+
50+
# 4. (Optional) Start the API server
51+
./insight api --config configs/test_config.yml
52+
53+
# 5. Monitor the databases
54+
# PostgreSQL (staging): docker exec insight-postgres-1 psql -U admin -d insight
55+
# ClickHouse (main): clickhouse-client --host localhost --port 9440 --user admin --password password
56+
```
57+
58+
**Database Connections:**
59+
- **PostgreSQL**: `localhost:5432` (staging & orchestrator storage)
60+
- **ClickHouse**: `localhost:9440` (main storage)
61+
- **Credentials**: `admin` / `password`
62+
3663
---
3764

3865
## 🏗 How It Works

configs/test_config.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
rpc:
2+
url: https://1.rpc.thirdweb.com
3+
chainId: "1"
4+
5+
log:
6+
level: debug
7+
prettify: true
8+
9+
poller:
10+
enabled: true
11+
interval: 2000
12+
blocksPerPoll: 100
13+
14+
committer:
15+
enabled: true
16+
interval: 2000
17+
blocksPerCommit: 100
18+
19+
storage:
20+
main:
21+
clickhouse:
22+
host: localhost
23+
port: 9440
24+
username: admin
25+
password: password
26+
database: default
27+
disableTLS: true
28+
asyncInsert: true
29+
maxRowsPerInsert: 1000
30+
maxOpenConns: 50
31+
maxIdleConns: 10
32+
33+
staging:
34+
postgres:
35+
host: localhost
36+
port: 5432
37+
username: admin
38+
password: password
39+
database: insight
40+
sslMode: disable
41+
maxOpenConns: 50
42+
maxIdleConns: 10
43+
maxConnLifetime: 300
44+
connectTimeout: 10
45+
46+
orchestrator:
47+
postgres:
48+
host: localhost
49+
port: 5432
50+
username: admin
51+
password: password
52+
database: insight
53+
sslMode: disable
54+
maxOpenConns: 50
55+
maxIdleConns: 10
56+
maxConnLifetime: 300
57+
connectTimeout: 10
58+
59+
api:
60+
host: localhost:3000
61+
basicAuth:
62+
username: admin
63+
password: admin
64+
65+
publisher:
66+
enabled: false
67+
68+
validation:
69+
mode: minimal
70+
71+
# Work mode configuration - Controls system behavior based on blockchain state
72+
workMode:
73+
# Interval in minutes to check if system should switch between live/historical mode
74+
checkIntervalMinutes: 10
75+
# Block number threshold to determine if system is in "live mode" (near chain head)
76+
# Setting this very high forces backfill mode for testing
77+
liveModeThreshold: 1000000

docker-compose.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,18 @@ services:
99
profiles:
1010
- redis
1111

12+
# PostgreSQL database
13+
postgres:
14+
image: postgres:15
15+
ports:
16+
- "5432:5432"
17+
environment:
18+
POSTGRES_DB: insight
19+
POSTGRES_USER: admin
20+
POSTGRES_PASSWORD: password
21+
volumes:
22+
- postgres_data:/var/lib/postgresql/data
23+
1224
# http://localhost:8123/play <- web ui
1325
clickhouse:
1426
image: clickhouse/clickhouse-server:latest
@@ -81,6 +93,7 @@ services:
8193

8294
volumes:
8395
redis_data:
96+
postgres_data:
8497
clickhouse_data:
8598
grafana_data:
8699

insight

100644100755
50.4 MB
Binary file not shown.

0 commit comments

Comments
 (0)