rdmorganiser / rdmo-docker-compose

RDMO running in different docker images held together by docker compose
Apache License 2.0
3 stars 13 forks source link

RDMO not reachable if via Docker host IP or if Docker host's hostname is not "rdmo" #2

Closed kaibutsu closed 5 years ago

kaibutsu commented 5 years ago

First let me say thank you for making this nice piece of software and dockerizing it!

When trying to deploy RDMO in our environment we weren't able to access our Docker host via URL as the hostname was not made available to the DNS so we tried to access it via IP address. This led to HTTP 400 errors (Bad Request) as the IP was not listed under ALLOWED_HOSTS in template_local.py: https://github.com/rdmorganiser/rdmo-docker-compose/blob/d10b73ae999e7242b8ef954d9ca81cf8d38616d4/rdmo/rootfs/tmp/template_local.py#L22 The same error occurs if the Docker host's hostname differs from "rdmo".

triole commented 5 years ago

Thanks for the compliments.

The issue described is something we need to think about. My first impression is being a little unsure about how I could contribute to fix the problem. The ALLOWED_HOSTS setting is a part of Django and serving security matters. As it would not be a good idea to remove it or use a wildcard to allow everything, we might need to think about what to add to the list to make the setup a little easier. Basically there are two options which unfortunately immediately lead to two problems which boil down to the question what to add to the list.

  1. IP address: The docker containers do not have static IP addresses. Their IPs might differ from host to host. So what to add? Of course I could assign static IPs but I do not consider this being a good option because it could lead to address range clashes depending on docker host setups.
  2. Hostname: I am unable to anticipate the hostname an RDMO docker setup might be using which is why I couldn't know what to add.

The best idea I have at the moment is to write a remark into the readme.md that the local.py needs to be adjusted to the specific needs. I suppose my misjudgement was taking this for being clear because it is mentioned in the RDMO documentation.

Or do you have any better idea?

triole commented 5 years ago

I decided to move the ALLOWED_HOSTS setting into the variables.env to raise awareness that there is something the needs to be adjusted. Therefore I consider this ticket being ready to be closed.