Skip to content

Commit

Permalink
docs: sidecar docs a bit clearer, add snapshot website
Browse files Browse the repository at this point in the history
  • Loading branch information
BrendanCoughlan5 committed Jan 17, 2025
1 parent 0e8efe1 commit 1a7df5c
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 34 deletions.
14 changes: 4 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,22 +249,16 @@ POSTGRES_DATA_PATH=<path to store postgres data> docker-compose up
# Snapshots
Snapshots are a quicker way to sync to tip and get started.
See [Snapshots Docs](docs/snapshots_docs.md) for instructions on creating and restoring snapshots
### Snapshot Sources
* Mainnet Ethereum (not yet available)
* Testnet Holesky ([2024-11-22](https://eigenlayer-sidecar.s3.us-east-1.amazonaws.com/snapshots/testnet-holesky/sidecar-testnet-holesky-20241122.tar.gz))
## [Get a snapshot at Eigenlayer's Hosted Snapshots Website](https://sidecar.bcog55.org/index.html)
### Example boot from testnet snapshot (default schema)
## Example boot (default public schema)
```bash
curl -LO https://eigenlayer-sidecar.s3.amazonaws.com/snapshots/testnet-holesky/sidecar-testnet-holesky-20241122.tar.gz
tar -xvf sidecar-testnet-2024-11-22.tar.gz
curl -LO <download_link>
./bin/sidecar restore-snapshot \
--input_file=sidecar-testnet-2024-11-22.dump \
--input_file=<downloaded_file> \
--database.host=localhost \
--database.user=sidecar \
--database.password=... \
Expand Down
63 changes: 39 additions & 24 deletions docs/snapshots_docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,25 @@ Snapshots are useful for backing up the current state of the database and quickl

Below shows how to create your own snapshots, restore from the snapshot and how to use custom schemas

## Eigenlayer hosted snapshots:
Get latest sidecar snapshots here, supplied by eigenlayer [https://sidecar.bcog55.org/index.html](https://sidecar.bcog55.org/index.html)
We heavily recommend syncing from genesis for mainnet and creating your own snapshots. We are hosting snapshots for the eigenlayer ecosystem to quickstart and have a good developer experience.

### `create-snapshot`

### `restore-snapshot`
```bash
go run main.go create-snapshot --help
Create a snapshot of the database.
go run main.go restore-snapshot --help
Restore the database from a previously created snapshot file.

Note: This command restores --database.schema_name only if it's present in InputFile snapshot.
Follow the snapshot docs if you need to convert the snapshot to a different schema name than was used during snapshot creation.
Usage:
sidecar create-snapshot [flags]
sidecar restore-snapshot [flags]
Flags:
-h, --help help for create-snapshot
--output_file string Path to save the snapshot file to (required)
-h, --help help for restore-snapshot
--input_file string Path to the snapshot file (required)
Global Flags:
-c, --chain string The chain to use (mainnet, holesky, preprod (default "mainnet")
Expand Down Expand Up @@ -42,30 +49,27 @@ Global Flags:
#### Example use:
```
go run main.go create-snapshot \
./bin/sidecar restore-snapshot \
--input_file=<file> \
--database.host=localhost \
--database.user=sidecar \
--database.password=sidecar \
--database.password=... \
--database.port=5432 \
--database.db_name=sidecar \
--database.schema_name=public \
--database.create_snapshot_output=example.dump
--database.schema_name=public
```
### `restore-snapshot`
### `create-snapshot`
```bash
go run main.go restore-snapshot --help
Restore the database from a previously created snapshot file.

Note: This command restores --database.schema_name only if it's present in InputFile snapshot.
Follow the snapshot docs if you need to convert the snapshot to a different schema name than was used during snapshot creation.
go run main.go create-snapshot --help
Create a snapshot of the database.
Usage:
sidecar restore-snapshot [flags]
sidecar create-snapshot [flags]
Flags:
-h, --help help for restore-snapshot
--input_file string Path to the snapshot file (required)
-h, --help help for create-snapshot
--output_file string Path to save the snapshot file to (required)
Global Flags:
-c, --chain string The chain to use (mainnet, holesky, preprod (default "mainnet")
Expand All @@ -91,15 +95,26 @@ Global Flags:
--rpc.http-port int http rpc port (default 7101)
```
#### Example use:
```
go run main.go create-snapshot \
--database.host=localhost \
--database.user=sidecar \
--database.password=sidecar \
--database.port=5432 \
--database.db_name=sidecar \
--database.schema_name=public \
--database.create_snapshot_output=example.dump
```
## Converting the Schema of a Dump
If you're using a custom schema and want to use a public snapshot, you likely want to convert the dump.

This section provides a step-by-step runbook for converting a snapshot dump to use a different schema name.
If you're using a custom schema and want to use a public snapshot we provide or are converting between your own schemas, you likely want to convert the dump.

Commonly the input schema is
This section provides a helpful step-by-step runbook for converting a snapshot dump to use a different schema name.
If your database and schema can be taken offline, you may just want to just rename the schema in psql.

### Use our script (experimental)
```
# Can use the script
./scripts/convertSnapshotSchema.sh
Expand All @@ -108,7 +123,7 @@ Commonly the input schema is
./scripts/convertSnapshotSchema.sh <inputSchema> <outputSchema> input_file.dump output_file.dump <db_username> <db_password>
```
### You can manually instead use:
```bash
# Open your terminal and create a temporary database to work with:
psql -c "CREATE DATABASE temp_sidecar_dump_schema_conversion_db;"
Expand Down

0 comments on commit 1a7df5c

Please sign in to comment.