Skip to content
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

Demo deploy #265

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Demo deploy #265

wants to merge 2 commits into from

Conversation

machow
Copy link
Contributor

@machow machow commented Apr 14, 2020

This PR allows the app to run on hosts that are not localhost. There were two main issues: Django is not set to accept any hosts, and in prod it's both accessible via nginx (good) and a port straight to the app server (bad? probably not a big issue).

Changes:

  • set django ALLOW_HOSTS = ['*'], remove host-exposed backend port.
  • comment out dev settings in docker-compose.yml (eg nginx config bind mount; exposing backend port on host since it is accessed via nginx)

Note: I also commented out parts of nginx while trying to figure out how to get non localhost hosts working. Could likely uncomment again!

        #proxy_set_header   X-Real-IP $remote_addr;
        #proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        #proxy_set_header   X-Forwarded-Host $server_name;

@MikeyManoguerra
Copy link
Collaborator

This PR reminded me that there are some django specific production things that should be done.

however, does this apply when it is inside a docker container?

  • debug should be set to false in settings/poduction
  • secret key should be an env variable?

ports:
- "8000:8000"
expose:
- "8000"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this still exposes port 8000 to the host just now on a random port.

proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
#proxy_set_header X-Real-IP $remote_addr;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if planning on using in production these should be uncommented. Proxy should set these for logging and tracking purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants