Closed piotrb closed 5 years ago
@piotrb great idea! I just added support for changing the proxy's port for both http and https.
you can add a :port key and a :tls_port to the config file under :nginx_proxy and dory will bind the specified host port to the correct one in the proxy container. After updating to dory 1.1.0, you can upgrade your config file with dory config-file --upgrade
or else manually add the keys. The command will dump your comments so if you have those, might just want to do it by hand. If you don't already have a config file, generate one with dory config-file
and then tweak the right keys.
Here's the example updated config file:
---
dory:
# Be careful if you change the settings of some of
# these services. They may not talk to each other
# if you change IP Addresses.
# For example, resolv expects a nameserver listening at
# the specified address. dnsmasq normally does this,
# but if you disable dnsmasq, it
# will make your system look for a name server that
# doesn't exist.
dnsmasq:
enabled: true
domains: # array of domains that will be resolved to the specified address
- domain: docker # you can set '#' for a wilcard
address: 127.0.0.1 # return for queries against the domain
- domain: dev
address: 127.0.0.1
container_name: dory_dnsmasq
port: 53 # port to listen for dns requests on. must be 53 on linux. can be anything that's open on macos
# kill_others: kill processes bound to the port we need (see previous setting 'port')
# Possible values:
# ask (prompt about killing each time. User can accept/reject)
# yes|true (go aheand and kill without asking)
# no|false (don't kill, and don't even ask)
kill_others: ask
service_start_delay: 5 # seconds to wait after restarting systemd services
nginx_proxy:
enabled: true
container_name: dory_dinghy_http_proxy
https_enabled: true
ssl_certs_dir: '' # leave as empty string to use default certs
port: 1234 # port 80 is default for http
tls_port: 2345 # port 443 is default for https
resolv:
enabled: true
nameserver: 127.0.0.1
port: 53 # port where the nameserver listens. On linux it must be 53
Let me know if you have any questions!
Commits (since I forgot to tag them in the commit message):
https://github.com/FreedomBen/dory/commit/3fdac3b30fdb35fa306098b5a9e40acd956b4b25 https://github.com/FreedomBen/dory/commit/2d670fb831f5758f7a602ffe26795550be97f25c
Awesome .. now if there was only a way to have them actually bind to the same port .. so I don't have to switch ports for docker domains ;)
It would just take another proxy I guess .. which could listen on 80/443 which would route .test to puma-dev .. and .docker to dory (of course that should be configurable) .. we could ignore the tls side entirely in dory land .. since this new proxy would need to terminate the tls connections anyways .. it would basically just have to be a domain pattern to port mapping proxy ..
Oh I see, yeah adding another proxy seems like it would do it. I'm not sure if I want to add support for that to dory unless it's a common use case, but it should be reasonably simple to slap a script together that you could run. I'll poke around at it
I'd like a way for dory to be able to co-exist with puma-dev ..
They both seem to want to take over 0.0.0.0:80/443 which doesn't end well ..
Dory does a great job for domains in docker environments, and puma-dev does a great job with local .. heck they don't even conflict in DNS .. but once you get to the actual proxy service it breaks down .. since they both have a proxy that listens on port 80/443 ..
perhaps if dory could have a fallback port (which is expected to be another proxy)
Thoughts?