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

Accessing CrateDB Admin UI behind Ingress #777

Open
arjun289 opened this issue Aug 29, 2022 · 3 comments
Open

Accessing CrateDB Admin UI behind Ingress #777

arjun289 opened this issue Aug 29, 2022 · 3 comments
Labels

Comments

@arjun289
Copy link

arjun289 commented Aug 29, 2022

I am running a cluster of 3 CrateDB nodes on Kubernetes.
I have set up an ingress to access the admin UI on path /db. However, I think to access it on this path I probably need to do some configuration so static files are served from the /db path, or the requests are routed on this path. How to do this configuration?

@amotl
Copy link
Member

amotl commented Sep 14, 2022

Dear Arjun,

thank you for writing in.

In general, the Admin UI itself can be hosted on any path. However, it has to know about the CrateDB HTTP API endpoint, usually available at /_sql.

I have set up an ingress to access the admin UI on path /db.

I see. So, the HTTP API endpoint of CrateDB itself would also be available at /db/_sql?

At [1], I've referenced the utility function which computes the base URI used to access the database HTTP API. We will have to check if that would need corresponding adjustments.

With kind regards,
Andreas.

[1]

.factory('baseURI', function() {
var baseURI = {};
baseURI.getWindowLocation = function() {
return window.location;
};
baseURI.getURI = function(path) {
var basePath;
var loc = baseURI.getWindowLocation();
var uriParam = loc.search.match(/([\?|&])base_uri=([^&]+)/);
if (!uriParam) {
basePath = loc.protocol + '//' + loc.host + loc.pathname;
} else {
basePath = uriParam[2];
}
// remove trailing slash from base path and append path
return basePath.replace(/\/+$/, '') + path;
};
return baseURI;
})

@amotl
Copy link
Member

amotl commented Sep 14, 2022

Hi again,

I've added an example at 1, which outlines how to configure Nginx to reverse-proxy the CrateDB HTTP API endpoint to the /db subdirectory. The nginx.conf is at 2. Maybe you can use it as an inspiration to configure the K8s Ingress component appropriately.

With kind regards,
Andreas.

Footnotes

  1. https://github.com/crate/cratedb-examples/tree/main/spikes/http-api-behind-nginx

  2. https://github.com/crate/cratedb-examples/blob/main/spikes/http-api-behind-nginx/nginx.conf

@amotl
Copy link
Member

amotl commented Sep 29, 2022

Dear Arjun,

are the resources referenced above helpful to you?

With kind regards,
Andreas.

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

No branches or pull requests

3 participants