Skip to content

Commit 2c0e039

Browse files
authored
Merge pull request #9 from snowplow-incubator/remote-tunnel
Add ability to support ngrok tunnels
2 parents 4156e9e + 08d011b commit 2c0e039

File tree

5 files changed

+45
-2
lines changed

5 files changed

+45
-2
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.DS_Store
22
.env
33
volume/
4-
grafana/*
4+
grafana/*
5+
tunnel/ngrok.yml

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Snowplow Local is designed to provide a fast, easy to use local development envi
1515
- Test new or existing versions of the Snowplow pipeline
1616
- Write enriched data to remote destinations (including S3, GCS etc)
1717
- Test and validate Snowbridge configurations
18+
- Send events remotely from another machine to your local pipeline (via `--profile tunnel`)
1819

1920
## Licensing
2021

@@ -46,6 +47,8 @@ A user interface listens to events that have been enriched (good, bad and incomp
4647

4748
A basic website that can be used to fire test events can be accessed at [http://localhost:8082](http://localhost:8082). This is useful for testing your pipeline and ensuring that events are being collected correctly.
4849

50+
Although test events can be fired locally you can also send events from another remote machine using the `--tunnel` profile. See the 'Tunneling' section below.
51+
4952
## Differences to a production pipeline
5053

5154
This software is not designed to be run in production or at high volume and is instead designed for a local experience.
@@ -128,6 +131,10 @@ Logs for components that write them (e.g., collector, enrich) are written to Clo
128131

129132
The storage for Grafana is also mounted as a volume so you can persist any dashboards and data across restarts, rather than losing them on reboot!
130133

134+
## Tunneling
135+
136+
By using the `--profile tunnel` flag this will start a ngrok tunnel locally that enables traffic forwarding from an arbitrary URL to your local collector. You can configure this forwarding URL and other settings in `tunnel/ngrok.yml` by copying over the example file - `ngrok.yml.example`. In addition you can configure security settings (e.g., only allowing traffic from certain IP ranges / CIDRs) by customising the `ngrok/policy.yml` file. For more configuration options see the ngrok agent config documentation [here](https://ngrok.com/docs/agent/config/v3/).
137+
131138
## Gotchas
132139

133140
### Snowflake loader

docker-compose.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,4 +289,20 @@ services:
289289
container_name: "local-failed-ui"
290290
image: "snowplow/failed-events-ui:0.0.1"
291291
ports:
292-
- "3001:3000"
292+
- "3001:3000"
293+
294+
ngrok:
295+
container_name: ngrok-tunnel
296+
image: ngrok/ngrok:latest
297+
profiles: [tunnel]
298+
restart: unless-stopped
299+
command:
300+
- "start"
301+
- "--all"
302+
- "--config"
303+
- "/etc/ngrok.yml"
304+
volumes:
305+
- "./tunnel/ngrok.yml:/etc/ngrok.yml"
306+
- "./tunnel/policy.yml:/etc/policy.yml"
307+
ports:
308+
- "4040:4040"

tunnel/ngrok.yml.example

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: 3
2+
3+
agent:
4+
authtoken: ""
5+
6+
endpoints:
7+
- name: collector
8+
url: https://snowplow.ngrok.app
9+
upstream:
10+
url: http://localhost:8080
11+
traffic_policy_file: /etc/policy.yml
12+

tunnel/policy.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
on_tcp_connect:
2+
- actions:
3+
- type: restrict-ips
4+
config:
5+
enforce: false
6+
allow:
7+
- 1.1.1.1/32

0 commit comments

Comments
 (0)