Tunnel health checks & metrics
Health Check
Health checks are handled internally within the application, to automatically restart the tunnel container in the event it enters an unhealthy state.
You can also run a health check on the tunnel using the following steps if you wish, but this is optional:
Step 1: Exec into the container
docker exec -it <container-id> /bin/sh
Step 2: Run tunnel-cf-healthcheck.sh
/home/tines/tunnel-cf-healthcheck.sh
Metrics
You can view tunnel metrics from inside or outside the docker container via the /metrics
endpoint. If you need to override the default port which is 9000
you can run the tunnel container with the env var TUNNEL_METRICS_PORT
.
Option 1: run the container via docker-compose.yml and exec into container
version: '3.9'
services:
tines_tunnel:
image: tines-tunnel:latest # Make sure to use the correct image name and tag
environment:
TUNNEL_METRICS_PORT: "9000"
TINES_TUNNEL_SECRET: "secret"
deploy:
mode: replicated
replicas: 2 # Deploy two replicas per host
docker-compose up -d
docker-compose exec tines_tunnel /bin/sh
You can use tools such as cURL, wget, or others to fetch the metrics from the tunnel inside of the container.
curl http://0.0.0.0:9000/metrics
Option 2: expose the /metrics endpoint outside the container
The -p
option is required to publish the port to the host. This value is needed whether or not you are overriding the TUNNEL_METRICS_PORT
e.g -p 0.0.0.0:${TUNNEL_METRICS_PORT}:<container_port>
See docker-compose.yml
example
version: '3.9'
services:
tines_tunnel:
image: tines-tunnel:latest # Make sure to use the correct image name and tag
ports:
- "9000:9000" # This maps the container's port 9000 to the host's port 9000
environment:
TUNNEL_METRICS_PORT: "9000"
TINES_TUNNEL_SECRET: "secret"
healthcheck:
test: ["CMD", "/home/tines/tunnel-cf-healthcheck.sh"]
interval: 30s
timeout: 10s
retries: 3
deploy:
mode: replicated
replicas: 2 # Deploy two replicas per host
See docker run
example
docker run \
-d \
--name tines-tunnel \
--env TUNNEL_METRICS_PORT=9000 \
--env TINES_TUNNEL_SECRET="YOUR_TUNNEL_SECRET" \
-p 0.0.0.0:9000:9000 \
tines/tines-tunnel:latest
Once the above configuration is in place, you can use tools such as cURL, wget, or others to fetch the metrics from the tunnel outside of the container.
curl http://0.0.0.0:9000/metrics