Skip to content
This repository has been archived by the owner on Sep 16, 2024. It is now read-only.

Commit

Permalink
chore(litestream): gracefully exist litestream if replica does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
dtfiedler committed May 9, 2024
1 parent 6a7c18b commit fe04565
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions litestream/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ ytt --data-values-env TVAL -f /litestream.template.yaml > /litestream.yml

# restore if needed
echo "Restoring database from backup..."
/usr/local/bin/litestream restore -if-db-not-exists -parallelism 10 -config /litestream.yml $TVAL_LOCAL_DB_PATH/state.db
/usr/local/bin/litestream restore -if-db-not-exists -parallelism 10 -config /litestream.yml $TVAL_LOCAL_DB_PATH/contract.db
if ! /usr/local/bin/litestream restore -if-db-not-exists -if-replica-exists -parallelism 10 -config /litestream.yml $TVAL_LOCAL_DB_PATH/state.db; then
echo "Failed to restore state.db"
fi
if ! /usr/local/bin/litestream restore -if-db-not-exists -if-replica-exists -parallelism 10 -config /litestream.yml $TVAL_LOCAL_DB_PATH/contract.db; then
echo "Failed to restore contract.db"
fi

if [[ -n "$WAIT_TIME_SECONDS" ]]; then
# Sleep for the number of seconds specified in WAIT_TIME_SECONDS
Expand Down

0 comments on commit fe04565

Please sign in to comment.