Feat: Extensible config (snapshots, mounting directories, and more) #367
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
My goal of this PR is to add extensible config to be used when getting and removing snapshots. On starting it, I determined it would also be nice to add a third disk option if a machine has it available. When looking at formatting and mounting drives, I saw there was an interest in sorting by type so I did a very soft check of the drive name to determine if it is an NVMe or not, and created a prioritized disk array. Added a default snapshot flag to startup scripts when creating a new validator, which will make subsequent fetching and removing snapshots more straightforward.
In this PR:
ensureMountAndFiles
now includes command to format and mount a potential third drive (snapshots).getLargestDisk
updated to prioritize NVMe first sorted by size, followed by SATA sorted by size.createSnapshot
adds specified directory for archives from config (/mnt/ledger as default).getCommands
defaults to config specification for ledger and snapshots.cli/get/snapshot
uses default ledger and snapshot values, and adds rpcUrl to snapshot fetch.mountDirs
enables three disks for formatting and mounting.rmSnapshot
now uses configured snapshots path (defaults /mnt/ledger).setupV2
adds comments, passes config values intogetSnapshot
.setup/validator/index
passes config into setup scripts.config
directory adds defaults for a snapshots directory, as well as adds snapshots, ledger, and accounts directory variables into default config type. Enum is added for triple disk configuration.removeSnapshot
andcreateSnapshot
added a config parametervalidatorStartup
functions take in a config parameter and use them for snapshots flag in addition to ledger and accounts.I could still probably add something that updates an existing config that does not have the additional parameters, but I tried to ensure if they don't have the latest config, default values that are aligned are passed in. In the snapshot finder command I found it interesting that the path was
/mnt/ledger/:/mnt/ledger/snapshot
, from my understanding the singularsnapshot
directory is used on fastboot/cluster restarts, while the pluralsnapshots
directory is the subfolder which is created and leveraged during runtime.Please feel free to ask questions, add comments, or point any improvements or additions you would like to see in this PR.