Connecting to other local services(a database)

I’m trying to connect to a database that is exposed at localhost on my machine but I don’t know how waypoint 's networking is setup so I can’t reach it from my app.

Are you deploying your app to a platform like Docker that is also on the same workstation as your database?

Normally in that case I would expect that you would bind your localhost port to a container port when running a command like docker run. The Docker plugin does not currently enable specifying the equivalent of docker run -p

There are several possible work-arounds:

  1. Probably by far the easiest, use something like ngrok to expose your local database port with a URL that is reachable from inside the docker container.
  2. You could using the Waypoint exec plugin rather than your platform plugin to call docker with the arguments that wire in your localhost database port into the container. That might look something like this if it were mysql listening on 3306:
  deploy {
    use "exec" {
      command = ["docker", "run", "-p", "", "-p", "", "{{.Input.DockerImageFull}}", "/path/to/start/command"]

There is kubernetes example with the exec plugin that could be adapted to do something like this:

Notably if you don’t set the env variables as show in the kubernetes example, then the Entrypoint will not be able to call back into the Waypoint Server and Waypoint URL Service, so logs, exec, and preview URLs would not work.


Yes I am using the docker platform and my database which is also in a container has a port exposed on my host.>5432/tcp