Skip to content

Commit

Permalink
build: Add script to spin up a local Mosquitto broker
Browse files Browse the repository at this point in the history
  • Loading branch information
empicano committed Aug 18, 2023
1 parent b3c3de3 commit b9ce2bf
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ We're very happy about contributions to aiomqtt! ✨
- Install the dependencies with `./scripts/setup`
- Run black, ruff, and mypy with `./scripts/check`
- Run the tests with `./scripts/test`
- Spin up a local mosquitto broker via Docker with `./scripts/develop`

## The documentation

Expand Down
1 change: 1 addition & 0 deletions scripts/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Development scripts

- `check`: Format and lint the code with `black` and `ruff`; Use `--dry` option for dry run
- `develop`: Spin up a local mosquitto broker via Docker
- `docs`: Build the documentation; Use `--reload` option to serve locally with live reload
- `setup`: Setup or update the dependencies after a `git clone` or `git pull`
- `test`: Run the tests
Expand Down
11 changes: 11 additions & 0 deletions scripts/develop
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

# Safety first
set -o errexit -o pipefail -o nounset
# Change into the project's directory
cd "$(dirname "$0")/.."

# Path to our Mosquitto configuration
MOSQUITTO_CONFIGURATION="$(pwd)/scripts/mosquitto.conf"
# Start a Mosquitto MQTT broker via docker
docker run -it --rm --name mosquitto -p 127.0.0.1:1883:1883 -v "${MOSQUITTO_CONFIGURATION}:/mosquitto/config/mosquitto.conf" eclipse-mosquitto:latest
5 changes: 5 additions & 0 deletions scripts/mosquitto.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
listener 1883
protocol mqtt
persistence false
log_dest stderr
allow_anonymous true

0 comments on commit b9ce2bf

Please sign in to comment.