If you end up on this page, it's maybe because you asked yourself the same as me: how to make a simple webdav server running in a docker, routed by traefik. Maybe just like me you avoided sftpgo because it can do too much.
And that's true, but it's also super-simple to configure it for this use-case!
Here is the docker-compose.yaml
configuration I use, it works, it's easy to understand.
services:
webdav:
image: drakkan/sftpgo:v2.5
volumes:
- type: bind
source: /path/to/my/files
target: /srv/sftpgo/data/my-folder
- type: bind
source: ./config # This folder must be `chown -R 1000:1000`
target: /var/lib/sftpgo
environment:
# This env var enables webdav integration and specifies its port binding
SFTPGO_WEBDAVD__BINDINGS__0__PORT: '8090'
restart: always
networks:
- custom_traefik_network
labels:
# We need to route the port for webdav
- "traefik.enable=true"
- "traefik.http.routers.webdav.entryPoints=websecure"
- "traefik.http.routers.webdav.rule=Host(`webdav.you.com`)"
- "traefik.http.routers.webdav.priority=2"
- "traefik.http.routers.webdav.tls.certresolver=your_cert_resolver"
- "traefik.http.routers.webdav.tls.domains[0].main=webdav.you.com"
- "traefik.http.routers.webdav.service=webdav"
- "traefik.http.services.webdav.loadbalancer.server.port=8090"
# And the port to access the UI
- "traefik.http.routers.ui_webdav.entryPoints=websecure"
- "traefik.http.routers.ui_webdav.rule=Host(`ui-webdav.you.com`)"
- "traefik.http.routers.ui_webdav.priority=2"
- "traefik.http.routers.ui_webdav.tls.certresolver=your_cert_resolver"
- "traefik.http.routers.ui_webdav.tls.domains[0].main=ui-webdav.you.com"
- "traefik.http.routers.ui_webdav.service=ui_webdav"
- "traefik.http.services.ui_webdav.loadbalancer.server.port=8080"
networks:
custom_traefik_network:
external: true
Once you run this configuration, you can go to ui-webdav.you.com
and setup your sftpgo installation. You now need one last thing: add a user and specify its folder (inside the sftpgo docker). In this example the path would have been /srv/sftpgo/data/my-folder
.
I hope this helped you! ✌️