Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/afiestas/gluetun-sync

Gluetun-Sync is an open-source utility designed to automatically update your services when the NAT port changes in Gluetun VPN
https://github.com/afiestas/gluetun-sync

gluetun hooks http slack sync synchronisation synchronization torrent webhooks

Last synced: about 2 months ago
JSON representation

Gluetun-Sync is an open-source utility designed to automatically update your services when the NAT port changes in Gluetun VPN

Awesome Lists containing this project

README

        

# Gluetun-Sync

![Build](https://github.com/afiestas/gluetun-sync/actions/workflows/main.yml/badge.svg)
![License](https://img.shields.io/badge/license-MIT-blue)
![Version](https://img.shields.io/badge/version-1.0.0-orange)
[![Go Report Card](https://goreportcard.com/badge/github.com/afiestas/gluetun-sync)](https://goreportcard.com/report/github.com/afiestas/gluetun-sync)

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.

## Features

- **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.

## Installation
### Go get
```bash
go get -u github.com/afiestas/gluetun-sync
```

### Container/Docker
```bash
docker run ...
```

## Configuration

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

### config.yml
```yaml
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"
```

### config.toml
Example in TOML for slack webhook
```toml
[[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.

## Usage

A config file is required for the list of requests, the port file can easily be indicated
via arguments

```bash
gluetun-sync --port-file /portfile
```

## License

This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details.