Skip to content

Commit

Permalink
Better handling of legacy volume move
Browse files Browse the repository at this point in the history
  • Loading branch information
yorickdowne committed Aug 10, 2024
1 parent 2162915 commit d2d5b5e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
11 changes: 11 additions & 0 deletions ethd
Original file line number Diff line number Diff line change
Expand Up @@ -1440,6 +1440,17 @@ resync-consensus() {
else
__cl_volume="$(basename "$(realpath .)")_${__cl_volume}"
dodocker volume rm "$(dodocker volume ls -q -f "name=${__cl_volume}")"
__volume_id=""
if [[ "${__cl_volume}" =~ lhconsensus-data ]]; then
__legacy_volume="$(basename "$(realpath .)")_lhbeacon-data"
__volume_id="$(dodocker volume ls -q -f "name=${__legacy_volume}")"
elif [[ "${__cl_volume}" =~ prysmconsensus-data ]]; then
__legacy_volume="$(basename "$(realpath .)")_prysmbeacon-data"
__volume_id="$(dodocker volume ls -q -f "name=${__legacy_volume}")"
fi
if [ -n "${__volume_id}" ]; then
dodocker volume rm "${__volume_id}"
fi
fi
echo
echo "${__cl_client} stopped and database deleted."
Expand Down
5 changes: 3 additions & 2 deletions lighthouse/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ fi
if [[ -d /var/lib/lighthouse-og/beacon && ! -f /var/lib/lighthouse-og/beacon/migrationdone \
&& $(ls -A /var/lib/lighthouse-og/beacon/) ]]; then
echo "Migrating from old Lighthouse volume to new one"
echo "This may take 10 minutes on a fast drive. Please be patient"
rsync -a --remove-source-files --exclude='ee-secret' /var/lib/lighthouse-og/beacon/ /var/lib/lighthouse/beacon/
echo "This may take 10 minutes on a fast drive, or hours if the Lighthouse DB is very large. Please be patient."
echo "If your Lighthouse DB is well over 200 GiB in size, please consider \"./ethd resync-consensus\""
rsync -a --remove-source-files --exclude='ee-secret' --info=progress2 /var/lib/lighthouse-og/beacon/ /var/lib/lighthouse/beacon/
touch /var/lib/lighthouse-og/beacon/migrationdone
echo "Migration completed, data is now in volume \"lhconsensus-data\""
fi
Expand Down
5 changes: 3 additions & 2 deletions prysm/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ fi
if [[ -d /var/lib/prysm-og && ! -f /var/lib/prysm-og/migrationdone \
&& $(ls -A /var/lib/prysm-og/) ]]; then
echo "Migrating from old Prysm volume to new one"
echo "This may take 10 minutes on a fast drive. Please be patient"
rsync -a --remove-source-files --exclude='ee-secret' /var/lib/prysm-og/ /var/lib/prysm/
echo "This may take 10 minutes on a fast drive, or hours if the Prysm DB is very large. Please be patient"
echo "If your Prysm DB is well over 200 GiB in size, please consider \"./ethd resync-consensus\""
rsync -a --remove-source-files --exclude='ee-secret' --info=progress2 /var/lib/prysm-og/ /var/lib/prysm/
touch /var/lib/prysm-og/migrationdone
echo "Migration completed, data is now in volume \"prysmconsensus-data\""
fi
Expand Down

0 comments on commit d2d5b5e

Please sign in to comment.