Cannot change CONTENT_PATH_PREFIX

Problem:
If I set CONTENT_PREFIX_PATH to my custom value - I cannot access repository,
If I leave it default pulp/content - I access repository without problems.
Note: every experiment is executed on fresh/empty instance of Pulp in One Container.

Please, recommend how to change content prefix from default ‘pulp/content’ to
my custom.

Expected outcome:
If I set CONTENT_PATH_PREFIX='/my/'
I expect my repository e.g. deb22 to be accessible at: http://host:8080/my/deb22

Pulpcore version:
3.43.0

Pulp plugins installed and their versions:
pulp-deb 3.1.0
pulp-ansible 0.21.0
pulp-certguard 1.7.1

Operating system - distribution and version:
Ubutu 22

Other relevant data:

-----> This is working settings.py
echo "CONTENT_ORIGIN=‘http://$(hostname):8080’
ANSIBLE_API_HOSTNAME=‘http://$(hostname):8080’
ANSIBLE_CONTENT_HOSTNAME=‘http://$(hostname):8080/pulp/content’
CACHE_ENABLED=True " >> settings/settings.py

NOTE: Can access my repository at: http://host:8080/pulp/content/deb22

-----> Non working settings.py
echo “CONTENT_ORIGIN=‘http://$(hostname):8080’
ANSIBLE_API_HOSTNAME=‘http://$(hostname):8080’
ANSIBLE_CONTENT_HOSTNAME=‘http://$(hostname):8080/pulp/content’
CACHE_ENABLED=True
CONTENT_PATH_PREFIX=’/my/’” >> settings/settings.py

NOTE: CAN NOT access my repository at: http://host:8080/my/deb22

-----> Also non working settings.py
echo “CONTENT_ORIGIN=‘http://$(hostname):8080’
ANSIBLE_API_HOSTNAME=‘http://$(hostname):8080’
ANSIBLE_CONTENT_HOSTNAME=‘http://$(hostname):8080/my’
CACHE_ENABLED=True
CONTENT_PATH_PREFIX=’/my/’” >> settings/settings.py

NOTE: CAN NOT access my repository at: http://host:8080/my/deb22

$ pulp deb distribution create --name=distro22 --base-path=deb22 --repository=deb22
Started background task /pulp/api/v3/tasks/018c80e1-cdc3-7ded-8aa3-bb29cab8b994/
.Done.
{
“pulp_href”: “/pulp/api/v3/distributions/deb/apt/018c80e1-ce59-71fd-a5eb-a2f1c354bcee/”,
“pulp_created”: “2023-12-19T07:02:11.290651Z”,
“base_path”: “mydeb22”,
“base_url”: “http://:8080/my/deb22/”,
“content_guard”: null,
“hidden”: false,
“pulp_labels”: {},
“name”: “distro22”,
“repository”: “/pulp/api/v3/repositories/deb/apt/018c80e1-74e9-7e2b-8dc4-86c6e3fc03be/”,
“publication”: null
}

Trying to open http://<host>:8080/my/deb22/ in browser I get:

Not Found
The requested resource was not found on this server.

Pulp log shows:

pulp [f39627482edb4a6ba1218f279d35cb93]: django.request:WARNING: Not Found: /my/deb22/
(‘pulp [f39627482edb4a6ba1218f279d35cb93]: ::ffff:127.0.0.1 - - [19/Dec/2023:07:15:10 +0000] “GET /my/deb22/ HTTP/1.0” 404 179 “-” “Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36”’,)

The nginx.conf inside the all in one container is hardcoded with /pulp/content [0]. So as a result nginx is not proxying the request to the content app which is running on port 24816. You can modify the container with an update nginx.conf or you can expose port 24816 directly.

[0] https://github.com/pulp/pulp-oci-images/blob/latest/images/s6_assets/nginx.conf#L44

1 Like

Thank you! I was able to rebuild pulp/pulp image with my custom URL.

But, what to do if I need:

  • on the same pulp3 instance to have one rpm repository with base URL e.g. /yum/... and second deb repository with base URL e.g. /deb/...

Is such scenario possible? Or do I need separate pulp3 instances for each repo and URL?
I’m talking now about production setup, not just simple PoC.

Thank you.

I can recommend defining rpm-based distributions with the base path starting with “yum/…” and debian-based distributions with the base path starting with “deb/…”. With pulp-cli (https://github.com/pulp/pulp-cli), like so:

pulp rpm distribution create --name "repo" --base-path "yum/repo" --publication "$HREF"
1 Like

Simple and genius idea! And it is working (only had to configure empty content prefix). Thank you!