Code Monkey home page Code Monkey logo

heroku-buildpack-ngrok's Introduction

Heroku ngrok Buildpack

This is a Heroku Buildpack for running a auxiliary port on a process in dyno. The auxiliary port will be proxied by ngrok, which makes it accessible from a remote machine. By default, the port is 9090, but it can be configured with the $AUX_PORT config variable.

Setup

First, create a free ngrok account. This is necessary to use TCP with their service. Then capture your API key, and set it as a config var on your Heroku app like this:

$ heroku config:set NGROK_API_TOKEN=xxxxxx

Next, add this buildpack to your app:

$ heroku buildpacks:add jkutner/ngrok

Then add your primary buildpack. For example, if you are using Java:

$ heroku buildpacks:add heroku/java

Now modify your Procfile by prefixing your web process with the with_ngrok command. For example:

web: with_ngrok java $JAVA_OPTS -cp target/classes:target/dependency/* Main

Finally, commit your changes, and redeploy the app:

$ git add Procfile
$ git commit -m "Added with_ngrok"
$ git push heroku master

Usage

Once your app is running with the ngrok buildpack and the with_ngrok command, you'll see something like this in your logs:

2015-05-19T16:06:36.530988+00:00 app[web.1]: Listening for transport dt_socket at address: 8998
...
2015-05-19T16:06:37.052977+00:00 app[web.1]: [05/19/15 16:06:37] [INFO] [client] Tunnel established at tcp://ngrok.com:39678

Then, from your local machine, you can connect to the auxiliary port using the ngrok URL in the logs. For example:

$ open http://ngrok.com:39678

Customizing

You can customize the aux port like so:

$ heroku config:set AUX_PORT=5001

You can customize the execution of ngrok by setting the NGROK_OPTS config var like so:

$ heroku config:set NGROK_OPTS="-subdomain=my-custom-name"

You can also add a .ngrok to your app.

heroku-buildpack-ngrok's People

Contributors

jkutner avatar creatorrr avatar agarbund avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.