Skip to content

Commit

Permalink
dev: add improved example, change db directory
Browse files Browse the repository at this point in the history
  • Loading branch information
kamikazechaser committed May 27, 2024
1 parent 5d8dd60 commit fa89b48
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
tracker_db
db
.vscode
.idx
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ It applies deduplication at the NATS level, making it safe to run in a distribut
* NATS server
* Access to a Celo RPC node

See [docker-compose.yaml](dev/docker-compose.yaml) for an example on how to run a deploy a single instance.

### 1. Build the Docker image

We provide pre-built images for `linux/amd64`. See the packages tab on Github.
Expand All @@ -30,11 +32,7 @@ docker images

### 2. Run NATS

```bash
cd dev
docker compose up -d
docker ps
```
For an example, see `dev/docker-compose.nats.yaml`.

### 3. Update config values

Expand Down
9 changes: 9 additions & 0 deletions dev/docker-compose.nats.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
services:
nats:
image: nats:2
restart: unless-stopped
command: -js -sd /tmp/nats/data -m 8222
ports:
- 0.0.0.0:4222:4222
- 0.0.0.0:8222:8222

26 changes: 23 additions & 3 deletions dev/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,27 @@ services:
nats:
image: nats:2
restart: unless-stopped
command: -js -sd /tmp/nats/data -m 8222
command: -js -sd /nats/data -m 8222
ports:
- 0.0.0.0:4222:4222
- 0.0.0.0:8222:8222
- 127.0.0.1:4222:4222
- 127.0.0.1:8222:8222
volumes:
- celo-tracker-nats:/nats/data
celo-tracker:
image: celo-tracker:latest
restart: unless-stopped
depends_on:
- nats
environment:
- DEV=true
- TRACKER_JETSTREAM__ENDPOINT=nats://nats:4222
ports:
- 127.0.0.1:5001:5001
volumes:
- celo-tracker-db:/service/db

volumes:
celo-tracker-nats:
driver: local
celo-tracker-db:
driver: local
2 changes: 1 addition & 1 deletion internal/db/bolt.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type boltDB struct {
}

const (
dbFolderName = "tracker_db"
dbFolderName = "db/tracker_db"

upperBoundKey = "upper"
lowerBoundKey = "lower"
Expand Down

0 comments on commit fa89b48

Please sign in to comment.