Skip to content

Latest commit

 

History

History
75 lines (56 loc) · 2.59 KB

README.md

File metadata and controls

75 lines (56 loc) · 2.59 KB

Favre

Codacy grade Libraries.io dependency status for latest release Docker Image Size (tag)

Favre is a wrapper around Csync2 for automatic, eventually-consistent file synchronization within a Docker Swarm.

Configuration

Many of the configuration options available for Csync2 are available for Favre. These environmental variables will be rendered into a file /run/csync2/csync2.cfg prior to running csync2.

CSYNC2_AUTO: defaults to younger

CSYNC2_DB_DIR: advised to persist with docker volume, default /var/lib/csync2; this is where Csync2 stores its state

CSYNC2_KEY_FILE: mandatory, no default, should be stored as a docker secret

CSYNC2_INCLUDE: paths to include in the sync; more than one line can be rendered by setting CSYNC2_INCLUDE_0, CSYNC2_INCLUDE_1, etc.

CSYNC2_EXCLUDE: patterns to exclude from sync; more than one line can be rendered in the same manner as CSYNC2_EXCLUDE_0, CSYNC2_EXCLUDE_1, etc.

CSYNC2_BACKUP_DIRECTORY: optional, no default

CSYNC2_BACKUP_GENERATIONS: optional, no default

CSYNC2_SYSTEM_DIR: optional, defaults to /run/csync2

CSYNC2_DAEMON_VERBOSITY: optional, defaults to -v

CSYNC2_CLIENT_VERBOSITY: optional, defaults to -v

CSYNC2_SYNC_INTERVAL: mandatory, defaults to 5000 (ms)

FAVRE_TASKS_ENDPOINT: must be set to "tasks.{{.Service.Name}}." for discovery

Compose

It is imperative that hostname not be changed. The values from a reverse DNS lookup must be marshalled to match this hostname.

version: "3.8"

services:
  sync:
    image: coryaent/favre
    hostname: "{{.Service.Name}}.{{.Task.Slot}}.{{.Task.ID}}"
    secrets:
      - favre_key
    environment:
      CSYNC2_KEY_FILE: /run/secrets/favre_key
      CSYNC2_INCLUDE: /sync
      FAVRE_TASKS_ENDPOINT: "tasks.{{.Service.Name}}."
    networks:
      - internal
    volumes:
      - state:/var/lib/csync2/
      - sync:/sync/
    deploy:
      mode: global
      endpoint_mode: dnsrr

secrets:
  favre_key:
    external: true

networks:
  internal:
    attachable: false
    driver: overlay
    driver_opts:
      encrypted: "true"

volumes:
  state:
    driver: local
  sync:
    driver: local