hookdeck / hookdeck-cli

Alternative to ngrok for localhost asynchronous web development (e.g. webhooks). No account required.
https://hookdeck.com?ref=github-hookdeck-cli
Apache License 2.0
261 stars 9 forks source link

docker login #5

Closed cboden closed 3 years ago

cboden commented 3 years ago

When using hookdeck cli via docker how do I persist a login? After running the command and successfully logging in the next run of the docker command creates a guest account. I'm assuming mounting a volume would do the trick, but I haven't been able to determine where credentials are stored.

cboden commented 3 years ago

I was able to get the login to work but not the proxy:

docker run --rm -it -v ~/.config:/root/.config hookdeck/hookdeck-cli login docker run --rm -it -v ~/.config:/root/.config hookdeck/hookdeck-cli listen $PORT $SOURCE

The Go script is attempting to connect inside its own container but my web server is either running on my host or another container in the network. I attempted to port forward, but that didn't work. Perhaps give users the option to configure the destination?

docker run --rm -it -v ~/.config:/root/.config -p $PORT:$PORT hookdeck/hookdeck-cli listen $PORT $SOURCE

(upon receiving a WebSocket message from your server):

2021-06-17 14:40:21 [ERROR] Failed to POST: Post "http://localhost:****/my/endpoint": dial tcp 127.0.0.1:****: connect: connection refused

mkherlakian commented 3 years ago

Hey @cboden,

Thanks for opening the issue. I think the ask makes a lot of sense. Without the ability to forward to an external URL, the docker version of the CLI is of limited use.

We're going to look at the best solution of implementing this.

I also think that we need a better way for the login a well. We'll look at that one too.

In the meantime, I'm curious if you're willing to share, why do you prefer the Docker version of the CLI as opposed to one of the native builds we offer? It'll help us understand the use cases around CLI.

Thanks!

cboden commented 3 years ago

Major reason: "free" upgrades. I alias as many services' CLI apps as I can as Docker commands so running hookdeck will always use the latest image. No package manager required.

Minor reasons: It doesn't make me think about future inconveniences I've had to deal with before:

alexbouchardd commented 3 years ago

@cboden Totally, I opened #9 which enables forwarding the webhook request to an arbitrary URL. This will allow you to use the docker network or point to your docker gateway to send the request to your machine localhost. It will be reviewed and merge soon, I'll ping once it's been released.

alexbouchardd commented 3 years ago

@cboden v0.3.4 has been released with support for URL as a param to the listen command instead of only a port.

This means you can now set the address / IP where the webhooks will be forwarded by the CLI client.

The command would look something like hookdeck listen 192.168.0.100:5000. Using docker network you can also forward to another container, @mkherlakian made a quick recording demoing this https://www.loom.com/share/db30740716514527aadffe150a3eabff

mkherlakian commented 3 years ago

@cboden You can also use the default Docker network, but in this case you won’t have docker host name resolution of course. Otherwise this works in Docker or natively. Thanks for your reply on the reasons as well it makes total sense!