From 27705651302b6ffeb9ba6a7fa12629e63de332c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hl=C3=B6=C3=B0ver=20Sigur=C3=B0sson?= Date: Fri, 19 Jul 2024 17:45:24 +0200 Subject: [PATCH] feat(litestream): use ar-io fork for core.db bugfix --- litestream/Dockerfile | 2 +- litestream/docker-entrypoint.sh | 3 +-- litestream/litestream.template.yaml | 33 +++++++++++++---------------- scripts/codedeploy/before-install | 4 ---- 4 files changed, 17 insertions(+), 25 deletions(-) diff --git a/litestream/Dockerfile b/litestream/Dockerfile index f88d81d6..2d8544fd 100644 --- a/litestream/Dockerfile +++ b/litestream/Dockerfile @@ -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 diff --git a/litestream/docker-entrypoint.sh b/litestream/docker-entrypoint.sh index 151e685c..02ce782e 100755 --- a/litestream/docker-entrypoint.sh +++ b/litestream/docker-entrypoint.sh @@ -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 diff --git a/litestream/litestream.template.yaml b/litestream/litestream.template.yaml index c6555390..3be892e9 100644 --- a/litestream/litestream.template.yaml +++ b/litestream/litestream.template.yaml @@ -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 diff --git a/scripts/codedeploy/before-install b/scripts/codedeploy/before-install index 8febcd93..44e89cd8 100755 --- a/scripts/codedeploy/before-install +++ b/scripts/codedeploy/before-install @@ -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