How to add and access static file on pulp

Hello ,
Has anyone use static files on pulp? an example to share?
I want to put gpg key files as static files on pulp server for some repo to download them.

My pulp instance is based on docker-composer(pulp core 3.49.4, rpm 3.25.2), and the images/compose/assets/settings.py has STATIC_ROOT = "/var/lib/operator/static/"

My questions:

  1. where should I put these files keys? on API container? under /var/lib/operator/static/my.gpg inside the pulp-api container? should i mount through an external docker volume?
    And on API container, there are something under /var/lib/operator already.

  2. what is the url to access these static files? wget https://xx.xx.xx/static/my.gpg? ? do I need to configure somewhere in ngnix.conf?

Thanks in advance !

We serve the django static files from the reverse proxy (nginx) container as far as I know.

You could create a pulp_file repo.

I am reading, but not very clear:

https://whitenoise.readthedocs.io/en/stable/django.html

Trying to figure out where to add my static file and what is the url to access it?
I am thinking something like https://xx.xx.xx/pulp/static?

@quba42

You could create a pulp_file repo.

I am hoping with pulp-rpm plugin, it could do something by ngnix? which can redirect xx.xx.xx/static to the path where the static files are saved?

pulp_file repo is just another suggestion.

1 Like

I have not tried other pulp plugins, except pulp-rpm .
But yes, pulp_file can be another way to share file :slight_smile:

Pulp doesn’t set up a public place to put random files. The pulp-file suggestion is, I think, a good one. Here’s a working example : https://pastebin.com/TcYDCSf3

1 Like

Thanks very for all the help. I will test pulp-file later.
I will also try with additional nginx conf to share files through as in this link How nginx process =404 fallback in try_files - Stack Overflow

location /static {
    autoindex on;
    alias /var/lib/pulp/static;
    try_files $uri $uri/ =404;
}
1 Like

Finally, what I did is:

  1. In images/compose/compose.yml, add a volume where all the gpg key files are, and mount this volume on pulp-web
pulp_web:
...
    volumes:
      - "pulp_gpg:/var/lib/pulp/gpg"
...
volumes:
  ...
  pulp_gpg:
    name: pulp_gpg${DEV_VOLUME_SUFFIX:-dev}
    driver: local
    driver_opts:
      o: bind
      type: none
      device: /opt/pulp3/gpg
  1. In images/compose/assets/nginx/nginx.conf.template, add the follwing before the line location / {
        location /pulp/gpg {
           autoindex on;
           alias /var/lib/pulp/gpg;
           try_files $uri $uri/ =404;
        }

       location / { 
  .....

Then I can access or download the gpg key file from https://xx.xx.xx.xx/pulp/gpg

1 Like