diff --git a/docs/cluster_guide.md b/docs/cluster_guide.md index 03ffcc2..55a6eaf 100644 --- a/docs/cluster_guide.md +++ b/docs/cluster_guide.md @@ -196,3 +196,6 @@ services: ``` - Start the hub services by running `docker-compose up -d` - Check the status with `docker-compose logs -f --tail 100` + +### Manual setup of docker volumes from snapshots + For an example of copying and configuring permissions for a hub docker volume, see [this](https://github.com/lbryio/hub/blob/master/scripts/initialize_rocksdb_snapshot_dev.sh). For an example for the elasticsearch volume, see [this](https://github.com/lbryio/hub/blob/master/scripts/initialize_es_snapshot_dev.sh). **Read these scripts before running them** to avoid overwriting the wrong volume, they are more of a guide on how to set the permissions and where files go than setup scripts. diff --git a/scripts/initialize_es_snapshot_dev.sh b/scripts/initialize_es_snapshot_dev.sh new file mode 100644 index 0000000..f1ad853 --- /dev/null +++ b/scripts/initialize_es_snapshot_dev.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +ES_NAME="es01" +SNAPSHOT_HEIGHT="1188203" +SNAPSHOT_NODES="snapshot_es_${SNAPSHOT_HEIGHT}/snapshot/nodes" +ES_VOLUME_PATH="/var/lib/docker/volumes/${USER}_${ES_NAME}" + +sudo rm -rf "${ES_VOLUME_PATH}/_data" +sudo mkdir -p "${ES_VOLUME_PATH}/_data" +sudo cp -r "${SNAPSHOT_NODES}" "${ES_VOLUME_PATH}/_data/" + +sudo chown -R $USER:root "${ES_VOLUME_PATH}/_data" +sudo chmod -R 775 "${ES_VOLUME_PATH}/_data" diff --git a/scripts/initialize_rocksdb_snapshot_dev.sh b/scripts/initialize_rocksdb_snapshot_dev.sh new file mode 100644 index 0000000..1d7dc77 --- /dev/null +++ b/scripts/initialize_rocksdb_snapshot_dev.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +SNAPSHOT_HEIGHT="1188203" +HUB_VOLUME_PATH="/var/lib/docker/volumes/${USER}_lbry_rocksdb" + +sudo rm -rf "${HUB_VOLUME_PATH}/_data" +sudo mkdir -p "${HUB_VOLUME_PATH}/_data" +sudo cp -r "snapshot_${SNAPSHOT_HEIGHT}/lbry-rocksdb" "${HUB_VOLUME_PATH}/_data/" +sudo touch "${HUB_VOLUME_PATH}/_data/scribe.log" +sudo touch "${HUB_VOLUME_PATH}/_data/scribe-elastic-sync.log" +sudo touch "${HUB_VOLUME_PATH}/_data/herald.log" +sudo cp "snapshot_${SNAPSHOT_HEIGHT}/es_info" "${HUB_VOLUME_PATH}/_data/" +sudo chown -R 999:999 "${HUB_VOLUME_PATH}/_data"