-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a database bootstrap guide #9390
base: main
Are you sure you want to change the base?
Conversation
…cript, and linking the bootstrap guide to the main DB README.md doc Signed-off-by: Nir Ben-Or <[email protected]>
Signed-off-by: Nir Ben-Or <[email protected]>
03f4d6d
to
563ccab
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #9390 +/- ##
============================================
+ Coverage 92.55% 92.56% +0.01%
- Complexity 7039 7047 +8
============================================
Files 912 914 +2
Lines 29760 29810 +50
Branches 3760 3767 +7
============================================
+ Hits 27544 27595 +51
Misses 1445 1445
+ Partials 771 770 -1 ☔ View full report in Codecov by Sentry. |
I've tested the import script using a small dataset and it has completed successfully. |
hedera-mirror-importer/src/main/resources/db/scripts/bootstrap.sh
Outdated
Show resolved
Hide resolved
hedera-mirror-importer/src/main/resources/db/scripts/bootstrap.sh
Outdated
Show resolved
Hide resolved
Co-authored-by: Steven Sheehy <[email protected]> Signed-off-by: Nir Ben-Or <[email protected]>
…to come Signed-off-by: Nir Ben-Or <[email protected]>
Signed-off-by: Nir Ben-Or <[email protected]>
4105ac2
to
e3e0b9c
Compare
Co-authored-by: Steven Sheehy <[email protected]> Signed-off-by: Nir Ben-Or <[email protected]>
Signed-off-by: Nir Ben-Or <[email protected]>
1e68dfe
to
1bc16eb
Compare
Signed-off-by: Nir Ben-Or <[email protected]>
…voke of the extra grant for GCP cloud sql instances Signed-off-by: Nir Ben-Or <[email protected]>
export PGHOST="DB_IP_ADDRESS" | ||
export PGPORT="DB_PORT" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to show common examples for these instead of replacement text.
export PGHOST="DB_IP_ADDRESS" | |
export PGPORT="DB_PORT" | |
export PGHOST="127.0.0.1" | |
export PGPORT="5432" |
|
||
### 3. Run the Initialization Script | ||
|
||
Download the initialization script [`init.sh`](../../hedera-mirror-importer/src/main/resources/db/scripts/init.sh) from the repository: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant relative to root, not current directory.
Download the initialization script [`init.sh`](../../hedera-mirror-importer/src/main/resources/db/scripts/init.sh) from the repository: | |
Download the initialization script [`init.sh`](/hedera-mirror-importer/src/main/resources/db/scripts/init.sh) from the repository: |
- [3. Run the Import Script](#3-run-the-import-script) | ||
- [Handling Failed Imports](#handling-failed-imports) | ||
- [Steps to Handle Failed Imports:](#steps-to-handle-failed-imports) | ||
- [Additional Notes](#additional-notes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This ToC doesn't seem to be updated to reflect the headers. Please scan through all sections and update.
export GRAPHQL_PASSWORD="SET_PASSWORD" | ||
export GRPC_PASSWORD="SET_PASSWORD" | ||
export IMPORTER_PASSWORD="SET_PASSWORD" | ||
export OWNER_PASSWORD="SET_PASSWORD" | ||
export REST_PASSWORD="SET_PASSWORD" | ||
export REST_JAVA_PASSWORD="SET_PASSWORD" | ||
export ROSETTA_PASSWORD="SET_PASSWORD" | ||
export WEB3_PASSWORD="SET_PASSWORD" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A better experience would be to create a bootstrap.env
with all the exports and ask the user to just adjust all defaults. Then inside bootstrap.sh
run source ./bootstrap.env
.
Download the initialization script [`init.sh`](../../hedera-mirror-importer/src/main/resources/db/scripts/init.sh) from the repository: | ||
|
||
```bash | ||
curl -O https://raw.githubusercontent.com/hashgraph/hedera-mirror-node/main/hedera-mirror-importer/src/main/resources/db/scripts/init.sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically they should download the init.sh version that's specified in MIRRORNODE_VERSION
Import the database schema: | ||
|
||
```bash | ||
psql -f schema.sql |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's confusing that both schema.sql and MIRRORNODE_VERSION files are referenced in the docs before they are requested to be downloaded. Users following the steps sequentially will get stuck.
**Important Notes:** | ||
|
||
- The bucket is **read-only** to the public. | ||
- It is configured as **Requester Pays**, meaning you need a GCP account with a valid billing account attached to download the data. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be useful to link to the Hedera docs that show how to create such an account.
**Detach from the `screen` Session:** | ||
|
||
Press `Ctrl+A` then `D`. | ||
|
||
- This allows the import process to continue running in the background. | ||
|
||
**Reattach to the `screen` Session Later:** | ||
|
||
```bash | ||
screen -r db_import | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Screen/tmux might be a bit more complex then just adding nohup or disown to the bootstrap.sh command.
After the script completes, check the exit status: | ||
|
||
```bash | ||
echo "EXIT STATUS: $?" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This only works if they are running it in the foreground. Better to have them check the final few lines of the log.
Description:
bootstrap.sh
which is used to import the exported mirrornode content found in the mirrornode-db-export bucketbootstrap.md
which contains a guide with info and instructions on how to setup a fresh mirrornode DB, and how to import the exported data available in the bucket linked above.docs/database/README.md
with a paragraph linking tobootstrap.md
Related issue(s):
Checklist
bootstrap.md
as a how-to guide