Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Self-build traefik has no dashboard #6015

Closed
shibumi opened this issue Dec 12, 2019 · 8 comments
Closed

Self-build traefik has no dashboard #6015

shibumi opened this issue Dec 12, 2019 · 8 comments

Comments

@shibumi
Copy link

shibumi commented Dec 12, 2019

Do you want to request a feature or report a bug?

Bug

What did you do?

I have build traefik from source via:

go generate
cd cmd/traefik
go build -trimpath -ldflags "-extldflags ${LDFLAGS}"

My LDFLAGS are: "-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now"

What did you expect to see?

The binary should be able to serve a dashboard. When I use this traefik.yml file:

---

providers:
  file:
    filename: /tmp/traefik.yml

log:
  level: debug

api:
  dashboard: True

entryPoints:
  web:
    address: ":8080"
  metrics:
    address: ":8082"

metrics:
  prometheus:
    entryPoint: metrics

accessLog: {}

http:
  routers:
    api-router:
      rule: "PathPrefix(`/api`) || PathPrefix(`/dashboard`)"
      service: api@internal
      entryPoints:
        - web
      tls: {}

What did you see instead?

I get 404 for https://localhost:8080/dashboard and for https://localhost:8080/dashboard/.

The metrics work, the binary starts up and I see no errors.
Debug log:

INFO[0000] Configuration loaded from file: /tmp/traefik.yml 
INFO[2019-12-12T15:12:01+01:00] Traefik version dev built on I don't remember exactly 
DEBU[2019-12-12T15:12:01+01:00] Static configuration loaded {"global":{"checkNewVersion":true},"serversTransport":{"maxIdleConnsPerHost":200},"entryPoints":{"metrics":{"address":":8082","transport":{"lifeCycle":{"graceTimeOut":10000000000},"respondingTimeouts":{"idleTimeout":180000000000}},"forwardedHeaders":{}},"web":{"address":":8080","transport":{"lifeCycle":{"graceTimeOut":10000000000},"respondingTimeouts":{"idleTimeout":180000000000}},"forwardedHeaders":{}}},"providers":{"providersThrottleDuration":2000000000,"file":{"watch":true,"filename":"/tmp/traefik.yml"}},"api":{"dashboard":true},"metrics":{"prometheus":{"buckets":[0.1,0.3,1.2,5],"addEntryPointsLabels":true,"addServicesLabels":true,"entryPoint":"metrics"}},"log":{"level":"debug","format":"common"},"accessLog":{"format":"common","filters":{},"fields":{"defaultMode":"keep","headers":{"defaultMode":"drop"}}}} 
INFO[2019-12-12T15:12:01+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-12-12T15:12:01+01:00] Configured Prometheus metrics                 metricsProviderName=prometheus
DEBU[2019-12-12T15:12:01+01:00] Creating middleware                           middlewareType=Metrics entryPointName=metrics middlewareName=metrics-entrypoint
DEBU[2019-12-12T15:12:01+01:00] Creating middleware                           middlewareName=metrics-entrypoint entryPointName=web middlewareType=Metrics
DEBU[2019-12-12T15:12:01+01:00] No default certificate, generating one       
INFO[2019-12-12T15:12:02+01:00] Starting provider aggregator.ProviderAggregator {} 
DEBU[2019-12-12T15:12:02+01:00] Start TCP Server                              entryPointName=web
DEBU[2019-12-12T15:12:02+01:00] Start TCP Server                              entryPointName=metrics
INFO[2019-12-12T15:12:02+01:00] Starting provider *file.Provider {"watch":true,"filename":"/tmp/traefik.yml"} 
DEBU[2019-12-12T15:12:02+01:00] Configuration received from provider file: {"http":{"routers":{"api-router":{"entryPoints":["web"],"service":"api@internal","rule":"PathPrefix(`/api`) || PathPrefix(`/dashboard`)","tls":{}}}},"tcp":{},"tls":{}}  providerName=file
DEBU[2019-12-12T15:12:02+01:00] Added outgoing tracing middleware api@internal  entryPointName=web routerName=api-router@file middlewareName=tracing middlewareType=TracingForwarder
DEBU[2019-12-12T15:12:02+01:00] Creating middleware                           middlewareName=traefik-internal-recovery middlewareType=Recovery entryPointName=web
DEBU[2019-12-12T15:12:02+01:00] Creating middleware                           entryPointName=metrics middlewareName=metrics-entrypoint middlewareType=Metrics
DEBU[2019-12-12T15:12:02+01:00] Creating middleware                           middlewareType=Metrics entryPointName=web middlewareName=metrics-entrypoint
DEBU[2019-12-12T15:12:02+01:00] Creating middleware                           middlewareType=Metrics entryPointName=web middlewareName=metrics-entrypoint
DEBU[2019-12-12T15:12:02+01:00] No default certificate, generating one       
DEBU[2019-12-12T15:12:07+01:00] Serving default certificate for request: "localhost" 
::1 - - [12/Dec/2019:14:12:15 +0000] "GET /dashboard/ HTTP/2.0" 404 19 "-" "-" 1 "api-router@file" - 0ms
::1 - - [12/Dec/2019:14:12:18 +0000] "GET /dashboard HTTP/2.0" 404 19 "-" "-" 2 "api-router@file" - 0ms

Output of traefik version: (What version of Traefik are you using?)

Codename:     cheddar
Go version:   go1.13.5
Built:        I don't remember exactly
OS/Arch:      linux/amd64
@ldez
Copy link
Member

ldez commented Dec 12, 2019

Duplicate of #5936, #5934

# Generate UI
rm -rf static/ autogen/; make generate-webui

# generate the UI binary mapping.
go generate

# build Traefik
go build ./cmd/traefik/ -trimpath -ldflags "-extldflags ${LDFLAGS}"

I will improve the doc: https://docs.traefik.io/v2.1/contributing/building-testing/#method-2-using-go

@shibumi
Copy link
Author

shibumi commented Dec 12, 2019

@ldez actually this doesn't solve my problem.
I need a way to build traefik without docker.

I want to package traefik for a linux distribution and we can't pull in docker containers just for building static websites.

Could you please describe a way how to build the web-ui without docker? I am totally fine about adding nodejs and others as build dependency. I am just looking for a documentation on how to build traefik without docker on a linux host.

Furthermore I get this error when applying this on your tarball:

fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git

@ldez
Copy link
Member

ldez commented Dec 12, 2019

So you have to use https://github.com/containous/traefik/releases/download/v2.1.0/traefik-v2.1.0.src.tar.gz

And don't use the Makefile.

@shibumi
Copy link
Author

shibumi commented Dec 12, 2019

@ldez
I have tried version 2.1.0 same result.

I tried:

go generate
cd cmd/traefik
go build -trimpath -ldflags "-extldflags ${LDFLAGS}"

and I tried (because you said I should not use the makefile):

rm -rf static/ autogen/
go generate
cd cmd/traefik
go build -trimpath -ldflags "-extldflags ${LDFLAGS}"

Same result. I get no API via: traefik -api. The webserver spawns up successfuly on port 80, but there is no dashboard on /dashboard nor on /dashboard/ for http or https.

@ldez
Copy link
Member

ldez commented Dec 12, 2019

Without Docker and with the WebUI:

# https://github.com/containous/traefik/releases/download/v2.1.0/traefik-v2.1.0.src.tar.gz

tar -xzf traefik-v2.1.0.src.tar.gz
go generate
go run ./cmd/traefik/ --entrypoints.web.address=:9090 --api.insecure
$ curl localhost:8080/dashboard/
<!DOCTYPE html><html><head><title>Traefik</title><meta charset=utf-8><meta name=description content="Traefik UI"><meta name=format-detection content="telephone=no"><meta name=msapplication-tap-highlight content=no><meta name=viewport content="user-scalable=no,initial-scale=1,maximum-scale=1,minimum-scale=1,width=device-width"><link rel=icon type=image/png href=statics/app-logo-128x128.png><link rel=icon type=image/png sizes=16x16 href=statics/icons/favicon-16x16.png><link rel=icon type=image/png sizes=32x32 href=statics/icons/favicon-32x32.png><link rel=icon type=image/png sizes=96x96 href=statics/icons/favicon-96x96.png><link rel=icon type=image/ico href=statics/icons/favicon.ico><link href=css/019be8e4.d05f1162.css rel=prefetch><link href=css/099399dd.9310dd1b.css rel=prefetch><link href=css/0af0fca4.e3d6530d.css rel=prefetch><link href=css/162d302c.9310dd1b.css rel=prefetch><link href=css/29ead7f5.9310dd1b.css rel=prefetch><link href=css/31ad66a3.9310dd1b.css rel=prefetch><link href=css/524389aa.619bfb84.css rel=prefetch><link href=css/61674343.9310dd1b.css rel=prefetch><link href=css/63c47f2b.294d1efb.css rel=prefetch><link href=css/691c1182.ed0ee510.css rel=prefetch><link href=css/7ba452e3.37efe53c.css rel=prefetch><link href=css/87fca1b4.8c8c2eec.css rel=prefetch><link href=js/019be8e4.d8726e8b.js rel=prefetch><link href=js/099399dd.a047d401.js rel=prefetch><link href=js/0af0fca4.271bd48d.js rel=prefetch><link href=js/162d302c.ce1f9159.js rel=prefetch><link href=js/29ead7f5.cd022784.js rel=prefetch><link href=js/2d21e8fd.f3d2bb6c.js rel=prefetch><link href=js/31ad66a3.12ab3f06.js rel=prefetch><link href=js/524389aa.21dfc9ee.js rel=prefetch><link href=js/61674343.adb358dd.js rel=prefetch><link href=js/63c47f2b.caf9b4a2.js rel=prefetch><link href=js/691c1182.5d4aa4c9.js rel=prefetch><link href=js/7ba452e3.71a69a60.js rel=prefetch><link href=js/87fca1b4.ac9c2dc6.js rel=prefetch><link href=css/app.e4fba3f1.css rel=preload as=style><link href=js/app.841031a8.js rel=preload as=script><link href=js/vendor.49a1849c.js rel=preload as=script><link href=css/app.e4fba3f1.css rel=stylesheet><link rel=manifest href=manifest.json><meta name=theme-color content=#027be3><meta name=apple-mobile-web-app-capable content=yes><meta name=apple-mobile-web-app-status-bar-style content=default><meta name=apple-mobile-web-app-title content=Traefik><link rel=apple-touch-icon href=statics/icons/apple-icon-120x120.png><link rel=apple-touch-icon sizes=180x180 href=statics/icons/apple-icon-180x180.png><link rel=apple-touch-icon sizes=152x152 href=statics/icons/apple-icon-152x152.png><link rel=apple-touch-icon sizes=167x167 href=statics/icons/apple-icon-167x167.png><link rel=mask-icon href=statics/icons/safari-pinned-tab.svg color=#027be3><meta name=msapplication-TileImage content=statics/icons/ms-icon-144x144.png><meta name=msapplication-TileColor content=#000000></head><body><div id=q-app></div><script type=text/javascript src=js/app.841031a8.js></script><script type=text/javascript src=js/vendor.49a1849c.js></script></body></html>

Also I recommend to not mix the static and the dynamic configuration in the same file.


With your configuration

$ curl -k https://localhost:8080/dashboard/
<!DOCTYPE html><html><head><title>Traefik</title><meta charset=utf-8><meta name=description content="Traefik UI"><meta name=format-detection content="telephone=no"><meta name=msapplication-tap-highlight content=no><meta name=viewport content="user-scalable=no,initial-scale=1,maximum-scale=1,minimum-scale=1,width=device-width"><link rel=icon type=image/png href=statics/app-logo-128x128.png><link rel=icon type=image/png sizes=16x16 href=statics/icons/favicon-16x16.png><link rel=icon type=image/png sizes=32x32 href=statics/icons/favicon-32x32.png><link rel=icon type=image/png sizes=96x96 href=statics/icons/favicon-96x96.png><link rel=icon type=image/ico href=statics/icons/favicon.ico><link href=css/019be8e4.d05f1162.css rel=prefetch><link href=css/099399dd.9310dd1b.css rel=prefetch><link href=css/0af0fca4.e3d6530d.css rel=prefetch><link href=css/162d302c.9310dd1b.css rel=prefetch><link href=css/29ead7f5.9310dd1b.css rel=prefetch><link href=css/31ad66a3.9310dd1b.css rel=prefetch><link href=css/524389aa.619bfb84.css rel=prefetch><link href=css/61674343.9310dd1b.css rel=prefetch><link href=css/63c47f2b.294d1efb.css rel=prefetch><link href=css/691c1182.ed0ee510.css rel=prefetch><link href=css/7ba452e3.37efe53c.css rel=prefetch><link href=css/87fca1b4.8c8c2eec.css rel=prefetch><link href=js/019be8e4.d8726e8b.js rel=prefetch><link href=js/099399dd.a047d401.js rel=prefetch><link href=js/0af0fca4.271bd48d.js rel=prefetch><link href=js/162d302c.ce1f9159.js rel=prefetch><link href=js/29ead7f5.cd022784.js rel=prefetch><link href=js/2d21e8fd.f3d2bb6c.js rel=prefetch><link href=js/31ad66a3.12ab3f06.js rel=prefetch><link href=js/524389aa.21dfc9ee.js rel=prefetch><link href=js/61674343.adb358dd.js rel=prefetch><link href=js/63c47f2b.caf9b4a2.js rel=prefetch><link href=js/691c1182.5d4aa4c9.js rel=prefetch><link href=js/7ba452e3.71a69a60.js rel=prefetch><link href=js/87fca1b4.ac9c2dc6.js rel=prefetch><link href=css/app.e4fba3f1.css rel=preload as=style><link href=js/app.841031a8.js rel=preload as=script><link href=js/vendor.49a1849c.js rel=preload as=script><link href=css/app.e4fba3f1.css rel=stylesheet><link rel=manifest href=manifest.json><meta name=theme-color content=#027be3><meta name=apple-mobile-web-app-capable content=yes><meta name=apple-mobile-web-app-status-bar-style content=default><meta name=apple-mobile-web-app-title content=Traefik><link rel=apple-touch-icon href=statics/icons/apple-icon-120x120.png><link rel=apple-touch-icon sizes=180x180 href=statics/icons/apple-icon-180x180.png><link rel=apple-touch-icon sizes=152x152 href=statics/icons/apple-icon-152x152.png><link rel=apple-touch-icon sizes=167x167 href=statics/icons/apple-icon-167x167.png><link rel=mask-icon href=statics/icons/safari-pinned-tab.svg color=#027be3><meta name=msapplication-TileImage content=statics/icons/ms-icon-144x144.png><meta name=msapplication-TileColor content=#000000></head><body><div id=q-app></div><script type=text/javascript src=js/app.841031a8.js></script><script type=text/javascript src=js/vendor.49a1849c.js></script></body></html>

@shibumi
Copy link
Author

shibumi commented Dec 13, 2019

Hi @ldez,
I can't reproduce this in a clean environment. I still get a 404 page not found:

I have the following dependencies installed:

go (with PIE enabled)
git
go-bindata
glibc

Then I do:

go generate -v
cd cmd/traefik
go build -v -trimpath-ldflags "-extldflags ${LDFLAGS}"

This is the sha512sum for the tarball: 39f152117fb1893c056ec227428ec7246a21ae6c7d679a6fe8e1e0049a67b85ff7e3c7646974a768fda48ef320e97732e0ffa0701ca45aeb75c1c0386f135436

I do in Terminal 1:

❯ traefik --entrypoints.web.address=:9090 --api.insecure
INFO[0000] Configuration loaded from flags.

In terminal 2:

❯ curl localhost:8080/dashboard/
404 page not found
❯ curl localhost:9090/dashboard/
404 page not found

Here is the log output of go generate -v und go build -v ...:
https://paste.xinu.at/ZYUdW/

Do I need any other special dependencies for generating the static website content? nodejs etc? I am building in a clean arch linux systemd-nspawn container. And it's definitely not working.

@shibumi
Copy link
Author

shibumi commented Dec 13, 2019

Could this be an issue with our go-bindata version? https://github.com/shuLhan/go-bindata (This is the actual maintained source of go-bindata right now.. no idea why every project I meet is shipping their old go-bindata version that didn't get an update since ages).

@ldez
Copy link
Member

ldez commented Dec 13, 2019

https://github.com/containous/traefik/releases/download/v2.1.0/traefik-v2.1.0.src.tar.gz

This tarball contains the static files of the WebUI, so you do not need to generate them.

You only need to generate the binary binding with go-bindata.


We use our fork due to the "fake" root repo: https://github.com/jteeuwen/go-bindata

From our documentation:

# Get go-bindata. (Important: the ellipses are required.)
GO111MODULE=off go get -u github.com/containous/go-bindata/..

https://docs.traefik.io/v2.1/contributing/building-testing/#build-traefik


FYI there are several maintained forks:

Maybe the future will be an implementation by the Go team: golang/go#35950

@traefik traefik locked and limited conversation to collaborators Jan 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants