-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: use correct storage directory for client service #2621
base: main
Are you sure you want to change the base?
Conversation
4e7289f
to
0f450bf
Compare
the client container needs DJANGO_STORAGE_DIR to be `/home/calitp/app/data` because the nginx.conf location blocks use that base path to serve media files. the volume mapping is needed so that the container has access to the django.db file and the uploads/ directory from the host side of the mapping.
0f450bf
to
854c49d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused why this is required? What problem are we trying to solve here? I'm able to bring up docker compose up -d client
on the main
branch on my machine.
I thought DJANGO_STORAGE_DIR
was more of a deployment config (i.e. not really for devtime).
I don't have this setting in my local .env
, so maybe that is why it works for me?
Yeah, so you're right that when running If you run But then you'll notice that the media files return 404s. And that's the main problem that needed to be solved here. It was kind of a chain of problems that led to this change, so I totally understand the need for more clarification. |
I just edited the title of #2620 to be more accurate / descriptive 😅 |
OK thank you -- I did see a missing agency logo on the modal selector before this PR, and now I see the agency logo 👍 One comment, the effect of this is to have the entire source directory mounted under |
Great suggestion. Turns out we can map files too, so I updated it to only bring in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was worried this would break if django.db
did not exist. But that doesn't appear to be the case, the client
service still comes up OK.
However, if django.db
does not exist, a local directory called django.db
is created upon service startup:
So that isn't what we want. Recall our goal with client
has been it should mostly work OOTB -- create an .env
file and docker compose up client
. Of course this doesn't work as well in the world where we have a stable database file in prod
but no such thing locally.
Can we think about this one a little more?
Closes #2620
This PR adds volume mappings to bring in
django.db
and theuploads
folder into/home/calitp/app/data
inside theclient
service.Explanation
It needs to be this specific path is because the client container needs
DJANGO_STORAGE_DIR
to be/home/calitp/app/data
so that nginx can serve media files correctly. But then, the client container fails to start because there is no database file at/home/calitp/app/data
.This volume mapping gives the container access to the
django.db
file and theuploads/
directory from the host side of the mapping.