-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Added docker-compose examples with mosquitto
- Loading branch information
Showing
6 changed files
with
145 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# TagoIO MQTT Relay Examples | ||
|
||
This directory contains example configurations for setting up the TagoIO MQTT Relay using Docker Compose. These examples demonstrate how to configure and deploy the relay with different setups. | ||
|
||
## Table of Contents | ||
|
||
- [Docker Compose Example](#docker-compose-example) | ||
- [Mosquitto Docker Compose Example](#mosquitto-docker-compose-example) | ||
|
||
## Docker Compose Example | ||
|
||
This example demonstrates how to set up the TagoIO MQTT Relay using Docker Compose with a basic configuration. | ||
|
||
### Configuration | ||
|
||
- **File**: `docker-compose.yml` | ||
- **Description**: This configuration sets up the TagoIO MQTT Relay service with the necessary ports and volumes. You can configure the relay using a `config.toml` file or environment variables. | ||
|
||
### Usage | ||
|
||
1. Navigate to the `docker-compose` directory. | ||
2. Ensure the `config.toml` file is correctly configured. | ||
3. Run the following command to start the service: | ||
|
||
```sh | ||
docker-compose up -d | ||
``` | ||
## Mosquitto Docker Compose Example | ||
|
||
This example demonstrates how to set up the TagoIO MQTT Relay with an Eclipse Mosquitto broker using Docker Compose. | ||
|
||
### Configuration | ||
|
||
- **File**: `docker-compose.yml` | ||
- **Description**: This configuration sets up the TagoIO MQTT Relay service and a Mosquitto broker. The relay is configured to connect to the Mosquitto broker using environment variables. | ||
|
||
### Usage | ||
|
||
1. Navigate to the `mosquitto-docker-compose` directory. | ||
2. Ensure the `config.toml` file is correctly configured if you prefer using it over environment variables. | ||
3. Ensure the `mosquitto/config/mosquitto.conf` file is correctly configured for mosquitto. | ||
4. Run the following command to start the services: | ||
|
||
```sh | ||
docker-compose up -d | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[relay] | ||
network_token="Your-Network-Token" # Generate a Network Token under your TagoIO Network Settings | ||
authorization_token="Your-Authorization-Token" # Generate an Authorization Token under your TagoIO > Devices > Authorizations | ||
tagoio_url="https://api.tago.io" # Default | ||
downlink_port="3001" # Default is 3000 | ||
|
||
[relay.mqtt] | ||
client_id="tagoio-relay" # Default is tagoio-relay | ||
tls_enabled=false | ||
address="localhost" | ||
port="1883" | ||
subscribe=["/device/#"] # MQTT topics to subscribe to | ||
username="my-username" | ||
password="my-passowrd" | ||
# broker_tls_ca="" # The CA certificate. Alternative to username and password | ||
# broker_tls_cert="" # The client certificate. | ||
# broker_tls_key="" # The client key. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[relay] | ||
network_token="Your-Network-Token" # Generate a Network Token under your TagoIO Network Settings | ||
authorization_token="Your-Authorization-Token" # Generate an Authorization Token under your TagoIO > Devices > Authorizations | ||
tagoio_url="https://api.tago.io" # Default | ||
downlink_port="3001" # Default is 3000 | ||
|
||
[relay.mqtt] | ||
client_id="tagoio-relay" # Default is tagoio-relay | ||
tls_enabled=false | ||
address="mosquitto-broker" | ||
port="1883" | ||
subscribe=["/device/#"] # MQTT topics to subscribe to | ||
username="my-username" | ||
password="my-passowrd" | ||
# broker_tls_ca="" # The CA certificate. Alternative to username and password | ||
# broker_tls_cert="" # The client certificate. | ||
# broker_tls_key="" # The client key. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
services: | ||
tagoio-mqtt-relay: | ||
image: tagoio/relay:latest | ||
restart: always | ||
depends_on: | ||
- mosquitto-broker | ||
ports: | ||
# Port for the TCP server | ||
- "3001:3001" | ||
|
||
volumes: | ||
- .tagoio-mqtt-relay.toml:/root/.config/.tagoio-mqtt-relay.toml | ||
|
||
# Example using the environment variables for easy setup. You can use the .tagoio-mqtt-relay.toml above instead if you prefer. | ||
environment: | ||
# TagoIO Related Settings | ||
- TAGOIO__RELAY__NETWORK_TOKEN="Your-Network-Token" | ||
- TAGOIO__RELAY__AUTHORIZATION_TOKEN="Your-Authorization-Token" | ||
|
||
# Mosquitto Broker Settings for the Relay to connect to | ||
- TAGOIO__RELAY__MQTT__ADDRESS=mosquitto-broker | ||
- TAGOIO__RELAY__MQTT__TLS_ENABLED=false | ||
- TAGOIO__RELAY__MQTT__CLIENT_ID=tagoio-relay | ||
- TAGOIO__RELAY__MQTT__USERNAME=my-username | ||
- TAGOIO__RELAY__MQTT__PASSWORD=my-password | ||
- TAGOIO__RELAY__MQTT__SUBSCRIBE__1="/tago/#" | ||
|
||
# - TAGOIO__RELAY__MQTT__PORT=1883 | ||
# - TAGOIO__RELAY__MQTT__BROKER_TLS_CA="" | ||
# - TAGOIO__RELAY__MQTT__BROKER_TLS_CERT="" | ||
# - TAGOIO__RELAY__MQTT__BROKER_TLS_KEY="" | ||
|
||
mosquitto-broker: | ||
image: eclipse-mosquitto | ||
restart: unless-stopped | ||
ports: | ||
- "1883:1883" | ||
- "8883:8883" # Port for TLS | ||
volumes: | ||
- ./mosquitto/config:/mosquitto/config:rw | ||
- ./mosquitto/data:/mosquitto/data:rw | ||
- ./mosquitto/log:/mosquitto/log:rw |
21 changes: 21 additions & 0 deletions
21
examples/mosquitto-relay-setup/mosquitto/config/mosquitto.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# mosquitto.conf | ||
|
||
# Default listener (non-TLS) | ||
listener 1883 | ||
|
||
# TLS listener | ||
listener 8883 | ||
#cafile /mosquitto/config/ca.crt | ||
#certfile /mosquitto/config/server.crt | ||
#keyfile /mosquitto/config/server.key | ||
|
||
# Persistence settings | ||
persistence true | ||
persistence_location /mosquitto/data/ | ||
|
||
# Log settings | ||
log_dest file /mosquitto/log/mosquitto.log | ||
log_type all # Log all events, including connection attempts | ||
|
||
# Allow anonymous connections (no password required) | ||
allow_anonymous true |