-
Notifications
You must be signed in to change notification settings - Fork 202
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
Add Postgres port forwarding #42
Comments
Hi, Out of the box if you ran this project on most cloud providers with your change it would allow anyone on the internet to make a connection to your postgres instance and brute force your password unless you explicitly put a cloud firewall in front of your app to block that port. If you wanted to connect to postgres using an external tool you could follow the same pattern this project uses for the web app and publish it over I wrote about this topic in more detail in my DockerCon talk listed at the top of this readme btw https://nickjanetakis.com/blog/best-practices-around-production-ready-web-apps-with-docker-compose#publishing-ports-more-securely-in-production. It's in reference to the web app but it applies to postgres too. |
Thanks! A good solution.. and I neglected to say thanks for this great project! |
For folks newer to Docker, perhaps a brief comment explaining the possible need to include a port mapping? Always want to make sure more novice users don't run into the same simple frustrations that I have 😆 |
It's an idea. Were you thinking as a comment in the compose file or readme file? |
I think for stuff like this, the compose file would be the best place as it is right where the change may need to be made. I can do a PR if you like. |
Yeah I'm on the fence for enabling it by default for |
@nickjj I think those are fair concerns; so maybe add it but commented out with a note explaining the risk or other considerations? That way, people could better figure it out for themselves without leaving open a security risk by default. Oh I just realized that I may be experiencing this issue because I'm running Postgres and Redis in containers, but Rails from my console (and not from a container). That would explain why the port mapping is needed in my circumstance. "The more I know....." |
Yeah normally if everything is running in Docker you don't need port forwarding, but you would need port forwarding if you wanted to make something like Postgres available to pgadmin or some other app running on your Docker host outside of the same Docker network that this project's apps are within. |
First: Great project! I would say it is common to have a client connected to Postgres in development |
Thanks. The quickest way to handle that now is to add If you're ok with using |
Add Postgres port forwarding to be able to connect to the development db using a GUI.
eg:
.env
docker-compose.yml
The text was updated successfully, but these errors were encountered: