Code Monkey home page Code Monkey logo

ngrocker's Introduction

[DEPRECATED] ngrocker

The ngrocker, is a docker project using docker-compose and source code of ngrok 1.x to easily run the ngrok-server and ngrok-client.
The images of this project together has less of 35 MB.

The focus of this project is the ngrok sniffer tool with locally HTTP tunnels.

Features

  • Small, it uses alpine image and multi-stage build;
  • Simple, this project was made to be easy as the original ngrok server;
  • Sniffer, the focus of this project is the ngrok sniffer tool, so the updates will focus on improving it. Some improvements are already available, like requests search and colored methods and status.

How to use

To start ngrocker, you can:

Using script

This script has been tested only on Ubuntu 16.04 LTS, but your code not have any ubuntu exclusive code.

First, you need clone this repository, access your folder and execute the script:

$ git clone https://github.com/magicred7/ngrocker.git
$ cd ngrocker
$ ./ngrocker

The script will show all available commands. To link the ngrocker into your system, run:

$ ./ngrocker -l

Now you can run ngrocker from anywhere. See the help of the script for more information.

This script is an automation of "Using docker-compose". I recommend you read it to better understand its operation.

Script usage

# To make a tunnel of the nginx running into your port 80 to localhost:81.
$ ngrocker -h localhost:80 -t localhost:81

# To make a tunnel of the nginx container to localhost:80.
# Note if your nginx expose the port 80, if yes, you tunnel
# has to run on another port.
$ ngrocker -c nginx

# To make a tunnel of the your website into localhost:80.
# Your website needs to be HTTP. HTTPS not work yet.
$ ngrocker -h your-website.com


######### SOME EXAMPLES #########
$ ngrocker -c laradock_nginx_1 -t my-etc-host-site.com:81
$ ngrocker -h localhost:80 -t localhost:81 -i 82
$ ngrocker -n laradock_frontend -c nginx -t localhost:81

Using docker-compose

Clone this repository, access your folder and create a .env file. If you want, you can just clone the env-example file and change the name:

$ git clone https://github.com/magicred7/ngrocker.git
$ cd ngrocker
$ mv env-example .env

Now configure your .env file and up the images with docker-compose:

$ docker-compose up -d

If you want run just the ngrok server, execute:

$ docker-compose up -d ngrok-server

Now you have the ngrok-server and ngrok-client (if you want), running into your machine!

Configuration

There are two ways to use the ngrocker.

The first way,

is making a tunnel of other container. To make this, you need to define a docker network (or using a pre-defined network) and use the container hostname or your ip, to make an internal tunnel. After that, the defined http port is going to show the container content. The tunnel will be working.

Very difficult? No!

You just need create a docker network (or use one) and configure the other container to use them. On the ngrok, you just modify your .env file like this:

NGROK_NETWORK_NAME= <shared_network_name>
NGROK_TARGET_ADDRESS= <container_hostname>:<container_port>
NGROK_TUNNEL_ADDRESS= <tunnel_address>

Example:
If you want create a Laradock Nginx's tunnel, the Laradock Project, already make a network called laradock_frontend. Just use it, the hostname of the nginx (called nginx too) and the http port:

NGROK_HTTP_PORT=81

NGROK_NETWORK_NAME=laradock_frontend
NGROK_TARGET_ADDRESS=nginx:80
NGROK_TUNNEL_ADDRESS=localhost

I changed the ngrok's http port to 81, because the nginx are running into this port too. The tunnel address can be other address configured into nginx too.

Now you can access then, into your host machine with address localhost:81.

The second way,

is configuring the client to make a host tunnel. The configuration is the same, but where you set the hostname of the docker container, you will put the IP address of your host.
Example, if your IP is 172.26.0.2:

NGROK_HTTP_PORT=81

NGROK_TARGET_ADDRESS=172.26.0.2:80
NGROK_TUNNEL_ADDRESS=localhost

But, if you want use modified names, then use the DNS to define the server will resolve this names:

NGROK_HTTP_PORT=80

NGROK_NETWORK_DNS=172.26.0.1
NGROK_TARGET_ADDRESS=my-resolved-name.com:80
NGROK_TUNNEL_ADDRESS=localhost

Now you can access then, into your host machine with address localhost:80.

IMPORTANT: If you change the .env file, you must restart the containers for the new settings to work.

Nginx Configured Names

If you want use nginx, just set the name of website into NGROK_TUNNEL_ADDRESS:

NGROK_TUNNEL_ADDRESS=my-local-website.com

After this, access this site with the ngrok's http port, like my-local-website.com:81.

Default Ports

  • 4443, to ngrok server;
  • 443, to https tunnel (disabled, still does not work);
  • 80, to http tunnel;
  • 4040, to ngrok inspector;

Details

Author

Special thanks

Related

Helpful pages

Cautions

This project (ngrocker) dont focus security, please dont use this for this purpose.

ngrok's original repository message:

DO NOT RUN THIS VERSION OF NGROK (1.X) IN PRODUCTION. Both the client and server are known to have serious reliability issues including memory and file descriptor leaks as well as crashes. There is also no HA story as the server is a SPOF. You are advised to run 2.0 for any production quality system.

License

MIT License

ngrocker's People

Contributors

ecromaneli avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ngrocker's Issues

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.