Skip to content

Commit

Permalink
Create an overridable volume for the geth data directory (#171)
Browse files Browse the repository at this point in the history
  • Loading branch information
danyalprout authored Jan 4, 2024
1 parent 2f3557e commit 0963043
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GETH_HOST_DATA_DIR=./geth-data
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/.idea/
/geth-data/
/geth-data/
16 changes: 6 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,13 @@ curl -d '{"id":0,"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["late

Note: Some L1 nodes (e.g. Erigon) do not support fetching storage proofs. You can work around this by specifying `--l1.trustrpc` when starting op-node (add it in `op-node-entrypoint` and rebuild the docker image with `docker compose build`.) Do not do this unless you fully trust the L1 node provider.

5. Map a local data directory for `op-geth` by adding a volume mapping to the `docker-compose.yaml`:

```yaml
services:
geth: # this is Optimism's geth client
...
volumes:
- $HOME/data/base:/data
```

This is where your node data will be stored. This is for example where you would extract your [snapshot](#snapshots) to.
#### Persisting Data

By default, the data directory is stored in `${PROJECT_ROOT}/geth-data`. You can override this by modifying the value of
`GETH_HOST_DATA_DIR` variable in the [`.env`](./.env) file.

To load a [snapshot](#snapshots) you can extract the snapshot into the `$GETH_HOST_DATA_DIR` folder.

#### Running in single container with `supervisord`

Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ services:
- 30303:30303/udp # P2P UDP (currently unused)
- 7301:6060 # metrics
command: [ "bash", "./geth-entrypoint" ]
volumes:
- ${GETH_HOST_DATA_DIR}:/data
env_file:
# select your network here:
# - .env.goerli
Expand Down

0 comments on commit 0963043

Please sign in to comment.