dev: add improved example, change db directory

This commit is contained in:
Mohamed Sohail 2024-05-27 18:29:48 +08:00
parent 5d8dd60dca
commit fa89b4822f
Signed by: kamikazechaser
GPG Key ID: 7DD45520C01CD85D
5 changed files with 37 additions and 9 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
tracker_db tracker_db
db
.vscode .vscode
.idx .idx

View File

@ -15,6 +15,8 @@ It applies deduplication at the NATS level, making it safe to run in a distribut
* NATS server * NATS server
* Access to a Celo RPC node * 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 ### 1. Build the Docker image
We provide pre-built images for `linux/amd64`. See the packages tab on Github. We provide pre-built images for `linux/amd64`. See the packages tab on Github.
@ -30,11 +32,7 @@ docker images
### 2. Run NATS ### 2. Run NATS
```bash For an example, see `dev/docker-compose.nats.yaml`.
cd dev
docker compose up -d
docker ps
```
### 3. Update config values ### 3. Update config values

View File

@ -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

View File

@ -2,7 +2,27 @@ services:
nats: nats:
image: nats:2 image: nats:2
restart: unless-stopped restart: unless-stopped
command: -js -sd /tmp/nats/data -m 8222 command: -js -sd /nats/data -m 8222
ports: ports:
- 0.0.0.0:4222:4222 - 127.0.0.1:4222:4222
- 0.0.0.0:8222:8222 - 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

View File

@ -14,7 +14,7 @@ type boltDB struct {
} }
const ( const (
dbFolderName = "tracker_db" dbFolderName = "db/tracker_db"
upperBoundKey = "upper" upperBoundKey = "upper"
lowerBoundKey = "lower" lowerBoundKey = "lower"