You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chore: update compose stacks and shared networking
- Upgrade PostgreSQL 16 -> 17
- Upgrade CockroachDB v22.2.2 -> v22.2.15
- Upgrade substrate-gateway 2.5.0 -> 2.7.0
- Rename indexer CockroachDB service from 'db' to 'cockroachdb' to
avoid DNS collision when both stacks share a Docker network
- Add shared external network 'tfgrid_bknd' to both compose files so
the processor can reach the indexer gateway by service name
- Update INDEXER_ENDPOINT_URL default to http://gateway:8000/graphql
(Docker service name) instead of localhost:8888 (host port mapping)
- Remove obsolete 'version' field from both compose files
- Update production docs with shared network setup and env var changes
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: docs/development.md
+17-1Lines changed: 17 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,14 @@ yarn build
13
13
14
14
See https://github.com/threefoldtech/tfchain
15
15
16
+
### Create the shared Docker network
17
+
18
+
Both compose stacks use a shared external network. Create it once:
19
+
20
+
```bash
21
+
docker network create tfgrid_bknd
22
+
```
23
+
16
24
### Run Indexer
17
25
18
26
Check `indexer/.env` and adjust the websocket endpoint to your local TFChain address.
@@ -34,7 +42,15 @@ You should see TFChain blocks being processed:
34
42
35
43
### Run Processor (local, outside Docker)
36
44
37
-
Check `.env` and adjust the websocket endpoint and indexer URL to your local setup.
45
+
Check `.env` and adjust the settings. When running the processor locally (not in Docker) while the indexer runs in Docker, change `INDEXER_ENDPOINT_URL` to use the published port:
46
+
47
+
```bash
48
+
# .env — for local development (processor outside Docker):
Copy file name to clipboardExpand all lines: docs/production.md
+34-2Lines changed: 34 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,8 +15,40 @@ The production stack has two independent layers:
15
15
16
16
## Run the Setup
17
17
18
+
Both compose stacks share a Docker network (`tfgrid_bknd`) so the processor can reach the indexer gateway by service name. Create it before starting either stack:
19
+
20
+
```bash
21
+
docker network create tfgrid_bknd
22
+
```
23
+
18
24
### 1. Indexer
19
25
26
+
#### Using a snapshot (recommended)
27
+
28
+
Download a pre-built CockroachDB snapshot to avoid syncing from scratch (which takes days):
29
+
30
+
```bash
31
+
# Check https://bknd.snapshot.grid.tf/ for latest snapshots per network
32
+
wget -O snapshot.tar.gz <snapshot_url>
33
+
34
+
# Extract — do NOT use --strip-components
35
+
# (SST files are at root level; --strip-components silently skips them all)
36
+
mkdir -p /path/to/cockroach-data
37
+
tar -xzf snapshot.tar.gz -C /path/to/cockroach-data/
|`WS_URL`| TFChain node WebSocket URL (used for RPC calls) |`ws://localhost:9944`|
76
+
| `INDEXER_ENDPOINT_URL` | Indexer GraphQL gateway URL. Use `http://gateway:8000/graphql` for Docker (shared network), `http://localhost:8888/graphql` for local dev | `http://gateway:8000/graphql` |
Copy file name to clipboardExpand all lines: indexer/readme.md
+25-3Lines changed: 25 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,13 @@
1
1
# Setting Up an Indexer
2
2
3
+
## Prerequisites
4
+
5
+
Both the indexer and processor compose stacks share a Docker network. Create it before starting:
6
+
7
+
```bash
8
+
docker network create tfgrid_bknd
9
+
```
10
+
3
11
## Configuration
4
12
5
13
The `.env` file contains the indexer options:
@@ -18,23 +26,37 @@ START_HEIGHT=0
18
26
19
27
Start the indexer stack:
20
28
21
-
```
29
+
```bash
22
30
docker compose up -d
23
31
```
24
32
25
33
Stop:
26
34
27
-
```
35
+
```bash
28
36
docker compose down
29
37
```
30
38
31
39
### Stack Components
32
40
33
41
| Container | Image | Role |
34
42
|-----------|-------|------|
35
-
|db|`cockroachdb/cockroach`| Database for storing raw indexed block data |
43
+
|cockroachdb|`cockroachdb/cockroach`| Database for storing raw indexed block data |
36
44
| ingest |`subsquid/substrate-ingest`| Connects to the TFChain node and ingests blocks into the database |
37
45
| gateway |`subsquid/substrate-gateway`| GraphQL gateway over ingested data — the processor queries this |
38
46
| explorer |`subsquid/substrate-explorer`| Web UI to browse raw ingested data and check sync status |
39
47
48
+
### CockroachDB Memory Tuning
49
+
50
+
By default, CockroachDB uses up to 25% of system RAM for cache and SQL memory. On VMs with limited RAM (4 GB or less), this can cause OOM. Add `--cache` and `--max-sql-memory` flags to the compose command to control usage:
If you see `memory budget exceeded` errors from the gateway or explorer, increase `--max-sql-memory`.
61
+
40
62
**Note on CockroachDB:** The `--insecure` flag is used for non-production/testing only. For production, use a secure cluster. See [CockroachDB docs](https://www.cockroachlabs.com/docs/stable/deploy-cockroachdb-on-premises-insecure).
0 commit comments