2022-03-18 13:01:47 -04:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# entrypoint for scribe Docker image
|
|
|
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
2022-06-14 13:55:53 -04:00
|
|
|
SNAPSHOT_URL="${SNAPSHOT_URL:-}" #off by default. latest snapshot at https://lbry.com/snapshot/hub
|
|
|
|
|
|
|
|
if [[ "$HUB_COMMAND" == "scribe" ]] && [[ -n "$SNAPSHOT_URL" ]] && [[ ! -d /database/lbry-rocksdb ]]; then
|
|
|
|
files="$(ls)"
|
2022-11-09 21:50:32 -05:00
|
|
|
echo "Downloading and extracting hub snapshot from $SNAPSHOT_URL"
|
|
|
|
wget --no-verbose -c "$SNAPSHOT_URL" -O - | tar x -C /database
|
2022-06-14 13:55:53 -04:00
|
|
|
fi
|
|
|
|
|
2022-03-18 13:01:47 -04:00
|
|
|
if [ -z "$HUB_COMMAND" ]; then
|
2022-05-18 13:09:42 -04:00
|
|
|
echo "HUB_COMMAND env variable must be scribe, herald, or scribe-elastic-sync"
|
2022-03-18 13:01:47 -04:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
case "$HUB_COMMAND" in
|
2022-03-21 22:47:11 -04:00
|
|
|
scribe ) exec /home/lbry/.local/bin/scribe "$@" ;;
|
2022-05-18 15:08:56 -04:00
|
|
|
herald ) exec /home/lbry/.local/bin/herald "$@" ;;
|
2022-04-21 20:00:19 -04:00
|
|
|
scribe-elastic-sync ) exec /home/lbry/.local/bin/scribe-elastic-sync "$@" ;;
|
2022-05-18 13:09:42 -04:00
|
|
|
* ) "HUB_COMMAND env variable must be scribe, herald, or scribe-elastic-sync" && exit 1 ;;
|
2022-03-18 13:01:47 -04:00
|
|
|
esac
|