-
Notifications
You must be signed in to change notification settings - Fork 18
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
Galaxy API CSS 404 #136
Comments
The https://github.com/ansible/galaxy_ng/blob/master/Dockerfile.rhel8#L52 However, without any value for $ podman run --rm quay.io/ansible/galaxy-ng:latest ls -lh /var/lib/pulp/assets
total 12K
drwxr-xr-x 6 root root 4.0K Jun 26 15:28 galaxy_ng
drwxr-xr-x 2 root root 4.0K Jun 26 15:28 import_export
drwxr-xr-x 7 root root 4.0K Jun 26 15:28 rest_framework
$ podman run --rm quay.io/ansible/galaxy-ng:latest ls -lh /app/galaxy_ng/app/static
total 4.0K
drwxr-xr-x 6 1001 127 4.0K Jun 24 14:43 galaxy_ng Not sure why we have both galaxy_ng static files in The real fix would be to change the As a workaround, you should be able to solve this via the apiVersion: galaxy.ansible.com/v1beta1
kind: Galaxy
metadata:
name: galaxy
namespace: galaxy
spec:
pulp_settings:
static_root: /var/lib/pulp/assets @rooftopcellist What do you think about this ? |
@dsavineau Looks like your snippet works for me! Thank you, I wasn't sure what the static root should be when I was debugging, or why commenting out the setting altogether didn't work. |
Version
galaxy_ng: v4.10.0dev
galaxy-operator: v2024.5.8
Describe the bug
All of the "/static/rest_method/css/*" links are returning a 404 when browsing the api (or curling the api with
?format=api
)To Reproduce
Deploy Galaxy with galaxy-operator (this is actually important, see below)
Expected behavior
CSS links work and api pages render successfully.
Additional context
In order for the CSS links to work for the API, the whitenoise django plugin needs to collect static assets into the
STATIC_ROOT
directory. (which you have hardcoded to/app/galaxy_ng/app/static/
This means running
django-admin collectstatic --noinput
to copy missing assets to the appropriate destination.Running this command appears to be required for all deployments, whether they are docker deployments or otherwise standalone deployments. The image itself does not necessarily run this step because there are different profiles for different deployment scenarios.
See profiles:
https://github.com/search?q=repo%3Aansible%2Fgalaxy_ng%20django-admin%20collectstatic&type=code
To workaround this in the meantime, I have disabled the galaxy-operator, and modified the api deployment with the following changes:
I tried to run this in an initContainer, but the collected static assets didn't persist into the api container. I've also tried commenting out the
STATIC_ROOT
setting, but that didn't resolve the missing assets.The text was updated successfully, but these errors were encountered: