Skip to content

Commit

Permalink
Setup litestream
Browse files Browse the repository at this point in the history
  • Loading branch information
Layoric committed Dec 4, 2024
1 parent a79d445 commit fb4826b
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 12 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ env:
DOCKER_BUILDKIT: 1
KAMAL_REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
KAMAL_REGISTRY_USERNAME: ${{ github.actor }}
R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}

jobs:
release:
Expand Down Expand Up @@ -105,4 +107,4 @@ jobs:
- name: Deploy with Kamal
run: |
kamal lock release -v
kamal deploy -P --version latest
kamal deploy -P --version latest
2 changes: 2 additions & 0 deletions .kamal/secrets
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ GROQ_API_KEY=$GROQ_API_KEY
MISTRAL_API_KEY=$MISTRAL_API_KEY
OPENAI_API_KEY=$OPENAI_API_KEY
OPENROUTER_API_KEY=$OPENROUTER_API_KEY
R2_ACCESS_KEY_ID=$R2_ACCESS_KEY_ID
R2_SECRET_ACCESS_KEY=$R2_SECRET_ACCESS_KEY

# Option 2: Read secrets via a command
# RAILS_MASTER_KEY=$(cat config/master.key)
Expand Down
22 changes: 11 additions & 11 deletions config/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ builder:
volumes:
- "/opt/docker/MyApp/App_Data:/app/App_Data"

#accessories:
# litestream:
# roles: ["web"]
# image: litestream/litestream
# files: ["config/litestream.yml:/etc/litestream.yml"]
# volumes: ["/opt/docker/MyApp/App_Data:/data"]
# cmd: replicate
# env:
# secret:
# - ACCESS_KEY_ID
# - SECRET_ACCESS_KEY
accessories:
litestream:
roles: ["web"]
image: litestream/litestream
files: ["config/litestream.yml:/etc/litestream.yml"]
volumes: ["/opt/docker/ai-server/App_Data:/data"]
cmd: replicate
env:
secret:
- R2_ACCESS_KEY_ID
- R2_SECRET_ACCESS_KEY
12 changes: 12 additions & 0 deletions config/litestream.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
access-key-id: $R2_ACCESS_KEY_ID
secret-access-key: $R2_SECRET_ACCESS_KEY

dbs:
- path: /data/app.db
replicas:
- type: s3
bucket: ai-server
path: app.db
region: auto
endpoint: https://b95f38ca3a6ac31ea582cd624e6eb385.r2.cloudflarestorage.com

0 comments on commit fb4826b

Please sign in to comment.