pulp / pulpcore

Pulp 3 pulpcore package https://pypi.org/project/pulpcore/
GNU General Public License v2.0
302 stars 116 forks source link

Pulp location of CSS etc for API browser (and/or dependancies) #1999

Open pulpbot opened 2 years ago

pulpbot commented 2 years ago

Author: wibbit (wibbit)

Redmine Issue: 8797, https://pulp.plan.io/issues/8797


While testing the API web interface, I found that it looked "particularly bad" (see attached).

Digging through the web page code, I think this is down to the fact that there are numerous references to "/assets" as a URL,

/assets/rest_framework/css/bootstrap.min.css /assets/rest_framework/css/bootstrap-tweaks.css /assets/rest_framework/css/prettify.css /assets/rest_framework/css/default.css

As well ass /assets/rest_framework/js/jquery-3.5.1.min.js /assets/rest_framework/js/ajax-form.js /assets/rest_framework/js/csrf.js /assets/rest_framework/js/bootstrap.min.js /assets/rest_framework/js/prettify-min.js /assets/rest_framework/js/default.js

I've not used the pulp installer, and am using HAProxy as the reverse proxy, as such I've had to try and reverse engineer the HAProxy settings,

I can see two places where URL destinations appear to be set. https://github.com/pulp/pulp_installer/blob/a00dfd83c397c4b2074f79431a92c23abaac3b25/roles/pulp_webserver/templates/nginx.conf.j2 and https://github.com/pulp/pulp_installer/blob/a00dfd83c397c4b2074f79431a92c23abaac3b25/roles/pulp_webserver/templates/pulp-vhost.conf.j2

Neither of which appears to point to an /assets location, aside from the nginx config which has a catch-all of /

However even after setting that, the files are still not accessible.

So the second part of the question, is what supplies the files listed above.

FYI, I have djangorestframework 3.12.4 installed, which looks like it satisfies the file dependencies if nothing else.

ethanbayliss commented 2 years ago

Configure your reverse proxy to serve /assets/ to the directory you have configured as STATIC_ROOT https://github.dev/pulp/pulpcore/blob/main/pulpcore/app/settings.py#L43

You will have to also ensure that the pulpcore-manager collectstatic command has been run. https://docs.pulpproject.org/pulpcore/en/latest/components.html#static-content