ansible / ansible/galaxy-operator

Galaxy API CSS 404

Open
#136 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jinja
Stars
19
Forks
42
Avg merge
1d 16h
Merged PRs (30d)
2

Description

**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:

```diff
containers:
- name: api
+ command:
+ - /bin/bash
+ - '-c'
+ - |
+ django-admin collectstatic --noinput
+ start-api
- args:
- - start-api
```

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.

Contributor guide

Open the contributing guide

Research direction

Review the deployment profiles referenced in the issue and compare how the API container runs `django-admin collectstatic --noinput` and `start-api`. Verify the resulting deployment serves the `/static/rest_method/css/*` assets and that API pages render without 404 responses.

Written by the indexing model from the issue text.

Assessment

Tech stack
django
Domain
devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.