Created
March 26, 2024 10:47
-
-
Save id/c883c9eed7f6a03ba57a2872c16df8ad to your computer and use it in GitHub Desktop.
EMQX + HAProxy + Datadog Agent with EMQX integration in docker compose
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
version: '3' | |
x-default-emqx: &default-emqx | |
env_file: | |
- emqx.env | |
healthcheck: | |
test: ["CMD", "/opt/emqx/bin/emqx", "ctl", "status"] | |
interval: 5s | |
timeout: 25s | |
retries: 5 | |
services: | |
dd-agent: | |
container_name: dd-agent | |
build: | |
context: . | |
dockerfile: Dockerfile | |
pid: host | |
hostname: "dd-agent.emqx.io" | |
environment: | |
DD_API_KEY: "<redacted>" | |
DD_SITE: "datadoghq.eu" | |
DD_HOSTNAME: "dd-agent.emqx.io" | |
volumes: | |
- /var/run/docker.sock:/var/run/docker.sock | |
- ./emqx-conf.yaml:/etc/datadog-agent/conf.d/emqx.d/conf.yaml | |
networks: | |
emqx_dd_bridge: | |
aliases: | |
- dd-agent.emqx.io | |
haproxy: | |
container_name: haproxy | |
image: public.ecr.aws/docker/library/haproxy:2.4 | |
depends_on: | |
- emqx1 | |
- emqx2 | |
volumes: | |
- ./haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg | |
ports: | |
- "18083:18083" | |
- "1883:1883" | |
networks: | |
- emqx_dd_bridge | |
emqx1: | |
<<: *default-emqx | |
image: emqx/emqx-enterprise:5.5.1 | |
container_name: node1.emqx.io | |
environment: | |
- "EMQX_HOST=node1.emqx.io" | |
volumes: | |
- ./emqx1_data:/opt/emqx/data | |
networks: | |
emqx_dd_bridge: | |
aliases: | |
- node1.emqx.io | |
emqx2: | |
<<: *default-emqx | |
image: emqx/emqx-enterprise:5.5.1 | |
container_name: node2.emqx.io | |
environment: | |
- "EMQX_HOST=node2.emqx.io" | |
volumes: | |
- ./emqx2_data:/opt/emqx/data | |
networks: | |
emqx_dd_bridge: | |
aliases: | |
- node2.emqx.io | |
networks: | |
emqx_dd_bridge: | |
driver: bridge | |
name: emqx_dd_bridge |
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
FROM gcr.io/datadoghq/agent:latest | |
RUN agent integration install -r -t datadog-emqx==1.0.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
ad_identifiers: | |
- emqx-enterprise | |
init_config: | |
instances: | |
- openmetrics_endpoint: http://node1.emqx.io:18083/api/v5/prometheus/stats | |
- openmetrics_endpoint: http://node2.emqx.io:18083/api/v5/prometheus/stats |
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
EMQX_NAME=emqx | |
EMQX_CLUSTER__DISCOVERY_STRATEGY=static | |
EMQX_CLUSTER__STATIC__SEEDS="[[email protected], [email protected]]" | |
EMQX_LISTENERS__TCP__DEFAULT__PROXY_PROTOCOL=true | |
EMQX_LISTENERS__WS__DEFAULT__PROXY_PROTOCOL=true | |
EMQX_LOG__CONSOLE_HANDLER__ENABLE=true | |
EMQX_LOG__CONSOLE_HANDLER__LEVEL=info |
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
global | |
log stdout format raw daemon info | |
maxconn 1000 | |
nbproc 1 | |
nbthread 2 | |
cpu-map auto:1/1-2 0-1 | |
stats socket :9999 level admin expose-fd listeners | |
defaults | |
log global | |
mode tcp | |
option tcplog | |
maxconn 1000 | |
timeout connect 30000 | |
timeout client 600s | |
timeout server 600s | |
frontend emqx_dashboard | |
mode tcp | |
option tcplog | |
bind *:18083 | |
default_backend emqx_dashboard_back | |
backend emqx_dashboard_back | |
mode http | |
server emqx-1 node1.emqx.io:18083 | |
server emqx-2 node2.emqx.io:18083 | |
frontend emqx_tcp | |
mode tcp | |
option tcplog | |
bind *:1883 | |
default_backend emqx_tcp_back | |
frontend emqx_ws | |
mode tcp | |
option tcplog | |
bind *:8083 | |
default_backend emqx_ws_back | |
backend emqx_tcp_back | |
mode tcp | |
stick-table type string len 32 size 100k expire 30m | |
stick on req.payload(0,0),mqtt_field_value(connect,client_identifier) | |
server emqx-1 node1.emqx.io:1883 check-send-proxy send-proxy-v2 | |
server emqx-2 node2.emqx.io:1883 check-send-proxy send-proxy-v2 | |
backend emqx_ws_back | |
mode tcp | |
balance static-rr | |
server emqx-1 node1.emqx.io:8083 check-send-proxy send-proxy-v2 | |
server emqx-2 node2.emqx.io:8083 check-send-proxy send-proxy-v2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment