Rest-server with traefik

I’m trying to setup the rest-server with traefik.
Here is my compose file:

version: '2'

    container_name: rest-server
    image: restic/rest-server:latest
    restart: unless-stopped
      - /data/remote/restic:/data
      - OPTIONS=--debug --no-auth
      - traefik.enable=true

Unfortunately I’m not able to create a repo. I tried following commands on a remote machine:

restic -r rest: init

results in:

Fatal: server response unexpected: 504 Gateway Timeout (504)


restic -r rest: init

Results in:

Post "": dial tcp [<myserverip>]:8000: i/o timeout

I know my “certresolver” (lecrypt) is working correctly, as I’m using it for other services and it also does not fail to create a certificate for “”.

Aren’t you missing a Traefik entrypoint? Here’s mine which is working fine:

version: '3.4'

      name: traefik

# In Synology, the permissions must be `R/W`, `No mapping`, `Yes`, `Allowed`, `Allowed`.
# [
      type: "nfs"
      o: "addr=,nolock,soft,rw"
      device: ":/volume1/restic"

# Restic-server:
    image: restic/rest-server:0.10.0
    container_name: restic
    restart: "no"
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Lisbon
      - OPTIONS=--no-auth --prometheus
      - nas:/data
      - traefik
      - traefik.enable=true
      - traefik.http.routers.restic.rule=Host(``)
      - traefik.http.routers.restic.entrypoints=web
      - traefik.http.routers.restic.tls=false

And remember that in the Traefik configuration you must also define the entrypoint:

  address = ":80"


And in the Traefik docker-compose file you must assign the chosen port:

    image: "traefik:2.3.0"
    container_name: traefik
    restart: unless-stopped
      - "80:80"

I hope this helps.

1 Like

Thanks @nununo for the hint.

I configured my entrypoints globally in the static config.
You would only set the entrypoints for a router if you would want to limit them to a particular set of entrypoints for this router (see docs).
All my other services work fine like that.

Any reason you do not redirect to https or is it just for the minimal example?
I also have a global config that redirects all http traffic to https.

1 Like

Ah, thanks for the details on entrypoints. I didn’t know that so I always make them explicit.

Did you manage to make yours work? Mine is working fine.

As for why I’m not using TLS… the answer is: I will. It’s in my ToDo list :wink: The service is internal to my LAN so not a big deal but, still, I have an internal CA and make a point of using TLS on all my internal services. Anyway, thanks for bringing that to my attention.

1 Like

@nununo well if you just use it internal then ofc its no problem, but then why do you use traefik at all?

Its always the same with traefik… I forget one litte config and it takes me way to long to figure out whats missing :smiley:
I should really make a checklist.
This time I forgot to set the external network, so thx @nununo you helped me out after all :smiley:
The weird thing was that I was still getting responses to the restic domain in the traefik debug log, so I thought it was working alright.

1 Like

Ho @ozboss,

Glad you found your problem! :slight_smile:

Well, I have a local CA and I issue (internal) certificates for all my local servers. I use Traefik for 2 reasons:

  • as a reverse proxy to assign a different subdomain to each service, even when they are hosted under the same IP;
  • to automatically apply the internal TLS certificates to each of those certificates.

I do this because:

  • With internal certificates I avoid all those browser warnings;
  • The multiple subdomains allow me to use default port 443 for most of the services instead of using a shared FQDN and use an obscure port numbers for each service;
  • It’s an opportunity to learn how to use yet another amazing tool;