Skip to content

Commit

Permalink
Merge pull request #78 from Layr-Labs/sm-dockerCompose
Browse files Browse the repository at this point in the history
Add docker-compose file
  • Loading branch information
seanmcgary authored Oct 31, 2024
2 parents 043975f + 02bf877 commit de331b1
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 2 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ sidecar.db*
/sqlite*
go-sidecar
!/sqlite-extensions
/internal/tests/testdata
23 changes: 21 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ _Assumes you have PosgresSQL running locally already_
```bash
docker run -it --rm \
-e SIDECAR_DEBUG=false \
-e SIDECAR_ETHEREUM_RPC_BASE_URL="http://34.229.43.36:8545" \
-e SIDECAR_ETHEREUM_RPC_URL="http://34.229.43.36:8545" \
-e SIDECAR_CHAIN="holesky" \
-e SIDECAR_STATSD_URL="localhost:8125" \
-e SIDECAR_DATABASE_HOST="localhost" \
Expand All @@ -179,7 +179,7 @@ make docker-buildx-self
docker run \
-e "SIDECAR_DEBUG=false" \
-e "SIDECAR_ETHEREUM_RPC_BASE_URL=http://34.229.43.36:8545" \
-e "SIDECAR_ETHEREUM_RPC_URL=http://34.229.43.36:8545" \
-e "SIDECAR_CHAIN=holesky" \
-e "SIDECAR_STATSD_URL=localhost:8125" \
-e SIDECAR_DATABASE_HOST="localhost" \
Expand All @@ -191,6 +191,25 @@ docker run \
go-sidecar:latest run
```
### Running with docker-compose
By default, this will build the sidecar locally with Docker and run it.
If you wish to use the pre-built image, uncomment the `image` property in the `sidecar` service in `docker-compose.yml` and remove the `build` section
```yaml
services:
sidecar:
image: public.ecr.aws/z6g0f8n7/sidecar:latest run
#build:
# context: .
# dockerfile: Dockerfile
```
```bash
POSTGRES_DATA_PATH=<path to store postgres data> docker-compose up
```
## RPC Routes
### Get current block height
Expand Down
38 changes: 38 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
version: '3.8'

services:
sidecar:
# image: public.ecr.aws/z6g0f8n7/sidecar:latest run
build:
context: .
dockerfile: Dockerfile
command:
- "run"
ports:
- "7100:7100"
- "7101:7101"
environment:
- SIDECAR_DEBUG=false
- SIDECAR_ETHEREUM_RPC_URL=http://34.229.43.36:8545
- SIDECAR_CHAIN=holesky
- SIDECAR_STATSD_URL=localhost:8125
- SIDECAR_DATABASE_HOST=postgres
- SIDECAR_DATABASE_PORT=5432
- SIDECAR_DATABASE_USER=sidecar
- SIDECAR_DATABASE_PASSWORD=sidecar
- SIDECAR_DATABASE_DB_NAME=sidecar
depends_on:
- postgres
restart: unless-stopped

postgres:
image: postgres:latest
ports:
- "5432:5432"
environment:
- POSTGRES_USER=sidecar
- POSTGRES_PASSWORD=sidecar
- POSTGRES_DB=sidecar
volumes:
- ${POSTGRES_DATA_PATH:-./postgres_data}:/var/lib/postgresql/data
restart: unless-stopped

0 comments on commit de331b1

Please sign in to comment.