Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #461 from ChIoT-Tech/master
Update README and add docker example (mainly as a base for reproducing issues)
- Loading branch information
Showing
16 changed files
with
636 additions
and
16 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
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,44 @@ | ||
# Config file for mosquitto | ||
# | ||
# See mosquitto.conf(5) for more information. | ||
# | ||
# This is a very basic configuration (no security etc - do not use in production!) | ||
# If you are using this to replicate a bug please copy your own configuration in here (changing folders as necessary) | ||
|
||
allow_anonymous true # Anyone can connect | ||
|
||
# Port to use for the default listener. | ||
#port 1883 | ||
|
||
#log_type error | ||
#log_type warning | ||
#log_type notice | ||
#log_type information | ||
log_type all | ||
|
||
# Log to the console (visible using `docker-compose logs`). To log to a file uncomment the line below | ||
log_dest stdout | ||
#log_dest file /mosquitto/log/mosquitto.log | ||
|
||
# Log entries are easier to read with an ISO 8601 timestamp | ||
log_timestamp true | ||
log_timestamp_format %Y-%m-%dT%H:%M:%S | ||
|
||
# For demonstration purposes we will not store messages to disk (the appropriate value depends upon what you are testing) | ||
# Note: If enabled then you will probably want to add a bind to the docker-compose.yml so the persistence_file is retained. | ||
#persistence false | ||
|
||
#persistence true | ||
#autosave_interval 20 | ||
#persistence_location /mosquitto/data/ | ||
#persistence_file mosquitto.db | ||
|
||
# The maximum number of QoS 1 and 2 messages to hold in a queue per client | ||
# above those that are currently in-flight. Defaults to 100. Set | ||
# to 0 for no maximum (not recommended). | ||
# We do set this to 0 for testing because the default is may result in lost messages if there are a lot of | ||
# messages waiting when the connection is re-established (they will all be sent immediately). This should not be | ||
# 0 on a production system (but the value chosen should take into account likely queue sizes and bandwidth) | ||
max_queued_messages 0 | ||
|
||
|
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,4 @@ | ||
data | ||
==== | ||
|
||
If you enable persistence in `mosquitto.conf` then the database will be written here. |
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,4 @@ | ||
log | ||
=== | ||
|
||
If you enable logging to a file in the `mosquitto.conf` then the logs will be written here |
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,7 @@ | ||
Binds | ||
===== | ||
|
||
Folders within this folder will be bound to folders within the containers; this includes the mosquitto | ||
configuration and persistence files. | ||
|
||
Note: While testing some files within these folders may become large and should be deleted when appropriate. |
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,4 @@ | ||
sub | ||
=== | ||
|
||
If you configure the `sub` application to write to disk then the output will go here. |
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 @@ | ||
version: "3.8" | ||
services: | ||
mosquitto: | ||
image: eclipse-mosquitto | ||
networks: | ||
- test-net | ||
ports: | ||
- target: 8883 | ||
published: 8883 | ||
protocol: tcp | ||
mode: host | ||
volumes: | ||
- type: bind | ||
source: ./binds/mosquitto/config | ||
target: /mosquitto/config | ||
read_only: true | ||
- type: bind | ||
source: ./binds/mosquitto/data | ||
target: /mosquitto/data | ||
- type: bind | ||
source: ./binds/mosquitto/log | ||
target: /mosquitto/log | ||
pub: | ||
build: publisher/. | ||
networks: | ||
- test-net | ||
depends_on: | ||
- mosquitto | ||
sub: | ||
build: subscriber/. | ||
networks: | ||
- test-net | ||
depends_on: | ||
- mosquitto | ||
volumes: | ||
- type: bind | ||
source: ./binds/sub | ||
target: /binds | ||
read_only: false | ||
networks: | ||
test-net: | ||
external: false |
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,15 @@ | ||
# Compile stage | ||
FROM golang:alpine AS build-env | ||
ENV CGO_ENABLED 0 | ||
|
||
ADD . /pub_src | ||
WORKDIR /pub_src | ||
RUN go build -gcflags "all=-N -l" -o /pub | ||
|
||
# Final stage | ||
FROM alpine:latest | ||
|
||
COPY --from=build-env /pub / | ||
|
||
# Run | ||
CMD ["/pub"] |
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,8 @@ | ||
module publisher | ||
|
||
go 1.15 | ||
|
||
require ( | ||
github.com/eclipse/paho.mqtt.golang v1.2.1-0.20200918111050-ba85050a1f23 | ||
golang.org/x/net v0.0.0-20201029055024-942e2f445f3c // indirect | ||
) |
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 @@ | ||
github.com/eclipse/paho.mqtt.golang v1.2.1-0.20200918111050-ba85050a1f23 h1:znRijtV5P9m5mmDsy4oesCPlCIPDILTj4wosaZWsTpY= | ||
github.com/eclipse/paho.mqtt.golang v1.2.1-0.20200918111050-ba85050a1f23/go.mod h1:eTzb4gxwwyWpqBUHGQZ4ABAV7+Jgm1PklsYT/eo8Hcc= | ||
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= | ||
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= | ||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= | ||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= | ||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= | ||
golang.org/x/net v0.0.0-20200425230154-ff2c4b7c35a0/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= | ||
golang.org/x/net v0.0.0-20201029055024-942e2f445f3c h1:rpcgRPA7OvNEOdprt2Wx8/Re2cBTd8NPo/lvo3AyMqk= | ||
golang.org/x/net v0.0.0-20201029055024-942e2f445f3c/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= | ||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= | ||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= | ||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= | ||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= |
Oops, something went wrong.