Enable and configure Ngrok¶
This section will guide you through getting Ngrok integrated into the Devilbox.
Table of Contents
The Devilbox ships various example configurations to overwrite the default stack. Those files are
compose/ in the Devilbox git directory.
docker-compose.override.yml-all has all examples combined in one file for easy copy/paste.
However, each example also exists in its standalone file as shown below:
host> tree -L 1 compose/ compose/ ├── docker-compose.override.yml-all ├── docker-compose.override.yml-blackfire ├── docker-compose.override.yml-elk ├── docker-compose.override.yml-mailhog ├── docker-compose.override.yml-ngrok ├── docker-compose.override.yml-rabbitmq ├── docker-compose.override.yml-solr ├── docker-compose.override.yml-varnish └── README.md 0 directories, 8 files
In case of Ngrok, the file is
compose/docker-compose.override.yml-ngrok. This file
must be copied into the root of the Devilbox git directory.
|What||How and where|
|Example compose file||
|Container IP address||
|Container host name||
Additionally the following
.env variables can be created for easy configuration:
||Controls the host port on which Ngrok admin UI will be available at.|
||Defines one or more Ngrok tunnels (depending on your license)|
||empty||Free or paid license token for Ngrok (can also be empty)|
||Choose the region where the ngrok client will connect to host its tunnels.|
Ngrok tunnel definitions can be in the form of:
If you don’t use a license you can only specify a single tunnel. If your license is pro enough, you can have multiple comma separated tunnels.
<domain.tld>is the virtual hostname that you want to serve via Ngrok
<addr>is the hostname or IP address of the web server
<port>is the port on which the web server is reachable via HTTP
# Make vhost "project1.loc" which runs on localhost:8080 available HTTP_TUNNELS=project1.loc:localhost:8080 # Make two vhosts available which run on host apache:80 HTTP_TUNNELS=project1.loc:apache:80,project2.loc:apache:80 # Make two vhosts from two different web server addresses available HTTP_TUNNELS=project1.loc:localhost:8080,project2.loc:apache:80
Copy the Ngrok Docker Compose overwrite file into the root of the Devilbox git directory.
(It must be at the same level as the default
host> cp compose/docker-compose.override.yml-ngrok docker-compose.override.yml
By Default Ngrok will forward the
httpd domain, which is represents the default virtual host
(the Devilbox intranet) to your web server (also named
httpd) and makes the admin UI available
4040 on your local machine.
You can of course change the domain as well as where to forward it to (e.g.: to Varnish or HAProxy instead).
Additionally you can also specify a license token in order to allow for more tunnels via
HOST_PORT_NGROK=4040 # Share project1.loca over the internet NGROK_HTTP_TUNNELS=project1.loc:httpd:80 # No license token specified NGROK_AUTHTOKEN=
The final step is to start the Devilbox with Ngrok.
Let’s assume you want to start
host> docker-compose up -d php httpd bind ngrok
For the lazy readers, here are all commands required to get you started. Simply copy and paste the following block into your terminal from the root of your Devilbox git directory:
# Copy compose-override.yml into place cp compose/docker-compose.override.yml-ngrok docker-compose.override.yml # Create .env variable echo "HOST_PORT_NGROK=4040" >> .env echo "# Share project1.loca over the internet" >> .env echo "NGROK_HTTP_TUNNELS=project1.loc:httpd:80" >> .env echo "# No license token specified" >> .env echo "NGROK_AUTHTOKEN=" >> .env echo "NGROK_REGION=us" >> .env # Start container docker-compose up -d php httpd bind ngrok