Skip to content

Commit 0963043

Browse files
authored
Create an overridable volume for the geth data directory (#171)
1 parent 2f3557e commit 0963043

4 files changed

Lines changed: 10 additions & 11 deletions

File tree

.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
GETH_HOST_DATA_DIR=./geth-data

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
/.idea/
2-
/geth-data/
2+
/geth-data/

README.md

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,13 @@ curl -d '{"id":0,"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["late
6868

6969
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.
7070

71-
5. Map a local data directory for `op-geth` by adding a volume mapping to the `docker-compose.yaml`:
72-
73-
```yaml
74-
services:
75-
geth: # this is Optimism's geth client
76-
...
77-
volumes:
78-
- $HOME/data/base:/data
79-
```
8071

81-
This is where your node data will be stored. This is for example where you would extract your [snapshot](#snapshots) to.
72+
#### Persisting Data
73+
74+
By default, the data directory is stored in `${PROJECT_ROOT}/geth-data`. You can override this by modifying the value of
75+
`GETH_HOST_DATA_DIR` variable in the [`.env`](./.env) file.
76+
77+
To load a [snapshot](#snapshots) you can extract the snapshot into the `$GETH_HOST_DATA_DIR` folder.
8278

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

docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ services:
1010
- 30303:30303/udp # P2P UDP (currently unused)
1111
- 7301:6060 # metrics
1212
command: [ "bash", "./geth-entrypoint" ]
13+
volumes:
14+
- ${GETH_HOST_DATA_DIR}:/data
1315
env_file:
1416
# select your network here:
1517
# - .env.goerli

0 commit comments

Comments
 (0)