Skip to content

Commit 10c377a

Browse files
committed
Incorporate litestream as an accessory.
1 parent b8dc392 commit 10c377a

File tree

4 files changed

+35
-0
lines changed

4 files changed

+35
-0
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ env:
1313
DOCKER_BUILDKIT: 1
1414
KAMAL_REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
1515
KAMAL_REGISTRY_USERNAME: ${{ github.actor }}
16+
R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
17+
R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
1618

1719
jobs:
1820
build-and-deploy:

.kamal/secrets

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
KAMAL_REGISTRY_PASSWORD=$KAMAL_REGISTRY_PASSWORD
77
KAMAL_REGISTRY_USERNAME=$KAMAL_REGISTRY_USERNAME
88

9+
R2_ACCESS_KEY_ID=$R2_ACCESS_KEY_ID
10+
R2_SECRET_ACCESS_KEY=$R2_SECRET_ACCESS_KEY
11+
912
# Option 2: Read secrets via a command
1013
# RAILS_MASTER_KEY=$(cat config/master.key)
1114

config/deploy.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,15 @@ builder:
3333

3434
volumes:
3535
- "/opt/docker/BlazorDiffusionVue/App_Data:/app/App_Data"
36+
37+
accessories:
38+
litestream:
39+
roles: ["web"]
40+
image: litestream/litestream
41+
files: ["config/litestream.yml:/etc/litestream.yml"]
42+
volumes: ["/opt/docker/BlazorDiffusionVue/App_Data:/data"]
43+
cmd: replicate
44+
env:
45+
secret:
46+
- R2_ACCESS_KEY_ID
47+
- R2_SECRET_ACCESS_KEY

config/litestream.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
access-key-id: $R2_ACCESS_KEY_ID
2+
secret-access-key: $R2_SECRET_ACCESS_KEY
3+
4+
dbs:
5+
- path: /data/db.sqlite
6+
replicas:
7+
- type: s3
8+
bucket: diffusion-server-backup
9+
path: db.sqlite
10+
region: auto
11+
endpoint: https://b95f38ca3a6ac31ea582cd624e6eb385.r2.cloudflarestorage.com
12+
- path: /data/analytics.sqlite
13+
replicas:
14+
- type: s3
15+
bucket: diffusion-server-backup
16+
path: analytics.sqlite
17+
region: auto
18+
endpoint: https://b95f38ca3a6ac31ea582cd624e6eb385.r2.cloudflarestorage.com

0 commit comments

Comments
 (0)