litestream

by mjpitz

Helm chartv22.4.5App 0.3.13MITVerified publisher

Easily add litestream to any sqlite backed application as a sidecar. This chart optionally deploys the required configuration and provides template functions that render the necessary init and sidecar containers.

About this chart

litestream

Easily add litestream to any sqlite backed application as a sidecar. This chart optionally deploys the required configuration and provides template functions that render the necessary init and sidecar containers.

Usage

First, add the dependency to your Chart.yaml file. Like any dependency, you're going to need to run helm dep up to fetch the dependency before installing.

# ...
dependencies:
  # ...
  - name: litestream
    version: 22.4.5
    repository: https://mya.sh
    condition: litestream.enabled

Then, you'll need to add the appropriate block to your Deployment, StatefulSet, or DaemonSet.

{{- $litestreamConfig := dict "Chart" (dict "Name" "litestream") "Values" .Values.litestream "Release" .Release -}}
# ...
spec:
  # ...
  template:
    # ...
    spec:
      {{- if .Values.litestream.enabled }}
      # ...
      initContainers:
        {{- include "litestream.init-container" $litestreamConfig | nindent 8 }}
      {{- end }}
      # ...
      containers:
        # ...
        {{- if .Values.litestream.enabled }}
        {{- include "litestream.container" $litestreamConfig | nindent 8 }}
        {{- end }}
      volumes:
        # ...
        {{- if .Values.litestream.enabled }}
        {{- include "litestream.volume" $litestreamConfig | nindent 8 }}
        {{- end }}

Finally, we'll need to add some additional configuration to the values.yaml file.

# ...
litestream:
  enabled: false

  # customize this as needed
  extraVolumeMounts:
    - name: data
      mountPath: /data/

  config:
    dbs:
      - path: /data/db.sqlite
        replicas: []

That should be it.

Maintainers

NameEmailUrl
Mya Pitzerusehttps://mya.sh

Source Code

Values

KeyTypeDefaultDescription
config.accessKeyIdstring""Specify a single access key id to use for all replicas who do not provide their own.
config.dbslist[]A list of databases that should be replicated by litestream.
config.secretAccessKeystring""Specify a single secret access key to use for all replica who do not provide their own.
externalConfig.secretRef.namestring""Specify the name of the secret containing the raw configuration. The secret should have a single litestream.yml entry that contains the configuration.
extraVolumeMountslist[]Add additional volume mounts to the pod.
fullnameOverridestring""Override the full name of the release.
image.pullPolicystring"IfNotPresent"The pull policy to use for the litestream image.
image.repositorystring"litestream/litestream"The repository hosting the litestream image.
image.tagstring"0.3.13"Overrides the image tag whose default is the chart appVersion.
imagePullSecretslist[]Specify the secret containing the registry credentials.
metrics.enabledboolfalseWhether metrics reporting should be enabled.
metrics.portint9090The port to run the metrics server on.
nameOverridestring""Override the name of the release.
resourcesobject{}Specify the resources for the pod.
securityContextobject{}Specify the security context for the litestream container.

Deploy litestream with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has litestream on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartlitestream is pinned at v22.4.5 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply