# Self-host Eclipse Mosquitto

> A lightweight MQTT broker for connecting IoT devices, sensors, and home automation hubs.

- Page: https://levelrail.com/templates/mosquitto/
- JSON: https://levelrail.com/templates/mosquitto.json
- Category: IoT
- Licence: EPL-2.0 OR BSD-3-Clause (Copyleft license)
- Source: https://github.com/eclipse-mosquitto/mosquitto
- Upstream docs: https://mosquitto.org/documentation/

## Requirements
- Memory: about 128 MiB
- amd64: published, arm64: tested
- Needs configuration before start: no
- Pinned image tag: 2.0.20

## Services

| Service | Image | Tag | Ports | Volumes |
| --- | --- | --- | --- | --- |
| mosquitto | eclipse-mosquitto | 2.0.20 | 1883 | mosquitto_data -> /mosquitto/data |

## Environment

| Service | Variable | Kind |
| --- | --- | --- |
| mosquitto | MQTT_PASSWORD | generated |
| mosquitto | MQTT_USER | generated |

## Deploy

### CLI

```bash
levelrail-cli templates deploy mosquitto --name my-mosquitto
```

### API

```bash
curl -X POST -H "Authorization: Bearer $TOKEN" \
  https://levelrail.example.com/api/v1/service-templates/mosquitto/deploy
```

Create a token in the dashboard first. This one-click route deploys it as a trial app you can keep or remove.

## Questions

### Can I deploy Eclipse Mosquitto on Dokploy or Dokku?

The services and pinned images on this page can be run on any Docker host. The public Dokploy templates list has an entry with the id mosquitto for this app, so check that entry as well. Dokku deploys container images with its own commands, so the pinned image eclipse-mosquitto:2.0.20 is what you deploy there.

Self-host Eclipse Mosquitto, Eclipse Mosquitto docker compose file, deploy Eclipse Mosquitto on a VPS: this page lists the pinned image, ports, volumes and the commands for each.
