Added Litestream (#902)

* Added litestream

* Added a stable version tag for the litestream container. Added randomly generated S3 secrets as default value placeholders
This commit is contained in:
sandro-lombardi 2023-04-09 18:55:51 +02:00 committed by GitHub
parent cdd584f5d9
commit f042cefd27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 70 additions and 0 deletions

View File

@ -0,0 +1,70 @@
captainVersion: 4
services:
$$cap_appname:
caproverExtra:
dockerfileLines:
- FROM litestream/litestream:$$cap_version
- RUN mkdir /config
- |-
RUN test -f /config/litestream.yml || echo -e "dbs:\n - path: $$cap_db_path\n replicas:\n - type: s3\n bucket: $$cap_bucket\n path: $$cap_dest_path\n endpoint: $$cap_endpoint_url\n access-key-id: $$cap_access_key_id\n secret-access-key: $$cap_secret_access_key" > /config/litestream.yml
- ENTRYPOINT ["/usr/local/bin/litestream"]
- CMD ["replicate", "-config", "/config/litestream.yml"]
notExposeAsWebApp: 'true'
volumes:
- $$cap_appname-data:/data
- $$cap_appname-config:/config
environment:
LITESTREAM_ACCESS_KEY_ID: $$cap_access_key_id
LITESTREAM_SECRET_ACCESS_KEY: $$cap_secret_access_key
caproverOneClickApp:
variables:
- id: '$$cap_version'
label: Litestream Version
defaultValue: '0.3'
description: Check out their Docker page for the valid tags https://hub.docker.com/r/litestream/litestream/tags
validRegex: "/^([^\\s^\\/])+$/"
- id: '$$cap_access_key_id'
label: Access key ID
defaultValue: $$cap_gen_random_hex(20)
description: Enter your replica-specific authentication key
- id: '$$cap_secret_access_key'
label: Secret access key
defaultValue: $$cap_gen_random_hex(40)
description: Enter your replica-specific secret key
- id: '$$cap_db_path'
label: Database path within container
defaultValue: '/data/db'
description: Enter the database path within the container
- id: '$$cap_dest_path'
label: Path within bucket
defaultValue: 'db'
description: Enter the path to use within the bucket
- id: '$$cap_bucket'
label: Bucket name
defaultValue: 'BUCKET'
description: Enter the name of the remote bucket to replicate to
- id: '$$cap_endpoint_url'
label: S3 endpoint URL
defaultValue: ''
description: Enter your endpoint URL of the S3-compatible service. Only required for non-AWS services.
instructions:
start: |-
This one-click app will deploy Litestream, a standalone streaming replication tool for SQLite. It runs as a background process and safely replicates changes incrementally to a S3 bucket.
To use this app, you need to enter your S3 credentials (access key ID and secret access key).
end: |-
Your litestream service has been deployed successfully!
Important! Read this and take a screenshot so you can refer to it!
By default, $$cap_appname-data volume, which is an empty directory, is mapped to your litestream data folder which is at /data inside the app. To change this:
Go to CapRover > Apps > Litestream > App Config tab and change $$cap_appname-data to
a) some other volume name such as "cap_appname-myappvolume" if you want litestream to access a sqlite database in this volume
b) "/some/existing/path/on/host" if you want litestream to access a database on a specific path on the host.
Don't change the "/data" part of the mapping as the "/data" is the directory inside the litestream container that is used to look for databases.
The $$cap_appname-config volume stores the config file used by litestream. It can be modified, even after creation of the app but the container needs to be restartet in order to apply the new settings.
displayName: Litestream
isOfficial: true
description: Streaming replication for SQLite
documentation: https://github.com/benbjohnson/litestream

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB