-
Notifications
You must be signed in to change notification settings - Fork 20
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
Improve Docker development workflow #719
base: master
Are you sure you want to change the base?
Conversation
This brings the local dev environment closer to production by using the same frontend container. It also changes the backend to serve with gunicorn by default, even in dev mode. Also, static files are now always served by the frontend and never by Django, even in dev mode.
644a069
to
eb2e8ca
Compare
eb2e8ca
to
d6e3667
Compare
@jake-low I'm having this error:
|
Thanks for testing! I just pushed a commit that should fix this. Interestingly I didn't encounter this error, but maybe we're using different Docker versions. You should be able to run I'll see if I can find a way to run |
I tried to test it, but I wasn't able to finish. My docker abilities are very poor. I don't know if @sunu has time to test it. If not, you can merge it. |
This PR makes it easier to run the complete OSMCha stack in both development and production configurations using Docker Compose. My intent is for this to become the preferred way to run the app during development. The advantage of this is that it provides a standard environment for contributors to use, and it creates a development configuration that's more similar to what we actually end up deploying in prod (via EKS).
Notable changes:
python manage.py collectstatic
is run at build time to collect static assets and place them in a Docker Volume, which can then be mounted into the frontend container at runtime which will serve them. This mirrors how static assets are served in production.$PGHOST
,$PGPORT
,$PGUSER
, etc. None of the Django configuration modules override these or set fallbacks if they aren't defined, ensuring that connecting to the database works the same no matter what config is being used. As a bonus, these variables match whatpsql
and other tools use, so you can now open a shell in your dev container (or, hypothetically, in the production pod) and runpsql
with no arguments to connect to the database.This PR goes along with OSMCha/osmcha-frontend#749 - the changes to the Docker Compose workflow here assume that the
osmcha-frontend
container is a full-fledged, production ready Nginx server, as implemented in that PR.NOTE: This PR will require some minor changes to the Helm charts in the osmcha-deploy repo to deploy to prod safely. It changes the names of some environment variables used to configure the application, and requires the deployment to set some additional environment variables (like
BACKEND_URL
andREDIS_URL
) which were implicit before. I will help with making these changes 🙂