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

Feature request NGROK_CONFIG #33

Open
lcherone opened this issue Jan 31, 2019 · 3 comments
Open

Feature request NGROK_CONFIG #33

lcherone opened this issue Jan 31, 2019 · 3 comments

Comments

@lcherone
Copy link

lcherone commented Jan 31, 2019

Then can just pass the config path and run it, this way can run multiple tunnels.

@aaabramov
Copy link
Contributor

This will help also expose 4040 port to debug requests remotely without port forwarding.

@ghost
Copy link

ghost commented Nov 8, 2020

yes, this would be awesome.

@lcherone
Copy link
Author

lcherone commented Nov 8, 2020

A solution I used, ill share here in case anyone is interested in doing/needing the same.

Make a folder called ngrok and put in the following files:

Dockerfile

FROM alpine:3.9

RUN set -x && \
    apk add --no-cache -t .deps ca-certificates && \
    # Install glibc on Alpine (required by docker-compose) from
    # https://github.com/sgerrand/alpine-pkg-glibc
    # See also https://github.com/gliderlabs/docker-alpine/issues/11
    wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub && \
    wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.29-r0/glibc-2.29-r0.apk && \
    apk add glibc-2.29-r0.apk && \
    rm glibc-2.29-r0.apk && \
    apk del --purge .deps

RUN set -x \
    # Install ngrok (latest official stable from https://ngrok.com/download).
    && apk add --no-cache curl \
    && curl -Lo /ngrok.zip https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip \
    && unzip -o /ngrok.zip -d /bin \
    && rm -f /ngrok.zip \
    # Create non-root user.
    && adduser -h /home/ngrok -D -u 6737 ngrok

RUN  ngrok --version

# Add config script.
COPY --chown=ngrok ngrok.yml /home/ngrok/.ngrok2/
COPY entrypoint.sh /

USER ngrok
ENV USER=ngrok

EXPOSE 4040

ENTRYPOINT ["/entrypoint.sh"]

entrypoint.sh

#!/bin/sh -e

if [ -n "$@" ]; then
  exec "$@"
fi

ARGS="ngrok start --all -config=/home/ngrok/.ngrok2/ngrok.yml"

set -x
exec $ARGS

Then your ngrok.yml config, which you could mount in with a volume to override (/home/ngrok/.ngrok2/ngrok.yml), or this file is the default.

authtoken: ...
#region: eu
web_addr: 0.0.0.0:4040
tunnels:
    app:
        proto: http
        addr: app:8080
        inspect: true

Then in docker-compose.yml, its just:

  ngrok:
    build: ./ngrok
    container_name: ngrok
    # example overide above with config from home
    #volumes:
    #  - ~/ngrok.yml:/home/ngrok/.ngrok2/ngrok.yml
    ports:
      - 4040:4040
    links: # prob not needed in > v2
      - app

app being, your app and would obviously be changed to suit your setup.

Hope it helps

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