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

compact: --web.external-prefix does not work #2338

Closed
sepich opened this issue Mar 29, 2020 · 4 comments
Closed

compact: --web.external-prefix does not work #2338

sepich opened this issue Mar 29, 2020 · 4 comments

Comments

@sepich
Copy link
Contributor

sepich commented Mar 29, 2020

Thanos, Prometheus and Golang version used:
master-2020-03-27-4e5c2f25

Object Storage Provider:
GCP

What happened:
I'm trying to get new web UI of thanos-compact behind reverse proxy under path /bucket.
Starting container wit such arguments:

          args:
          - compact
          - --wait
          - --web.external-prefix=/bucket

But then thanos-compact:10902/bucket returns 404.
/ returns html with all css/js sources leading to /static

What you expected to happen:
I expect at least html would have links to /bucket/static.
Would be much better to also have --web.route-prefix option for compact too.

How to reproduce it (as minimally and precisely as possible):

$ kubectl port-forward thanos-compact-7fc65f9df5-sjqnt 10902 &
$ curl -s localhost:10902 | grep static
Handling connection for 10902
        <link rel="shortcut icon" href="/static/img/favicon.ico?v=4e5c2f251b5b73e804883d9b42cd9246d32328db">
        <script src="/static/vendor/js/jquery-3.3.1.min.js?v=4e5c2f251b5b73e804883d9b42cd9246d32328db"></script>
        <script src="/static/vendor/js/popper.min.js?v=4e5c2f251b5b73e804883d9b42cd9246d32328db"></script>
        <script src="/static/vendor/bootstrap-4.1.3/js/bootstrap.min.js?v=4e5c2f251b5b73e804883d9b42cd9246d32328db"></script>
        <link type="text/css" rel="stylesheet" href="/static/vendor/bootstrap-4.1.3/css/bootstrap.min.css?v=4e5c2f251b5b73e804883d9b42cd9246d32328db">
        <link type="text/css" rel="stylesheet" href="/static/css/prometheus.css?v=4e5c2f251b5b73e804883d9b42cd9246d32328db">
        <link type="text/css" rel="stylesheet" href="/static/vendor/bootstrap4-glyphicons/css/bootstrap-glyphicons.min.css?v=4e5c2f251b5b73e804883d9b42cd9246d32328db">
    <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
    <script src="/static/js/bucket.js?v=4e5c2f251b5b73e804883d9b42cd9246d32328db"></script>
    <script src="/static/vendor/moment/moment.min.js?v=4e5c2f251b5b73e804883d9b42cd9246d32328db"></script>

Full logs to relevant components:

Logs

$ k logs -f thanos-compact-7fc65f9df5-sjqnt
level=info ts=2020-03-29T20:57:09.519805115Z caller=main.go:152 msg="Tracing will be disabled"
level=info ts=2020-03-29T20:57:09.520003815Z caller=factory.go:46 msg="loading bucket configuration"
level=info ts=2020-03-29T20:57:09.522286298Z caller=compact.go:321 msg="deduplication.replica-label specified, vertical compaction is enabled" dedupReplicaLabels=replica
level=info ts=2020-03-29T20:57:09.522809961Z caller=compact.go:474 msg="starting compact node"
level=info ts=2020-03-29T20:57:09.522848156Z caller=intrumentation.go:48 msg="changing probe status" status=ready
level=info ts=2020-03-29T20:57:09.523069571Z caller=bucket.go:487 msg="synchronizing block metadata"
level=info ts=2020-03-29T20:57:09.523741091Z caller=intrumentation.go:60 msg="changing probe status" status=healthy
level=info ts=2020-03-29T20:57:09.523775995Z caller=http.go:56 service=http/server component=compact msg="listening for requests and metrics" address=0.0.0.0:10902
level=info ts=2020-03-29T20:57:12.75033743Z caller=compact.go:870 msg="start sync of metas"
level=info ts=2020-03-29T20:57:15.09858552Z caller=bucket.go:500 msg="downloaded blocks meta.json" num=69
level=info ts=2020-03-29T20:57:15.244699051Z caller=compact.go:876 msg="start of GC"
level=info ts=2020-03-29T20:57:15.244862744Z caller=compact.go:884 msg="start of compaction"
level=info ts=2020-03-29T21:02:09.525270249Z caller=bucket.go:487 msg="synchronizing block metadata"
level=info ts=2020-03-29T21:02:12.257899714Z caller=bucket.go:500 msg="downloaded blocks meta.json" num=69
level=info ts=2020-03-29T21:07:28.444590494Z caller=bucket.go:487 msg="synchronizing block metadata"
level=info ts=2020-03-29T21:08:25.264457965Z caller=bucket.go:500 msg="downloaded blocks meta.json" num=69
level=info ts=2020-03-29T21:12:09.523158194Z caller=bucket.go:487 msg="synchronizing block metadata"
level=info ts=2020-03-29T21:12:12.334746629Z caller=bucket.go:500 msg="downloaded blocks meta.json" num=69
level=info ts=2020-03-29T21:17:09.540147617Z caller=bucket.go:487 msg="synchronizing block metadata"
level=info ts=2020-03-29T21:17:12.286737077Z caller=bucket.go:500 msg="downloaded blocks meta.json" num=71
level=info ts=2020-03-29T21:22:09.523203447Z caller=bucket.go:487 msg="synchronizing block metadata"
level=info ts=2020-03-29T21:22:12.238231324Z caller=bucket.go:500 msg="downloaded blocks meta.json" num=71
level=warn ts=2020-03-29T21:24:29.661382461Z caller=ui.go:42 msg="Could not get file info" err="AssetInfo pkg/ui/static/vendor/bootstrap-4.1.3/js/bootstrap.min.js.map not found" file=pkg/ui/static/vendor/bootstrap-4.1.3/js/bootstrap.min.js.map
level=warn ts=2020-03-29T21:24:29.661855792Z caller=ui.go:42 msg="Could not get file info" err="AssetInfo pkg/ui/static/vendor/bootstrap-4.1.3/css/bootstrap.min.css.map not found" file=pkg/ui/static/vendor/bootstrap-4.1.3/css/bootstrap.min.css.map
level=warn ts=2020-03-29T21:24:29.724234105Z caller=ui.go:42 msg="Could not get file info" err="AssetInfo pkg/ui/static/vendor/js/popper.min.js.map not found" file=pkg/ui/static/vendor/js/popper.min.js.map

@bwplotka
Copy link
Member

bwplotka commented Apr 1, 2020

Something to be added/fixed indeed.

I fixed some bug around this here: #2357 do you mind trying current master?

@squat
Copy link
Member

squat commented Apr 1, 2020

hi, I just tested against current master with --web.external-prefix=/bucket and it is working correctly:
image
I think we can probably safely close this issue

@sepich
Copy link
Contributor Author

sepich commented Apr 15, 2020

Confirming /bucket/global works fine in this configuration for v0.12.0

@sepich sepich closed this as completed Apr 15, 2020
@jdfalk
Copy link
Contributor

jdfalk commented Jun 5, 2020

I think this was closed prematurely.
--web.external-prefix= is supposed to be for the external path as referred to in links but is supposed to serve the content still from /
--web.route-prefix= is supposed to actually serve it on a subpath, unfortunately compact currently lacks this flag.

 --web.route-prefix=""      Prefix for API and UI endpoints. This allows thanos UI to be served on a sub-path. This option is analogous to --web.route-prefix of Promethus.
 --web.external-prefix=""   Static prefix for all HTML links and redirect URLs in the UI query web interface. Actual endpoints are still served on / or the web.route-prefix. This allows thanos UI to be served behind a reverse proxy that strips a URL sub-path.

If connecting to localhost it should be http://localhost:10902/loaded but on the reverse proxy it would be http://external/prefix/loaded which would get rewritten as http://internal/loaded

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants