Skip to content

Commit

Permalink
Added support for replicating DB in un-sandboxed location (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
clintonb authored Jan 29, 2024
1 parent 7014b10 commit 5de154b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
14 changes: 14 additions & 0 deletions etc/litestream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,17 @@ dbs:
retention: 24h
retention-check-interval: 1h
snapshot-interval: 1h

- path: $VORIPOS_SANDBOXED_TXN_DB_PATH
replicas:
- type: $VORIPOS_LITESTREAM_TYPE
bucket: $VORIPOS_LITESTREAM_BUCKET
path: $VORIPOS_LITESTREAM_PATH
endpoint: $VORIPOS_LITESTREAM_ENDPOINT
region: $VORIPOS_LITESTREAM_REGION
access-key-id: $VORIPOS_LITESTREAM_ACCESS_KEY_ID
secret-access-key: $VORIPOS_LITESTREAM_SECRET_ACCESS_KEY
# Retain all data for 24 hours, creating a snapshot once an hour to reduce restoration time.
retention: 24h
retention-check-interval: 1h
snapshot-interval: 1h
6 changes: 3 additions & 3 deletions voripos-txn-sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
export PATH="/opt/homebrew/bin:$PATH"

# Source
VORIPOS_DATA_DIR="${HOME}/Library/Containers/com.vori.VoriPOS/Data/Library/Application Support"
export VORIPOS_TXN_DB_PATH=$VORIPOS_DATA_DIR/Transaction.sqlite3
export VORIPOS_SANDBOXED_TXN_DB_PATH="${HOME}/Library/Containers/com.vori.VoriPOS/Data/Library/Application Support/Transaction.sqlite3"
export VORIPOS_TXN_DB_PATH="${HOME}/Library/Application Support/VoriPOS/Transaction.sqlite3"

# Sink
VORIPOS_LITESTREAM_TYPE=
Expand Down Expand Up @@ -54,5 +54,5 @@ export VORIPOS_LITESTREAM_SECRET_ACCESS_KEY


echo "Starting replication for Store ${VORIPOS_STORE_ID}, Lane ${VORIPOS_LANE_ID}"
echo "Data written to ${VORIPOS_TXN_DB_PATH} will be replicated to ${VORIPOS_LITESTREAM_TYPE} endpoint ${VORIPOS_LITESTREAM_ENDPOINT}, bucket ${VORIPOS_LITESTREAM_BUCKET}, path ${VORIPOS_LITESTREAM_PATH}"
echo "Data written to ${VORIPOS_TXN_DB_PATH} or ${VORIPOS_SANDBOXED_TXN_DB_PATH} will be replicated to ${VORIPOS_LITESTREAM_TYPE} endpoint ${VORIPOS_LITESTREAM_ENDPOINT}, bucket ${VORIPOS_LITESTREAM_BUCKET}, path ${VORIPOS_LITESTREAM_PATH}"
litestream replicate -config "$( dirname -- "$0"; )/etc/litestream.yml"

0 comments on commit 5de154b

Please sign in to comment.