Single-process image: pulp-api container does not serve static files / assets
Version pulp/pulp-minimal:3.49.0
Describe the bug According to the nginx config (https://github.com/pulp/pulp-oci-images/blob/latest/images/compose/assets/nginx/nginx.conf.template) the static files are supposed to be served by the API container:
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
# we don't want nginx trying to do something clever with
# redirects, we set the Host: header above already.
proxy_redirect off;
proxy_pass http://$pulp_api:24817;
# static files are served through whitenoise - http://whitenoise.evans.io/en/stable/
}
However the API container is not serving them when I browse the API using the browser. Access log from the API container and nginx:
pulp-api-2 | pulp [5bf909537cda4b9fa7deb204ace0f972]: django.request:WARNING: Not Found: /assets/rest_framework/js/default.js
pulp-api-2 | ('pulp [5bf909537cda4b9fa7deb204ace0f972]: ::ffff:172.19.0.7 - - [18/Mar/2024:15:17:49 +0000] "GET /assets/rest_framework/js/default.js HTTP/1.0" 404 179 "http://localhost:8081/pulp/api/v3/status/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:123.0) Gecko/20100101 Firefox/123.0"',)
pulp-web-1 | 192.168.65.1 - - [18/Mar/2024:15:17:49 +0000] "GET /assets/rest_framework/js/default.js HTTP/1.1" 404 179 "http://localhost:8081/pulp/api/v3/status/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:123.0) Gecko/20100101 Firefox/123.0"
Does this need to be activated first? Or are the assets served on another path?
To Reproduce Steps to reproduce the behavior: Use docker-compose or another tool to set up single-process images: https://github.com/pulp/pulp-oci-images/tree/latest/images/compose
Expected behavior API container serves static files.
Additional context Add any other context about the problem here. Please provide links to any previous discussions via Discourse or Bugzilla.
That comment may be wrong. If I remember correctly, the static file are copied to the nginx (pulp-web) container and served from there.
Edit: But maybe that's not true anymore? This line looks a bit forgotten here: https://github.com/pulp/pulp-oci-images/blob/latest/images/pulp-minimal/nightly/Containerfile.webserver#L5
We can confirm this issue exists.
It might be an issue in pulpcore (because we use the whitenoise app to serve static content).
It turns out it was a configuration mistake on my side. Somehow I did set
STATIC_ROOT = "/var/lib/pulp/assets/"
instead of
STATIC_ROOT = "/var/lib/operator/static/"
Now with the correct path the API container is serving the static files as expected. Sorry for the noise.
So from my side the issue can be closed. I will leave this up to you though due to your comments about being able to confirm this (or another?) issue. Not sure if it is just a similar mistake with the configuration.
Hello , @mikedep333 @GeorgFleig @mdellweg
This thread similar to what I am looking for, so I put my question here.
I have some home made gpg keys, I'd like to put them as static files on pulp server, so our repo can download them.
My pulp instance is run on docker-composer(pulp core 3.49.4, rpm 3.25.2), and I have two api instance:
compose-pulp_api-1
compose-pulp_api-2
the images/compose/assets/settings.py has STATIC_ROOT = "/var/lib/operator/static/"
My question is:
- where should I put these gpe keys files?
I check inside one compose-pulp_api-1 conainer, it has something under /var/lib/operator:
bash-5.1$ ls -lh /var/lib/operator/static/
total 4.0K
drwxr-xr-x 2 pulp pulp 72 Apr 17 13:57 import_export
drwxr-xr-x 7 pulp pulp 63 Apr 17 13:57 rest_framework
bash-5.1$ ls -lh /var/lib/operator/static/import_export/
total 0
lrwxrwxrwx 1 pulp pulp 91 Apr 17 13:57 action_formats.js -> /usr/local/lib/python3.9/site-packages/import_export/static/import_export/action_formats.js
lrwxrwxrwx 1 pulp pulp 89 Apr 17 13:57 guess_format.js -> /usr/local/lib/python3.9/site-packages/import_export/static/import_export/guess_format.js
lrwxrwxrwx 1 pulp pulp 84 Apr 17 13:57 import.css -> /usr/local/lib/python3.9/site-packages/import_export/static/import_export/import.css
bash-5.1$ ls -lh /var/lib/operator/static/rest_framework/
total 0
- how to access these static gpg files? what is the url?
wget https://xx.xx.xx/static/my.gpg?? do I need to configure it somewhere in ngix conf?
If there is some example to share? Sorry for the naive questions.
Thanks in advance !