Traefik on QNAP

Hi,

I try to use traefik on my qnap nas.
I installed it as a qpkg from the store.
im using this version:

Sadly i didn´t get it to up and running.

If i run this command:
traefik --log.level=DEBUG

This is the whole output:

INFO[0000] Configuration loaded from flags.
INFO[2019-11-27T02:34:36+01:00] Traefik version 2.0.0 built on 2019-09-16T17:35:17Z
DEBU[2019-11-27T02:34:36+01:00] Static configuration loaded {"global":{"checkNewVersion":true},"serversTransport":{"maxIdleConnsPerHost":200},"entryPoints":{"http":{"address":":80","transport":{"lifeCycle":{"graceTimeOut":10000000000},"respondingTimeouts":{"idleTimeout":180000000000}},"forwardedHeaders":{}}},"providers":{"providersThrottleDuration":2000000000},"log":{"level":"DEBUG","format":"common"}}
INFO[2019-11-27T02:34:36+01:00]
Stats collection is disabled.
Help us improve Traefik by turning this feature on :)
More details on: https://docs.traefik.io/v2.0/contributing/data-collection/
DEBU[2019-11-27T02:34:36+01:00] No default certificate, generating one
INFO[2019-11-27T02:34:36+01:00] Starting provider aggregator.ProviderAggregator {}
DEBU[2019-11-27T02:34:36+01:00] Start TCP Server                              entryPointName=http
WARN[2019-11-27T02:44:37+01:00] A new release has been found: 2.0.5. Please consider updating.

I don´t see any conflicts in port as all other devices a running of different ports from 80 and 443.

Could you all be so kind and help me out to get the web interface running?

I recently had a friend with a QNAP dealing with issues with the container network on the QNAP'OS: it looks like there are a lot of different network interfaces.

How are you running Traefik? It seems you are running it as a binary "as-it": can you use netstat -anp to list the opened ports and check which one are used by Traefik's PID?

So the Dashboard is now running.
The issues was that the Default values which are mentioned in the toml page aren´t defaut.
So the Dashbaord wasn´t enabled.

Where do i put my configuration for middleware and so on?

the dashboard is enabled only if the section api (e.g. enabling the API) is already done, as per API | Traefik | v2.0 :slight_smile:

I'm not sure to understand what do you mean ?

Yes but it didn´t showed up on the ip.
First as I enabled cahnged the config a little bit.

But now im stuck with the Router and Services.
For a easy going start I would like to pass ombi trought traefic.

And to come in touch with the hole process i would like to start with a static routing.

So i aded this to my traefik.toml

################################################################
# Router configuration
################################################################

[http.routers]
  [http.routers.my-router]
    rule = "Path(`/ombi`)"
    service = "service-ombi"


################################################################
# Services configuration
################################################################


[http.services]
  [http.services.service-ombi.loadBalancer]
    [[http.services.service-ombi.loadBalancer.servers]]
      url = "http://192.168.4.3:8976"

As I understand this is the way to configure it for traefik 2.

But if i change on the webpage it tells me there are no services or routers.

Update:

Uff my bad i should read with a little more patient.
I didn´t undersatnd i need to make a adittional file.
or it was more an issue i didn´t defined [http].

Update2:

Ok I am making some Progress.
At my example with ombi.
I now come to a landing page where it tells me loading.
It seems to me usually it would redirect me to /login but this seems to not work anymore.

Do i need to get in touch with the middleware?

Ok even get a step further on most of the services is tried.
But ombi still doesn´t wan´t load anything.
Aswell the other webpages look super shitty.

There are no javascript designs.
The webage itself claims in chrome some 404 errors not found.
I think the are not passed thour traefik.

I turned late maybe you could help me out tomorrow.

Hi @9Mad-Max5 happy to hear you did a lot of progress an learning!

Can you share with us (if you want help):

  • Full Traefik configuration (traefik.toml file and any other file containing the routers and middlewares
  • the screentshot of web developer console from webbrowser, to you can see the bad requests
  • extract of ombi HTML code you get for the index.html: it will help to study the issue

HI @dduportal

Yes for sure i will do.

traefik.toml

################################################################
#
# Configuration sample for Traefik v2.
#
# For Traefik v1: https://github.com/containous/traefik/blob/v1.7/traefik.sample.toml
#
################################################################

################################################################
# Global configuration
################################################################
[global]
  checkNewVersion = true
  sendAnonymousUsage = true

################################################################
# Entrypoints configuration
################################################################

# Entrypoints definition
#
# Optional
# Default:
[entryPoints]
  [entryPoints.web]
    address = ":80"

  [entryPoints.websecure]
    address = ":443"
	
  [entryPoints.traefik]
    address = ":8080"

################################################################
# Traefik logs configuration
################################################################

# Traefik logs
# Enabled by default and log to stdout
#
# Optional
#
[log]

  # Log level
  #
  # Optional
  # Default: "ERROR"
  #
  level = "DEBUG"

  # Sets the filepath for the traefik log. If not specified, stdout will be used.
  # Intermediate directories are created if necessary.
  #
  # Optional
  # Default: os.Stdout
  #
  filePath = "/share/CACHEDEV1_DATA/.qpkg/Traefik/traefik.log"

  # Format is either "json" or "common".
  #
  # Optional
  # Default: "common"
  #
  # format = "json"

################################################################
# Access logs configuration
################################################################

# Enable access logs
# By default it will write to stdout and produce logs in the textual
# Common Log Format (CLF), extended with additional fields.
#
# Optional
#
# [accessLog]

  # Sets the file path for the access log. If not specified, stdout will be used.
  # Intermediate directories are created if necessary.
  #
  # Optional
  # Default: os.Stdout
  #
  # filePath = "/path/to/log/log.txt"

  # Format is either "json" or "common".
  #
  # Optional
  # Default: "common"
  #
  # format = "json"

################################################################
# API and dashboard configuration
################################################################

# Enable API and dashboard
[api]

  # Enable the API in insecure mode
  #
  # Optional
  # Default: true
  #
  insecure = true

  # Enabled Dashboard
  #
  # Optional
  # Default: true
  #
  dashboard = true
  debug = true
  
################################################################
# Ping configuration
################################################################

# Enable ping
[ping]

  # Name of the related entry point
  #
  # Optional
  # Default: "traefik"
  #
  # entryPoint = "traefik"

################################################################
# Docker configuration backend
################################################################

# Enable Docker configuration backend
# [providers.docker]

  # Docker server endpoint. Can be a tcp or a unix socket endpoint.
  #
  # Required
  # Default: "unix:///var/run/docker.sock"
  #
  # endpoint = "tcp://10.10.10.10:2375"

  # Default host rule.
  #
  # Optional
  # Default: "Host(`{{ normalize .Name }}`)"
  #
  # defaultRule = "Host(`{{ normalize .Name }}.docker.localhost`)"

  # Expose containers by default in traefik
  #
  # Optional
  # Default: true
  #
  # exposedByDefault = false
  
################################################################
# Provider file
################################################################
[providers.file]
  filename = "/share/CACHEDEV1_DATA/.qpkg/Traefik/dynamic_conf.toml"

dynamic_conf.toml

[http]
  # Add the router
  [http.routers]
  
  #OMBI-Router
    [http.routers.router-ombi]
      entryPoints = ["web"]
      service = "service-ombi"
	  middlewares = ["all-stripprefix"]
      rule = "Path(`/ombi`)"

  #RSSCrawler
    [http.routers.router-rsscrawler]
      entryPoints = ["web"]
      service = "service-rsscrawler"
	  middlewares = ["all-stripprefix"]
      rule = "Path(`/rsscrawler`)"

  #pihole
    [http.routers.router-pihole]
      entryPoints = ["web"]
      service = "service-pihole"
	  middlewares = ["all-stripprefix"]
      rule = "Path(`/pihole`)"

  #ddwrt
    [http.routers.router-ddwrt]
      entryPoints = ["web"]
      service = "service-ddwrt"
	  middlewares = ["all-stripprefix"]
      rule = "Path(`/ddwrt`)"
	  
#  [http.middlewares]
#    # Define an authentication mechanism
#    [http.middlewares.test-user.basicAuth]
#      users = ["test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/"]
   # Strip prefix /foobar and /fiibar
   [http.middlewares]
     [http.middlewares.all-stripprefix.stripPrefix]
     prefixes = ["/ombi", "/rsscrawler", "/pihole", "/ddwrt"]



    # Add the service
    [http.services]
	
    #OMBI-Service
      [http.services.service-ombi]
        [http.services.service-ombi.loadBalancer]
          [[http.services.service-ombi.loadBalancer.servers]]
            url = "http://192.168.4.3:8976"
			
	#rsscrawler-Service
      [http.services.service-rsscrawler]
        [http.services.service-rsscrawler.loadBalancer]
          [[http.services.service-rsscrawler.loadBalancer.servers]]
            url = "http://192.168.4.3:9090"
			
    #pihole-Service
      [http.services.service-pihole]
        [http.services.service-pihole.loadBalancer]
          [[http.services.service-pihole.loadBalancer.servers]]
            url = "http://192.168.4.10:80"
			
    #ddwrt-Service
      [http.services.service-ddwrt]
        [http.services.service-ddwrt.loadBalancer]
          [[http.services.service-ddwrt.loadBalancer.servers]]
            url = "http://192.168.4.5:80"

2019-11-29%2012_05_16-Window

And the HTML Code

<!DOCTYPE html>
<html>
<head>
    <!--





                                              bbbbbbbb
         OOOOOOOOO                            b::::::b              iiii
       OO:::::::::OO                          b::::::b             i::::i
     OO:::::::::::::OO                        b::::::b              iiii
    O:::::::OOO:::::::O                        b:::::b
    O::::::O   O::::::O   mmmmmmm    mmmmmmm   b:::::bbbbbbbbb    iiiiiii
    O:::::O     O:::::O mm:::::::m  m:::::::mm b::::::::::::::bb  i:::::i
    O:::::O     O:::::Om::::::::::mm::::::::::mb::::::::::::::::b  i::::i
    O:::::O     O:::::Om::::::::::::::::::::::mb:::::bbbbb:::::::b i::::i
    O:::::O     O:::::Om:::::mmm::::::mmm:::::mb:::::b    b::::::b i::::i
    O:::::O     O:::::Om::::m   m::::m   m::::mb:::::b     b:::::b i::::i
    O:::::O     O:::::Om::::m   m::::m   m::::mb:::::b     b:::::b i::::i
    O::::::O   O::::::Om::::m   m::::m   m::::mb:::::b     b:::::b i::::i
    O:::::::OOO:::::::Om::::m   m::::m   m::::mb:::::bbbbbb::::::bi::::::i
     OO:::::::::::::OO m::::m   m::::m   m::::mb::::::::::::::::b i::::::i
       OO:::::::::OO   m::::m   m::::m   m::::mb:::::::::::::::b  i::::::i
         OOOOOOOOO     mmmmmm   mmmmmm   mmmmmmbbbbbbbbbbbbbbbb   iiiiiiii







         -->
         
    <meta charset="utf-8" />
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <meta name="description" content="Ombi, media request tool">
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Ombi</title>
    <meta property="og:title" content=“Ombi” />
    <meta property="og:image" content="~/images/logo.png" />
    <meta property="og:site_name" content=“Ombi” />
    <base href="/" />
    <link rel="apple-touch-icon" sizes="180x180" href="/images/favicon/apple-touch-icon.png">
    <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon/favicon-32x32.png">
    <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon/favicon-16x16.png">
    <link rel="mask-icon" href="/images/favicon/safari-pinned-tab.svg" color="#df691a">
    <link rel="shortcut icon" href="/images/favicon/favicon.ico">
    <meta name="msapplication-TileColor" content="#df691a">
    <meta name="msapplication-config" content="~/images/favicon/browserconfig.xml">
    <meta name="theme-color" content="#df691a">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="mobile-web-app-capable" content="yes">
    
        <!-- Global site tag (gtag.js) - Google Analytics -->
        <script async src="https://www.googletagmanager.com/gtag/js?id=UA-89270627-3"></script>
        <script>
            window.dataLayer = window.dataLayer || [];
            function gtag(){dataLayer.push(arguments);}
            gtag('js', new Date());

            gtag('config', 'UA-89270627-3');
        </script>

    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">

    <link rel="stylesheet" href="/loading.css?v=k33zb3c0-ToEQSx13OJIBKNSzNyG6g4V29uA0YpYiV0" />
    <link rel="stylesheet" href="/dist/vendor.css?v=A5VSEkY8uq7pAj1OkaY6vaxKY0-yZsGZSG_UJMjE8Vg" />
    
    <script src="/dist/app.js?v=b69V2Z-Ohq8wKOWUnx8mEI34Pnciq-ap8z8WV5Z3lY8" defer></script>
</head>
<body>

    <ombi>
    <div class="app-loading-container">

        <div class="app-loading">
            Loading
            <span class="app-loading-one">.</span>
            <span class="app-loading-two">.</span>
            <span class="app-loading-three">.</span>
        </div>
    </div>
</ombi>

</body>
</html>

Can you try setting Ombi's baseurl to /ombi on Ombi's side (reference: https://github.com/tidusjar/Ombi/wiki/Startup-Parameters#--baseurl).

Based on the HTML content, omni expect to be exposed under the / basepath, so the links it generates are not starting with /ombi as it should.

Ok I set the base url to /ombi.

But it is still not working.
The erros changed a little bit.
2019-11-29%2012_55_01-Window

It seems to me the MIME messages comes up in all services.
But sadly i don´t get what it is or what it trys to tell me

The important error in your case is the "Failed to load resource: the server responded with a status of 404 (Not Found)". Can you check the network tab of you inspector and locate all the resources in error?

(Don't forget to clean your cache: if you did not, then the HTML code is the one from before,)

After clearing the chache with ccleaner this is the output in the console.

2019-11-29%2016_16_13-Window

If i refresh the page the 404 error dissapears.
Could it be that all the */images/favicon/apple-touch-icon.png and all these informations don get throug traefik.

So it loks like only the plain request but all additional informations like pictures get blocked.

Can you share the errors from the network tab please?

For sure

2019-11-29%2016_41_12-Window

Oh man I am so dumb.

PathPrefix handles the issue.
Path which is used former only allows the exact prefix.
If there are coming some more requests they get blocked.

@dduportal

Ombi is running the favicons are not running.
But i am not sure why it doesn´t.

Aswell i would like to interact with mi pihole web interface.

So i changed the pihole router because it is running on /admin.

    #pihole-Service
      [http.services.service-pihole]
        [http.services.service-pihole.loadBalancer]
          [[http.services.service-pihole.loadBalancer.servers]]
            url = "http://192.168.4.10/admin"

But that doesn´t work out

Hi @dduportal I need once more your help.

I made some progress these days.
I`m connecting to my server with the already existing ddns and the using prefixes to determine the service. As for ombi it worked out to change the base url.
But for the other services i didn´t found such a option.

So i need to strip my prefix from the domain im calling.
But here is where the issue begins. As I need to load some additional data after calling the sites it fails.

Due to the lack of the prefix which now aswell is missing in the response.

Is there as possiblity to add a prefix during the response?

Hi @9Mad-Max5, alas it not possible, since this would mean modifying the body of the HTTP answers, which would be more the job for a web (or caching) server, while Traefik only operates at URL / headers level as a pure reverse-proxy.

There is one easy solution: using subdomain for each application. Let's say you have the domain home.madmax.io, then you can create a wildcard DNS record *.home.madmax.io pointing to your IP, and then adapt the frontend rules: rule=Host(`ombi.madmax.io`) for ombi for instance (and remove any addprefix or stripprefx thingy).

Would that be an option for you?

Hi @dduportal

actually for some pages the solution was already to add a slash after my prefix.

But I didn´t like to use it with a prefix, just my personal opinion, and a add prefix after stripping the old one didn´t worked i just made a redirect with a new middleware and a additional router.

I think i will post it here later as a example.

But not for all traefik it self as an example didn´t helped it.

Is there a option for a Base url in traefik itself?

Because QNAP has a Let´s enrypt engine and a DDNS already builed in i didn´t use acme.

So im stuck to the myqnapcloud.com domain but that honestly don´t bother me.

I just need to import the bare certificats which are stored on the nas itself in traefik and my https is running.

But due to this i can´t change the beginning ot the domain.

And i don´t wan´t to buy a no-ip account to have multiple domains, because three are not enought and the reactivation of multiples ones is just anyoning.

It is just a private server.

And as long it works with prefixes I will stick to those.

So in most of my cases the backslash at the end worked out quite well.

Even Traefik works now fine with api@internal as a service.

1 Like