Skip to content

Commit dacad22

Browse files
Run update.sh
1 parent 6341b49 commit dacad22

File tree

6 files changed

+435
-82
lines changed

6 files changed

+435
-82
lines changed

bash/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ WARNING:
2424

2525
# Supported tags and respective `Dockerfile` links
2626

27-
- [`devel-20220325`, `devel`, `devel-20220325-alpine3.15`, `devel-alpine3.15`](https://github.com/tianon/docker-bash/blob/a63e8f687b7e3b7ee28b329867033ce75b083cfe/devel/Dockerfile)
27+
- [`devel-20220404`, `devel`, `devel-20220404-alpine3.15`, `devel-alpine3.15`](https://github.com/tianon/docker-bash/blob/0a87b91efb695f83e268c149541867fce0623543/devel/Dockerfile)
2828
- [`5.2-alpha`, `5.2-rc`, `rc`, `5.2-alpha-alpine3.15`, `5.2-rc-alpine3.15`, `rc-alpine3.15`](https://github.com/tianon/docker-bash/blob/70b65fa22011fa4b58c93570b2fed168b79102e4/5.2-rc/Dockerfile)
2929
- [`5.1.16`, `5.1`, `5`, `latest`, `5.1.16-alpine3.15`, `5.1-alpine3.15`, `5-alpine3.15`, `alpine3.15`](https://github.com/tianon/docker-bash/blob/70b65fa22011fa4b58c93570b2fed168b79102e4/5.1/Dockerfile)
3030
- [`5.0.18`, `5.0`, `5.0.18-alpine3.15`, `5.0-alpine3.15`](https://github.com/tianon/docker-bash/blob/70b65fa22011fa4b58c93570b2fed168b79102e4/5.0/Dockerfile)

emqx/README.md

Lines changed: 362 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,362 @@
1+
<!--
2+
3+
********************************************************************************
4+
5+
WARNING:
6+
7+
DO NOT EDIT "emqx/README.md"
8+
9+
IT IS AUTO-GENERATED
10+
11+
(from the other files in "emqx/" combined with a set of templates)
12+
13+
********************************************************************************
14+
15+
-->
16+
17+
# Quick reference
18+
19+
- **Maintained by**:
20+
[EMQ Technologies](https://github.com/emqx)
21+
22+
- **Where to get help**:
23+
[Discussions](https://github.com/emqx/emqx/discussions) or [Slack](https://slack-invite.emqx.io/)
24+
25+
# Supported tags and respective `Dockerfile` links
26+
27+
- [`4.3.5`, `4.3`, `4`, `latest`](https://github.com/emqx/emqx-docker/blob/915d12f4a289def311fdc350f85539c74068bdb9/4.3/Dockerfile)
28+
29+
# Quick reference (cont.)
30+
31+
- **Where to file issues**:
32+
[https://github.com/emqx/emqx-docker/issues](https://github.com/emqx/emqx-docker/issues)
33+
34+
- **Supported architectures**: ([more info](https://github.com/docker-library/official-images#architectures-other-than-amd64))
35+
[`amd64`](https://hub.docker.com/r/amd64/emqx/)
36+
37+
- **Published image artifact details**:
38+
[repo-info repo's `repos/emqx/` directory](https://github.com/docker-library/repo-info/blob/master/repos/emqx) ([history](https://github.com/docker-library/repo-info/commits/master/repos/emqx))
39+
(image metadata, transfer size, etc)
40+
41+
- **Image updates**:
42+
[official-images repo's `library/emqx` label](https://github.com/docker-library/official-images/issues?q=label%3Alibrary%2Femqx)
43+
[official-images repo's `library/emqx` file](https://github.com/docker-library/official-images/blob/master/library/emqx) ([history](https://github.com/docker-library/official-images/commits/master/library/emqx))
44+
45+
- **Source of this description**:
46+
[docs repo's `emqx/` directory](https://github.com/docker-library/docs/tree/master/emqx) ([history](https://github.com/docker-library/docs/commits/master/emqx))
47+
48+
# What is EMQ X ?
49+
50+
[EMQ X MQTT broker](https://www.emqx.io/) is a fully open source, highly scalable, highly available distributed MQTT messaging broker for IoT, M2M and Mobile applications that can handle tens of millions of concurrent clients.
51+
52+
Starting from 3.0 release, *EMQ X* broker fully supports MQTT V5.0 protocol specifications and backward compatible with MQTT V3.1 and V3.1.1, as well as other communication protocols such as MQTT-SN, CoAP, LwM2M, WebSocket and STOMP. The 3.0 release of the *EMQ X* broker can scaled to 10+ million concurrent MQTT connections on one cluster.
53+
54+
![logo](https://raw.githubusercontent.com/docker-library/docs/6341b491d0019f28275259187b23b988ca102c38/emqx/logo.png)
55+
56+
# How to use this image
57+
58+
### Run emqx
59+
60+
Execute some command under this docker image
61+
62+
```console
63+
$ docker run -d --name emqx emqx:tag
64+
```
65+
66+
For example
67+
68+
```console
69+
$ docker run -d --name emqx -p 18083:18083 -p 1883:1883 emqx:latest
70+
```
71+
72+
The emqx broker runs as linux user `emqx` in the docker container.
73+
74+
### Configuration
75+
76+
Use the environment variable to configure the EMQ X docker container.
77+
78+
By default, the environment variables with `EMQX_` prefix are mapped to key-value pairs in configuration files.
79+
80+
You can change the prefix by overriding `HOCON_ENV_OVERRIDE_PREFIX`.
81+
82+
Example:
83+
84+
```bash
85+
EMQX_LISTENERS__SSL__DEFAULT__ACCEPTORS <--> listeners.ssl.default.acceptors
86+
EMQX_ZONES__DEFAULT__MQTT__MAX_PACKET_SIZE <--> zones.default.mqtt.max_packet_size
87+
```
88+
89+
- Prefix `EMQX_` is removed
90+
- All upper case letters is replaced with lower case letters
91+
- `__` is replaced with `.`
92+
93+
If `HOCON_ENV_OVERRIDE_PREFIX=DEV_` is set:
94+
95+
```bash
96+
DEV_LISTENER__SSL__EXTERNAL__ACCEPTORS <--> listener.ssl.external.acceptors
97+
DEV_MQTT__MAX_PACKET_SIZE <--> mqtt.max_packet_size
98+
```
99+
100+
Non mapped environment variables:
101+
102+
```bash
103+
EMQX_NAME
104+
EMQX_HOST
105+
```
106+
107+
These environment variables will ignore for configuration file.
108+
109+
#### EMQ X Configuration
110+
111+
> NOTE: All EMQ X Configuration in [etc/emqx.conf](https://github.com/emqx/emqx/blob/master/etc/emqx.conf) could config by environment. The following list is just an example, not a complete configuration.
112+
113+
| Options | Default | Mapped | Description |
114+
|-------------|----------------|--------|----------------------------|
115+
| `EMQX_NAME` | container name | none | emqx node short name |
116+
| `EMQX_HOST` | container IP | none | emqx node host, IP or FQDN |
117+
118+
The list is incomplete and may changed with [etc/emqx.conf](https://github.com/emqx/emqx/blob/master/etc/emqx.conf) and plugin configuration files. But the mapping rule is similar.
119+
120+
If set `EMQX_NAME` and `EMQX_HOST`, and unset `EMQX_NODE_NAME`, `EMQX_NODE_NAME=$EMQX_NAME@$EMQX_HOST`.
121+
122+
For example, set mqtt tcp port to 1883
123+
124+
```console
125+
$ docker run -d --name emqx -e EMQX__LISTENERS__TCP__DEFAULT__BIND=1883 -p 18083:18083 -p 1883:1883 emqx:latest
126+
```
127+
128+
#### EMQ Loaded Modules Configuration
129+
130+
| Options | Default | Description |
131+
|-----------------------|-------------------|-----------------------------|
132+
| `EMQX_LOADED_MODULES` | see content below | default modules emqx loaded |
133+
134+
Default environment variable `EMQX_LOADED_MODULES`, including
135+
136+
- `emqx_mod_presence`
137+
138+
```bash
139+
# The default EMQX_LOADED_MODULES env
140+
EMQX_LOADED_MODULES="emqx_mod_presence"
141+
```
142+
143+
For example, set `EMQX_LOADED_MODULES=emqx_mod_delayed,emqx_mod_rewrite` to load these two modules.
144+
145+
You can use comma, space or other separator that you want.
146+
147+
All the modules defined in env `EMQX_LOADED_MODULES` will be loaded.
148+
149+
```bash
150+
EMQX_LOADED_MODULES="emqx_mod_delayed,emqx_mod_rewrite"
151+
EMQX_LOADED_MODULES="emqx_mod_delayed emqx_mod_rewrite"
152+
EMQX_LOADED_MODULES="emqx_mod_delayed | emqx_mod_rewrite"
153+
```
154+
155+
#### EMQ Loaded Plugins Configuration
156+
157+
| Options | Default | Description |
158+
|-----------------------|-------------------|-----------------------------|
159+
| `EMQX_LOADED_PLUGINS` | see content below | default plugins emqx loaded |
160+
161+
Default environment variable `EMQX_LOADED_PLUGINS`, including
162+
163+
- `emqx_recon`
164+
- `emqx_retainer`
165+
- `emqx_rule_engine`
166+
- `emqx_management`
167+
- `emqx_dashboard`
168+
169+
```bash
170+
# The default EMQX_LOADED_PLUGINS env
171+
EMQX_LOADED_PLUGINS="emqx_recon,emqx_retainer,emqx_management,emqx_dashboard"
172+
```
173+
174+
For example, set `EMQX_LOADED_PLUGINS= emqx_retainer,emqx_rule_engine` to load these two plugins.
175+
176+
You can use comma, space or other separator that you want.
177+
178+
All the plugins defined in `EMQX_LOADED_PLUGINS` will be loaded.
179+
180+
```bash
181+
EMQX_LOADED_PLUGINS="emqx_retainer,emqx_rule_engine"
182+
EMQX_LOADED_PLUGINS="emqx_retainer emqx_rule_engine"
183+
EMQX_LOADED_PLUGINS="emqx_retainer | emqx_rule_engine"
184+
```
185+
186+
#### EMQ X Plugins Configuration
187+
188+
The environment variables which with `EMQX_` prefix are mapped to all emqx plugins' configuration file, `.` get replaced by `__`.
189+
190+
Example:
191+
192+
```bash
193+
EMQX_RETAINER__STORAGE_TYPE <--> retainer.storage_type
194+
EMQX_RETAINER__MAX_PAYLOAD_SIZE <--> retainer.max_payload_size
195+
```
196+
197+
Don't worry about where to find the configuration file of emqx plugins, this docker image will find and config them automatically using some magic.
198+
199+
All plugin of emqx project could config in this way, following the environment variables mapping rule above.
200+
201+
Assume you are using redis auth plugin, for example:
202+
203+
```bash
204+
#EMQX_RETAINER__STORAGE_TYPE = "ram"
205+
#EMQX_RETAINER.MAX_PAYLOAD_SIZE = 1MB
206+
207+
docker run -d --name emqx -p 18083:18083 -p 1883:1883 -p 4369:4369 \
208+
-e EMQX_LISTENERS__TCP__DEFAULT=1883 \
209+
-e EMQX_LOADED_PLUGINS="emqx_retainer" \
210+
-e EMQX_RETAINER__STORAGE_TYPE = "ram" \
211+
-e EMQX_RETAINER__MAX_PAYLOAD_SIZE = 1MB \
212+
emqx:latest
213+
```
214+
215+
For numbered configuration options where the number is next to a `.` such as:
216+
217+
- backend.redis.pool1.server
218+
- backend.redis.hook.message.publish.1
219+
220+
You can configure an arbitrary number of them as long as each has a uniq unber for it's own configuration option:
221+
222+
```bash
223+
docker run -d --name emqx -p 18083:18083 -p 1883:1883 -p 4369:4369 \
224+
-e EMQX_BACKEND_REDIS_POOL1__SERVER=127.0.0.1:6379 \
225+
[...]
226+
-e EMQX_BACKEND__REDIS__POOL5__SERVER=127.0.0.5:6379 \
227+
-e EMQX_BACKEND__REDIS__HOOK_MESSAGE__PUBLISH__1='{"topic": "persistant/topic1", "action": {"function": "on_message_publish"}, "pool": "pool1"}' \
228+
-e EMQX_BACKEND__REDIS__HOOK_MESSAGE__PUBLISH__2='{"topic": "persistant/topic2", "action": {"function": "on_message_publish"}, "pool": "pool1"}' \
229+
-e EMQX_BACKEND__REDIS__HOOK_MESSAGE__PUBLISH__3='{"topic": "persistant/topic3", "action": {"function": "on_message_publish"}, "pool": "pool1"}' \
230+
[...]
231+
-e EMQX_BACKEND__REDIS__HOOK_MESSAGE__PUBLISH__13='{"topic": "persistant/topic13", "action": {"function": "on_message_publish"}, "pool": "pool1"}' \
232+
emqx:latest
233+
```
234+
235+
### Cluster
236+
237+
EMQ X supports a variety of clustering methods, see our [documentation](https://docs.emqx.io/broker/latest/en/advanced/cluster.html#emqx-service-discovery) for details.
238+
239+
Let's create a static node list cluster from docker-compose.
240+
241+
- Create `docker-compose.yaml`:
242+
243+
```yaml
244+
version: '3'
245+
246+
services:
247+
emqx1:
248+
image: emqx:latest
249+
environment:
250+
- "EMQX_NAME=emqx"
251+
- "EMQX_HOST=node1.emqx.io"
252+
- "EMQX_CLUSTER__DISCOVERY_STRATEGY=static"
253+
- "EMQX_CLUSTER__STATIC__SEEDS=[[email protected], [email protected]]"
254+
networks:
255+
emqx-bridge:
256+
aliases:
257+
- node1.emqx.io
258+
259+
emqx2:
260+
image: emqx:latest
261+
environment:
262+
- "EMQX_NAME=emqx"
263+
- "EMQX_HOST=node2.emqx.io"
264+
- "EMQX_CLUSTER__DISCOVERY_STRATEGY=static"
265+
- "EMQX_CLUSTER__STATIC__SEEDS=[[email protected], [email protected]]"
266+
networks:
267+
emqx-bridge:
268+
aliases:
269+
- node2.emqx.io
270+
271+
networks:
272+
emqx-bridge:
273+
driver: bridge
274+
```
275+
276+
- Start the docker-compose cluster
277+
278+
```bash
279+
docker-compose -p my_emqx up -d
280+
```
281+
282+
- View cluster
283+
284+
```bash
285+
$ docker exec -it my_emqx_emqx1_1 sh -c "emqx_ctl cluster status"
286+
Cluster status: #{running_nodes => ['[email protected]','[email protected]'],
287+
stopped_nodes => []}
288+
```
289+
290+
### Persistence
291+
292+
If you want to persist the EMQ X docker container, you need to keep the following directories:
293+
294+
- `/opt/emqx/data`
295+
- `/opt/emqx/etc`
296+
- `/opt/emqx/log`
297+
298+
Since data in these folders are partially stored under the `/opt/emqx/data/mnesia/${node_name}`, the user also needs to reuse the same node name to see the previous state. In detail, one needs to specify the two environment variables: `EMQX_NAME` and `EMQX_HOST`, `EMQX_HOST` set as `127.0.0.1` or network alias would be useful.
299+
300+
In if you use docker-compose, the configuration would look something like this:
301+
302+
```YAML
303+
volumes:
304+
vol-emqx-data:
305+
name: foo-emqx-data
306+
vol-emqx-etc:
307+
name: foo-emqx-etc
308+
vol-emqx-log:
309+
name: foo-emqx-log
310+
311+
services:
312+
emqx:
313+
image: emqx:latest
314+
restart: always
315+
environment:
316+
EMQX_NAME: foo_emqx
317+
EMQX_HOST: 127.0.0.1
318+
volumes:
319+
- vol-emqx-data:/opt/emqx/data
320+
321+
- vol-emqx-log:/opt/emqx/log
322+
```
323+
324+
### Kernel Tuning
325+
326+
Under linux host machine, the easiest way is [Tuning guide](https://docs.emqx.io/en/broker/latest/tutorial/tune.html#linux-kernel-tuning).
327+
328+
If you want tune linux kernel by docker, you must ensure your docker is latest version (>=1.12).
329+
330+
```bash
331+
332+
docker run -d --name emqx -p 18083:18083 -p 1883:1883 -p 4369:4369 \
333+
--sysctl fs.file-max=2097152 \
334+
--sysctl fs.nr_open=2097152 \
335+
--sysctl net.core.somaxconn=32768 \
336+
--sysctl net.ipv4.tcp_max_syn_backlog=16384 \
337+
--sysctl net.core.netdev_max_backlog=16384 \
338+
--sysctl net.ipv4.ip_local_port_range=1000 65535 \
339+
--sysctl net.core.rmem_default=262144 \
340+
--sysctl net.core.wmem_default=262144 \
341+
--sysctl net.core.rmem_max=16777216 \
342+
--sysctl net.core.wmem_max=16777216 \
343+
--sysctl net.core.optmem_max=16777216 \
344+
--sysctl net.ipv4.tcp_rmem=1024 4096 16777216 \
345+
--sysctl net.ipv4.tcp_wmem=1024 4096 16777216 \
346+
--sysctl net.ipv4.tcp_max_tw_buckets=1048576 \
347+
--sysctl net.ipv4.tcp_fin_timeout=15 \
348+
emqx:latest
349+
350+
```
351+
352+
> REMEMBER: DO NOT RUN EMQ X DOCKER PRIVILEGED OR MOUNT SYSTEM PROC IN CONTAINER TO TUNE LINUX KERNEL, IT IS UNSAFE.
353+
354+
# License
355+
356+
View [license information](https://github.com/emqx/emqx/blob/master/LICENSE) for the software contained in this image.
357+
358+
As with all Docker images, these likely also contain other software which may be under other licenses (such as Bash, etc from the base distribution, along with any direct or indirect dependencies of the primary software being contained).
359+
360+
Some additional license information which was able to be auto-detected might be found in [the `repo-info` repository's `emqx/` directory](https://github.com/docker-library/repo-info/tree/master/repos/emqx).
361+
362+
As for any pre-built image usage, it is the image user's responsibility to ensure that any use of this image complies with any relevant licenses for all software contained within.

0 commit comments

Comments
 (0)