Skip to content
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

Unable to hit /api/tunnels when running using a configuration file #25

Open
esune opened this issue Feb 7, 2023 · 2 comments
Open

Unable to hit /api/tunnels when running using a configuration file #25

esune opened this issue Feb 7, 2023 · 2 comments

Comments

@esune
Copy link

esune commented Feb 7, 2023

I am trying to start-up an ngrok instance and query the /api/tunnels endpoint to fetch settings for downstream services.
When running docker-ngrok using a configuration file, the /api/tunnels endpoint as well as the webUI are not visible/usable on the exposed port on the host.

Example:

  • docker-compose.yaml proxying requests to services running in docker
version: "3"
services:
  ngrok:
    image: ngrok/ngrok
    environment:
      - NGROK_CONFIG=/etc/ngrok.yml
      - NGROK_AUTHTOKEN=<token-here>
    volumes:
      - ./ngrok.yml:/etc/ngrok.yml
    ports:
      - 4056:4040
  • ngrok.yml
version: "2"
tunnels:
    service1:
        addr: service1:5000
        proto: http
        schemes:
            - https
    service2:
        addr: service2:8030
        proto: http
        schemes:
            - https

In the folder where the above docker-compose.yaml and ngrok.yml are located, open a shell and execute docker compose up -d.

The container will start, no logs will be visible. Going to http://localhost:4056 will return a connection error, same when querying the /api/tunnels endpoint.

Using a slightly modified image (to add curl, see following Dockerfile) the result is the same, however attaching a terminal to the container and executing curl http://localhost:4040/api/tunnels returns the correct payload.

FROM ngrok/ngrok:debian

USER root

RUN apt-get -y update; apt-get -y install curl

USER ngrok

Using the following docker-compose.yaml that instead starts ngrok using a command-line argument works as expected (UI exposed to http://localhost:4056 and configuration available via API at /api/tunnels:

version: "3"
services:
  ngrok:
    image: ngrok/ngrok
    command: http 1080
    ports:
      - 4056:4040

Starting the image with a configuration file using an interactive terminal ( such as with docker run -it -p 4056:4040 -v /$(pwd)/ngrok/ngrok.yml:/etc/ngrok.yml -e NGROK_CONFIG=/etc/ngrok.yml ngrok/ngrok) still returns a connection error, however the ngrok endpoints listed in the terminal seem to work correctly (in the example above they would throw a bad gateway error if no services are running with that name/port combination).

@jasonhowk
Copy link

Also see this issue. When using NGROK_CONFIG attempting to browse anything (i.e localhost:4040) will result in an error.

$ http localhost:4040 
http: error: ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')) while doing a GET request to URL: http://localhost:4040/

As soon as I switch to NGROK_AUTHTOKEN everything works as expected.

@esune
Copy link
Author

esune commented May 4, 2023

Bumping this: I'd like to switch some services over to the new (maintained) image, but this is currently preventing us from using it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants