Gluetun-Sync is an open-source utility designed to automatically update your services when the NAT port changes in Gluetun VPN. Built to run seamlessly alongside Gluetun, this tool monitors port changes and triggers HTTP requests to update the relevant services or send notifications.
- Auto Monitoring: Continuously watches Gluetun for port changes.
- Configurable Actions: HTTP requests to update services or send notifications.
- Authenticated actions: HTTP requests are executed in series and cookies/authorization headers are carried on
- Flexible Configuration: Support for JSON, TOML, and YAML configuration files.
- Docker Friendly: Designed to run in a Docker container.
go get -u github.com/afiestas/gluetun-sync
docker run ...
The service can be configured using JSON, TOML, or YAML configuration files. The URL and payload fields can be configured using a Go template to include either the provided credentials or the port.
- Username
- Password
- Port
Here is an example using YAML for a service that requires login
port-file: "/tmp/portfile"
requests:
- someservice:
credentials:
username: "admin"
password: "password"
requests:
- method: "POST"
url: "http://localhost:8080/api/v2/auth/login"
payload: "username={{.Username}}&password={{.Password}}"
content-type: "application/x-www-form-urlencoded"
- method: "POST"
url: "http://localhost:8080/api/v2/app/setPreferences"
payload: "json={\"listen_port\": \"{{.Port}}\"}"
content-type: "application/x-www-form-urlencoded"
Example in TOML for slack webhook
[[requests]]
[requests.slack]
[[requests.slack.requests]]
method = "POST"
url = "https://hooks.slack.com/services/your/webhook/url"
payload = "{\"text\":\"New Port: {{.Port}}\"}"
content-type = "application/json"
If you have some configuration that you want to share please issue a PR and we'll add it
to the config/
folder as an example.
A config file is required for the list of requests, the port file can easily be indicated via arguments
gluetun-sync --port-file /portfile
This project is licensed under the MIT License - see the LICENSE.md file for details.