Coder Social home page Coder Social logo

docker image? about ceph-dash HOT 13 CLOSED

crapworks avatar crapworks commented on June 8, 2024 1
docker image?

from ceph-dash.

Comments (13)

Crapworks avatar Crapworks commented on June 8, 2024

Hi @fernandosanchezmunoz

See eff852c and https://hub.docker.com/r/crapworks/ceph-dash/

It would be nice if someone could test it, since I don't have a real ceph cluster to play around.

Regards,
Christian

from ceph-dash.

serverbiz avatar serverbiz commented on June 8, 2024

Hi @Crapworks great wiork on ceph-dash and the docker image!

Getting it up and running by following the instructions was easy and the dashboard looks good.

One problem for us is that the generated html contains hard references to /static. We need to run ceph-dash behind a reverse proxy so it's on a URL prefix. Any chance you can add an environment variable to define either an absolute path URI or a URL prefix?

What would also be great is an environment variable to set the port number used.

from ceph-dash.

Crapworks avatar Crapworks commented on June 8, 2024

Hi @serverbiz

the static references are not "hard", they are calculated by flask, as you can see for example here. So just passing an environment variable will not work. I will implement a small middleware in the next days that should be able to handle http headers send by the reverse proxy. I'll get back here as soon as you can test it.

Regarding the ports: the advantage of docker is that it doesn't matter what port the application inside the container is using. Just expose the port on a different port. You can just use

-p 12345:5000 instead of -p 5000:5000 and the port will exposed at 12345.

Cheers,
Christian

from ceph-dash.

serverbiz avatar serverbiz commented on June 8, 2024

That makes sens! In that case header awareness would be great for all those who proxy. Looking forward to it.

We are exposing the ceph-dash container on a different port using the method you're suggesting. Some people might however want/need to run the container using "host mode" networking and then the port variable could be very convenient.

One last challenge is changing config.json in order to add graphite/influxdb settings. With most containers we overwrite configurations either using environment variables, or by recreating the whole configuration file in a separate directory on the host and then mount that on the appropriate path inside the container.
Neither one is currently possible for the ceph-dash containers. Given the amount of configuration, it doesn't seem like the kind of thing that's easily fixed with just a few environment variables. Problem with the second approach is that config.json is in /cephdash with a load of other files. Would it make sense to move config.json outside of /cephdash to a separate directory? Or do you see some other approach?

from ceph-dash.

Crapworks avatar Crapworks commented on June 8, 2024

I guess the easiest way would be to add a commandline parameter with which you can overwrite the config file location and then add an environment variable for that. In this case, you can mount the config file anywhere in the container and just point to it.

from ceph-dash.

serverbiz avatar serverbiz commented on June 8, 2024

That would definitely work.

Any chance you could add an environment variable like CONFIGFILE that allows setting an alternative path to config.json to the Docker configuration, and get the app to pick up on that?

Other than this (and potentially making the port configurable) I would say the docker image is solid. This ticket is as good as completed :)

from ceph-dash.

Crapworks avatar Crapworks commented on June 8, 2024

I just did: #51
The environment variable that is picked up by entrypoint.sh is called CONFIG. It is only available in the docker branch. If you don't want to build the container yourself, I just triggered the dockerhub build for this branch, so it should be available within the next hours.

from ceph-dash.

Crapworks avatar Crapworks commented on June 8, 2024

I've implemented the reverse proxy stuff. If you are using nginx, you need to do something like this:

server {

    location /production {
        proxy_pass http://127.0.0.1:8001;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Scheme $scheme;
        proxy_set_header X-Script-Name /production;
    }
}

See also: https://github.com/wilbertom/flask-reverse-proxy

Please tell me if this works for you.

Cheers,
Christian

from ceph-dash.

serverbiz avatar serverbiz commented on June 8, 2024

Tested and it works!

One recommendation: add a default for CONFIG around line 4 of entrypoint.sh since the container currently doesn't start without passing this environment variable.

CONFIG=/cephdash/config.json

from ceph-dash.

Crapworks avatar Crapworks commented on June 8, 2024

The default should be handled by the app. I've added a conditional that only set the internal env variable if the user variable is set. Can you do me the favour and check if it is starting now without specifying a config?

from ceph-dash.

serverbiz avatar serverbiz commented on June 8, 2024

Works as expected now. Both the proxy headers and the config file 👍

Only problem I'm left struggling with is getting graphite integration to work. Also running it in a container (hopsoft/graphite-statsd) behind the same apache proxy (and behind a common basic auth) on the same host. Linked to the container using --link "graphite:graphite" and changed the example to the following config.json:

{ "ceph_config": "/etc/ceph/ceph.conf", "graphite": { "url": "http://graphite", "metrics": [ { "targets": [ "avg(icinga2.master*.ceph_dash.ceph_dash.perfdata.read_bytes_sec)", "avg(icinga2.master*.ceph_dash.ceph_dash.perfdata.write_bytes_sec)" ], "labels": [ "Read", "Write" ], "from": "-2h", "mode": "byteRate" }, { "targets": [ "avg(icinga2.master*.ceph_dash.ceph_dash.perfdata.op_per_sec)" ], "labels": [ "IOPS" ], "colors": [ "#5bc0de" ], "from": "-2h" }, { "targets": [ "avg(icinga2.master*.ceph_dash.ceph_dash.perfdata.bytes_avail)", "avg(icinga2.master*.ceph_dash.ceph_dash.perfdata.bytes_total)", "avg(icinga2.master*.ceph_dash.ceph_dash.perfdata.bytes_used)" ], "labels": [ "Free", "Available", "Used" ], "from": "-2h", "mode": "byteRate" } ] } }

Yet in chrome developer tools I see this:

Uncaught TypeError: Cannot read property 'mode' of undefined
at Array. (ceph.dash.js:101)
at Function.each (jquery-2.1.4.min.js:2)
at Object.success (ceph.dash.js:99)
at j (jquery-2.1.4.min.js:2)
at Object.fireWith [as resolveWith] (jquery-2.1.4.min.js:2)
at x (jquery-2.1.4.min.js:4)
at XMLHttpRequest. (jquery-2.1.4.min.js:4)

I tested calls to my graphite server. A call to
/graphite/render?target=avg(icinga2.master*.services.ceph_dash.ceph_dash.perfdata.read_bytes_sec.value)&from=-2h&mode=byteRate
Will produce a graph, yet calls to /ceph-dash/graphite result in:
{ "results": [ [], [] ] }

Is this in any way related to running this in a container and/or behind a proxy? Is the graphite_url in config.json supposed to be a publicly accessible URL (e.g. does the browser call graphite) or an url accessible to ceph-dash (e.g. does dash call graphite and relay the image to the browser)?

from ceph-dash.

Crapworks avatar Crapworks commented on June 8, 2024

This is heavily dependant on your docker setup. You also need to know that ceph-dash itself talks to graphite as a proxy, you are never connecting to it via your browser. So you should make sure that you can reach the graphite container form the ceph-dash container.

from ceph-dash.

Crapworks avatar Crapworks commented on June 8, 2024

I am going to close this since it seems to work

from ceph-dash.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.