Task #2895
closedTask #2868: Platform support for publishing.
As a user, I can have content served to me by Pulp
0%
Description
Add content handling urls to serve conent. Some can be cannibalized from pulp2. Mainly parts of the ContentView. [0]
The handling URLs should be able to:
- Based on incoming request URL, determine the distribution
- Match the scheme against (http and https fields). 404 when scheme not enabled.
- Query the PublishedArtifact and PublishedMetadata tables (in that order) by URL path component to get the artifact or the metadata.
- respond with contents of the corresponding file
For this task the request and response should be handled with the normal WSGI application. There is a task to do enable this with apache later [1].
The content urls can be broken out separately later with magic in the settings.py and/or separate .wsgi files.
Updated by jortel@redhat.com over 7 years ago
- Tags Pulp 3, Pulp 3 Plugin Writer Alpha added
What is involved with getting the test web server to route content URLs to the content app?
Updated by mhrivnak over 7 years ago
jortel@redhat.com wrote:
What is involved with getting the test web server to route content URLs to the content app?
Assuming it's a separate django app, which I think it appropriate, we would just need to add it to INSTALLED_APPS in settings.py. It would be responsible for having its own urls.py and setting up its own routing there.
Updated by bmbouter over 7 years ago
Isn't this more than a django app installed to the pulp API's WSGI app, but it actually is it's own, distinct WSGI app? The content serving in pulp2 was its own WSGI app to not mix the content requests with the pulp API requests.
If that's the case it would get it's own wsgi entry point, and have its own urls.py and very few handlers. It would be called with runserver by specifying that settings.py application
Updated by mhrivnak over 7 years ago
I think it would be a good idea to add more detail to this task about exactly what functionality the app needs to have. I know the whole picture is spelled out in the other issue, but it's good to think through and write down what exactly this individual piece needs to do. Quick first thoughts:
- Based on incoming request URL, determine what publication is being accessed
- Using the publication, further determine which artifact or metadata file is being accessed
- respond with contents of the corresponding file
- or send through the streamer workflow (is this a refactor, rewrite, or mostly-stay-the-same situation?)
- somehow respond to requests for "listing" files (definitely not required for plugin API alpha)
Updated by mhrivnak over 7 years ago
bmbouter wrote:
Isn't this more than a django app installed to the pulp API's WSGI app, but it actually is it's own, distinct WSGI app? The content serving in pulp2 was its own WSGI app to not mix the content requests with the pulp API requests.
If that's the case it would get it's own wsgi entry point, and have its own urls.py and very few handlers. It would be called with runserver by specifying that settings.py application
Yes that's all correct. But the question was about using the test (dev) server, and for that I'm not sure how much it matters. We could require the developer to run two different dev servers: one for the rest api, and one for content. Or we could try to do it all in one process. I'm sure there are pros and cons of each, but neither seems completely objectionable just yet.
Updated by bmbouter over 7 years ago
mhrivnak that list looks great.
Also for the "respond with the contents of the file" that should actually stream the file using Django which allows for a streaming response type. I think we should file an add-on ticket that introduces a setting which would allow the view to return a mod xsendheader instead of streaming the actual bytes from the Django request handler. If enabled it responds with that xSendFile header set and an empty body so that Apache can stream it efficiently. I can file that if you want, just let me know.
We could do it in the same processes that is true. It certainly keeps it simple. The downside is that content data and api requests are mixed, but there is a nice upside of reduced memory usage and fewer qpid+database connections. The more I think about it the more I like it since apache will be serving production instances anyway.
Updated by jortel@redhat.com over 7 years ago
bmbouter wrote:
mhrivnak that list looks great.
Also for the "respond with the contents of the file" that should actually stream the file using Django which allows for a streaming response type. I think we should file an add-on ticket that introduces a setting which would allow the view to return a mod xsendheader instead of streaming the actual bytes from the Django request handler. If enabled it responds with that xSendFile header set and an empty body so that Apache can stream it efficiently. I can file that if you want, just let me know.
We could do it in the same processes that is true. It certainly keeps it simple. The downside is that content data and api requests are mixed, but there is a nice upside of reduced memory usage and fewer qpid+database connections. The more I think about it the more I like it since apache will be serving production instances anyway.
In pulp2 the content app is a separate WSGI app[1]. One advantage to keep it a separate app is that it can be deployed on a separate server and configured with different resource allocations in Apache.
Is the new xsend setting something as simple as just adding:
XSEND = (true/false)
to settings.py.
[1] https://github.com/pulp/pulp/tree/master/server/pulp/server/content/web
Updated by jortel@redhat.com over 7 years ago
mhrivnak wrote:
I think it would be a good idea to add more detail to this task about exactly what functionality the app needs to have. I know the whole picture is spelled out in the other issue, but it's good to think through and write down what exactly this individual piece needs to do. Quick first thoughts:
- Based on incoming request URL, determine what publication is being accessed
- Using the publication, further determine which artifact or metadata file is being accessed
- respond with contents of the corresponding file
- or send through the streamer workflow (is this a refactor, rewrite, or mostly-stay-the-same situation?)
There isn't much logic in the pulp2 ContentView but most of it can be generally reused.
- somehow respond to requests for "listing" files (definitely not required for plugin API alpha)
This list looks fine.
Updated by jortel@redhat.com over 7 years ago
After talking through this, it seems like the content app can be just a View in the platform/app. We can deploy separately with magic in the settings.py and/or separate .wsgi files.
Updated by bmbouter over 7 years ago
Yes I think that is fine for today and may be fine forever even. Production installs shouldn't use Django to stream bits so they shouldn't experience issues from content requests streaming large data back which would tie up the WSGI processes and could queue/block API requests.
Updated by amacdona@redhat.com over 7 years ago
- Subject changed from Port content WSGI applicaiton from pulp2 to pulp3. to Port content WSGI application from pulp2 to pulp3.
Updated by bmbouter over 7 years ago
Note this is to be split into two tasks: https://pulp.plan.io/issues/2868#note-22
Updated by jortel@redhat.com over 7 years ago
- Subject changed from Port content WSGI application from pulp2 to pulp3. to Add Content WSGI application to server content.
- Description updated (diff)
Updated by bizhang over 7 years ago
- Groomed changed from No to Yes
- Sprint Candidate changed from No to Yes
Updated by bmbouter over 7 years ago
- Subject changed from Add Content WSGI application to server content. to As a user, I can have content served to me by Pulp
- Description updated (diff)
I retitled and edited it to reflect the comments where we decided to use the existing WSGI application instead of adding a new one.
Updated by jortel@redhat.com over 7 years ago
- Status changed from NEW to ASSIGNED
- Assignee set to jortel@redhat.com
Updated by jortel@redhat.com over 7 years ago
- Status changed from ASSIGNED to POST
Updated by jortel@redhat.com over 7 years ago
- Sprint/Milestone changed from 43 to 44
Updated by jortel@redhat.com over 7 years ago
- Status changed from POST to MODIFIED
Updated by bmbouter about 7 years ago
- Tags deleted (
Pulp 3 Plugin Writer Alpha)
Cleaning up Redmine tags
Updated by bmbouter about 5 years ago
- Status changed from MODIFIED to CLOSED - CURRENTRELEASE