Skip to content

Commit

Permalink
feat(litestream): use ar-io fork for core.db bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
hlolli authored and djwhitt committed Jul 19, 2024
1 parent db4c49a commit 2770565
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 25 deletions.
2 changes: 1 addition & 1 deletion litestream/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM litestream/litestream:0.3.13
FROM ghcr.io/ar-io/litestream:main@sha256:fa62d84201b02f48b66a690f2a2082d7cf6c8a2f3ef0b56c9eda59cd3b5aa523

RUN apk update && apk add --no-cache curl

Expand Down
3 changes: 1 addition & 2 deletions litestream/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ chmod go+r /etc/litestream.yml

if [ -n "$AR_IO_SQLITE_RESTORE_FROM_BACKUP" ]; then
echo "Attempting to restore from backup if exists..."
# TODO: uncomment this once core.db upload issue is resolved
# /usr/local/bin/litestream restore -config /etc/litestream.yml -if-db-not-exists -if-replica-exists /app/data/sqlite/core.db
/usr/local/bin/litestream restore -config /etc/litestream.yml -if-db-not-exists -if-replica-exists /app/data/sqlite/core.db
/usr/local/bin/litestream restore -config /etc/litestream.yml -if-db-not-exists -if-replica-exists /app/data/sqlite/data.db
/usr/local/bin/litestream restore -config /etc/litestream.yml -if-db-not-exists -if-replica-exists /app/data/sqlite/moderation.db
/usr/local/bin/litestream restore -config /etc/litestream.yml -if-db-not-exists -if-replica-exists /app/data/sqlite/bundles.db
Expand Down
33 changes: 15 additions & 18 deletions litestream/litestream.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,21 @@ secret-access-key: #@ data.values.AR_IO_SQLITE_BACKUP_S3_BUCKET_SECRET_KEY
#@ end

dbs:
# Hlöðver: currently we are dealing with a bug uploading core.db
# due to its size. A fix is underway, this is temporary.
#
# - path: /app/data/sqlite/core.db
# replicas:
# - type: s3
# #@ if data.values.AR_IO_SQLITE_BACKUP_S3_BUCKET_PREFIX != "":
# path: #@ data.values.AR_IO_SQLITE_BACKUP_S3_BUCKET_PREFIX + "/ar_io_node_core.backup.db"
# #@ end
# #@ if data.values.AR_IO_SQLITE_BACKUP_S3_BUCKET_PREFIX == "":
# path: ar_io_node_core.backup.db
# #@ end
# bucket: #@ data.values.AR_IO_SQLITE_BACKUP_S3_BUCKET_NAME
# region: #@ data.values.AR_IO_SQLITE_BACKUP_S3_BUCKET_REGION
# forcePathStyle: true
# sync-interval: 1s
# snapshot-interval: 24h
# retention: 168h
- path: /app/data/sqlite/core.db
replicas:
- type: s3
#@ if data.values.AR_IO_SQLITE_BACKUP_S3_BUCKET_PREFIX != "":
path: #@ data.values.AR_IO_SQLITE_BACKUP_S3_BUCKET_PREFIX + "/ar_io_node_core.backup.db"
#@ end
#@ if data.values.AR_IO_SQLITE_BACKUP_S3_BUCKET_PREFIX == "":
path: ar_io_node_core.backup.db
#@ end
bucket: #@ data.values.AR_IO_SQLITE_BACKUP_S3_BUCKET_NAME
region: #@ data.values.AR_IO_SQLITE_BACKUP_S3_BUCKET_REGION
forcePathStyle: true
sync-interval: 1s
snapshot-interval: 24h
retention: 168h
- path: /app/data/sqlite/data.db
replicas:
- type: s3
Expand Down
4 changes: 0 additions & 4 deletions scripts/codedeploy/before-install
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,3 @@ set +a

# upload just the core.db file to S3
instance_id=$(curl -s http://169.254.169.254/latest/meta-data/instance-id)

if [ -e /data/sqlite/core.db ]; then
aws s3 cp /data/sqlite/core.db s3://$AR_IO_SQLITE_BACKUP_S3_BUCKET_NAME/$instance_id/core.db || true
fi

0 comments on commit 2770565

Please sign in to comment.