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

Commit

Permalink
fix(litestream): restore from litestream on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
dtfiedler committed May 8, 2024
1 parent 905ca3b commit 7315cce
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions litestream/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,10 @@ set -e
# Update env vars
ytt --data-values-env TVAL -f /litestream.template.yaml > /litestream.yml

# restore if needed
echo "Restoring database from backup..."
/usr/local/bin/litestream restore -config /litestream.yml $TVAL_LOCAL_DB_PATH/state.db
/usr/local/bin/litestream restore -config /litestream.yml $TVAL_LOCAL_DB_PATH/contract.db

echo "Starting Litestream for continuous replication..."
/usr/local/bin/litestream replicate -config /litestream.yml
7 changes: 6 additions & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,10 @@ export const arnsContractTxId =
'bLAgYxAdX2Ry-nt6aH2ixgvJXbpsEYm28NgJgyqfs-U';

export const prefetchContractTxIds: string[] = process.env.PREFETCH_CONTRACT_IDS
? [arnsContractTxId, ...process.env.PREFETCH_CONTRACT_IDS.split(',')]
? [
...new Set([
arnsContractTxId,
...process.env.PREFETCH_CONTRACT_IDS.split(','),
]),
] // filter out any duplicates
: [arnsContractTxId];

0 comments on commit 7315cce

Please sign in to comment.