Ngrok: Expose Database in Docker Container
I have a web application built with Elixir that uses a Postgres database in a docker container (https://hub.docker.com/_/postgres/).
I need to expose the web interface (running on port 4000) and the database in the docker container.
I tried adding this to my configuration files:
tunnels: api: addr: 4000 proto: http db: addr: 5432 proto: tcp
Then in my Elixir
config/dev.exs I add this under the database configuration:
... hostname: "TCP_URL_GIVEN_BY_NGRROK"
When I attempt to start the application, it says failure to connect to the database.
The docker command that I used is:
docker run --name phoenix-pg -e POSTRGRES_PASSWORD=postgres -d postgres
What am I doing wrong?