georgegeorgulasiv/duplicati

By georgegeorgulasiv

Updated about 6 years ago

muilti-architecture duplicati service with docker swarm example yml

Image
0

50K+

georgegeorgulasiv/duplicati repository overview

Multi-arch duplicati for docker swarm Github repo will be added soon for transparency

Usage

environment variables

TZ - Time zone for your docker host (or whatever time zone you prefer, I guess)

PUID - your uid on the host (hint: run id in your terminal)

volumes

some_docker_volume_or_bind_mount:/source - a directory you want to back up

some_docker_volume_or_bind_mount:/backups/data - backup data storage

some_docker_volume_or_bind_mount:backups/Duplicati - Duplicati database and settings

ports

some_port_on_your_host:8200 - web interface for Duplicati (not needed with traefik)

docker-compose.yml template

Do you want an easy way to force HTTPS access? Just read all the comments and do what they say.

version: '3.7'

networks:
 traefik:
# set driver to bridge if you aren't using swarm
#     or run 'docker swarm init' to create a one-node swarm
  driver: overlay

services:

# duplicati backup service

 backup:
  image: georgegeorgulasiv/duplicati
  networks:
   - traefik
  environment:
   - TZ=America/New_York
   - PUID=501
  volumes:
   - ./:/source
   - ./backups/data/:/backups
   - ./backups/Duplicati/:/data/Duplicati
  deploy:
   restart_policy:
    condition: any
   labels:
    - 'traefik.enable=true'
    - 'traefik.http.routers.backup.entrypoints=plainhttp'
    - 'traefik.http.services.backup.loadbalancer.server.port=8200'
# add your domain
# point the dns for this host (backup.yourdomain.org) to a swarm manager
    - 'traefik.http.routers.backup.rule=Host("backup.yourdomain.org")'
    - 'traefik.http.middlewares.backup-force-secure.redirectscheme.scheme=https'
    - 'traefik.http.routers.backup.middlewares=backup-force-secure'
    - 'traefik.http.routers.backup.service=backup'
    - 'traefik.http.routers.backup-https.entrypoints=encryptedhttp'
# add your domain
    - 'traefik.http.routers.backup-https.rule=Host("backup.yourdomain.org")'
    - 'traefik.http.routers.backup-https.service=backup'
    - 'traefik.http.routers.backup-https.tls=true'
    - 'traefik.http.services.backup-interface-https.loadbalancer.server.port=8200'

# traefik reverse proxy service

 traefik:
  image: traefik
  command:
   - '--accesslog=true'
   - '--api.dashboard=true'
# add your email address
   - '--certificatesresolvers.letsencryptcerts.acme.email=youremailaddress@wherever.com'
   - '--certificatesresolvers.letsencryptcerts.acme.storage=/acme.json'
# test with the staging server before you use the production server
# see Let's Encrypt Rate limiting page to understand why this is important
# comment out or delete the line below only when you are sure your setup works correctly with Let's Encrypt
   - '--certificatesresolvers.cloudflarecerts.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory'
   - '--certificatesresolvers.cloudflarecerts.acme.dnschallenge=true'
# this is only an example, feel free to use other providers - cloudflare is just free to use
   - '--certificatesresolvers.letsencryptcerts.acme.dnschallenge.provider=cloudflare'
   - '--certificatesresolvers.letsencryptcerts.acme.dnschallenge.resolvers=1.1.1.1:53, 1.0.0.1:53'
   - '--entrypoints.plainhttp.address=:80'
   - '--entrypoints.encryptedhttp.address=:443'
   - '--log.level=INFO'
   - '--log.format=json'
   - '--accesslog=true'
   - '--providers.docker.endpoint=unix:///var/run/docker.sock'
   - '--providers.docker.exposedbydefault=false'
   - '--providers.docker.network=yourswarmname_traefik'
# set to false or delete if you're not using docker swarm mode
# but you should just use swarm mode
   - '--providers.docker.swarmmode=true'
   - '--providers.docker.watch=true'
  networks:
   - traefik
  ports:
# forward these ports in your router to a manager node in your swarm or your non-swarm docker host
   - 80:80
   - 443:443
   - 8080:8080
  volumes:
   - ./logs/traefik:/var/log/traefik
# this file must have permissions of 600 or traefik will not launch (run 'chmod 600 acme.json')
   - ./traefik/acme.json:/acme.json
   - /var/run/docker.sock:/var/run/docker.sock:ro
  environment:
# this is only an example, feel free to use other providers - cloudflare is just free to use
   - CF_DNS_API_TOKEN=your cloudflare dns token with api edit privileges
   - CF_ZONE_API_TOKEN=your cloudflare dns token with zone edit privileges
  deploy:
   restart_policy:
    condition: any
   labels:
    - 'traefik.enable=true'
    - 'traefik.http.routers.traefik.entrypoints=plainhttp'
# add your domain
# point the dns for this host (traefik.yourdomain.org) to a swarm manager
    - 'traefik.http.routers.traefik.rule=Host("traefik.yourdomain.org") && (PathPrefix("/api") || PathPrefix("/dashboard"))'
# create a traefik username and password with the htpassword linux command line program
    - 'traefik.http.middlewares.traefik-auth.basicauth.users=yourusername:htpasswordoutputofyourpassword.'
    - 'traefik.http.routers.traefik-https.middlewares=traefik-auth'
    - 'traefik.http.middlewares.traefik-force-secure.redirectscheme.scheme=https'
    - 'traefik.http.routers.traefik.middlewares=traefik-force-secure'
    - 'traefik.http.routers.traefik-https.entrypoints=encryptedhttp'
# add your domain
    - 'traefik.http.routers.traefik-https.rule=Host("traefik.yourdomain.org")'
    - 'traefik.http.services.traefik.loadbalancer.server.port=8080'
    - 'traefik.http.routers.traefik-https.service=api@internal'
    - 'traefik.http.routers.traefik-https.tls=true'
    - 'traefik.http.routers.dashboard.tls.certresolver=letsencryptcerts'
# add your domain
    - 'traefik.http.routers.dashboard.tls.domains[0].main=yourdomain.org'
# add your domain
    - 'traefik.http.routers.dashboard.tls.domains[0].sans=*.yourdomain.org'
   placement:
    constraints:
     - node.role == manager

# optional SSL certificate exporter, if you need those certs for something else
# traefik-ssl-exporter:
#  image: ldez/traefik-certs-dumper:latest
#  networks:
#   - traefik
#  volumes:
#   - ./traefik/acme.json/:/acme.json
#   - ./traefik/ssl:/output
#  command: >
#   file
#   --watch
#   --version v2
#   --dest /output
#  deploy:
#   restart_policy:
#    condition: any

Open backup.yourdomain,org in a web browser and set up your backups.

Tag summary

Content type

Image

Digest

Size

281.7 MB

Last updated

about 6 years ago

docker pull georgegeorgulasiv/duplicati