From f85fdd1ab049b3740bcbad52d5bf0d65aabb3ace Mon Sep 17 00:00:00 2001 From: metavige Date: Tue, 23 Mar 2021 21:58:45 +0800 Subject: [PATCH] add new rabbitmq - over TLS --- rabbitmq/docker-compose.yml | 34 +++++++++++++++++++++++++++++++++ rabbitmq/enable_plugins | 1 + spring-cloud/docker-compose.yml | 24 +++++++++++------------ 3 files changed, 47 insertions(+), 12 deletions(-) create mode 100644 rabbitmq/docker-compose.yml create mode 100644 rabbitmq/enable_plugins diff --git a/rabbitmq/docker-compose.yml b/rabbitmq/docker-compose.yml new file mode 100644 index 0000000..cf20fe3 --- /dev/null +++ b/rabbitmq/docker-compose.yml @@ -0,0 +1,34 @@ +version: "3" +services: + rabbitmq: + image: rabbitmq:3.8-management-alpine + # ports: + # - "5672:5672" + container_name: rabbitmq + labels: + - 'traefik.enable=true' + - 'traefik.docker.network=devops' + # web browser access to RabbitMQ management GUI + - 'traefik.http.routers.rabbitmq-mgr.tls=true' + - 'traefik.http.routers.rabbitmq-mgr.rule=Host(`rabbitmq-management.docker.internal`)' + - 'traefik.http.routers.rabbitmq-mgr.entrypoints=websecure' + - 'traefik.http.services.rabbitmq-mgr.loadbalancer.server.port=15672' + # AMQPS - SSL terminated by traefik (over 443, not 5672) + - 'traefik.tcp.routers.rabbitmq.tls=true' + - 'traefik.tcp.routers.rabbitmq.rule=HostSNI(`rabbitmq.docker.internal`)' + - 'traefik.tcp.routers.rabbitmq.entrypoints=websecure' + - 'traefik.tcp.services.rabbitmq.loadbalancer.server.port=5672' + environment: + - 'RABBITMQ_DEFAULT_USER=guest' + - 'RABBITMQ_DEFAULT_PASS=guest' + volumes: + - rabbitmq:/var/lib/rabbitmq + - ./enable_plugins:/etc/rabbitmq/enable_plugins:ro + networks: + - devops +volumes: + rabbitmq: {} + +networks: + devops: + external: true \ No newline at end of file diff --git a/rabbitmq/enable_plugins b/rabbitmq/enable_plugins new file mode 100644 index 0000000..318ea04 --- /dev/null +++ b/rabbitmq/enable_plugins @@ -0,0 +1 @@ +[rabbitmq_management,rabbitmq_prometheus]. \ No newline at end of file diff --git a/spring-cloud/docker-compose.yml b/spring-cloud/docker-compose.yml index 3441bc3..2d5eea2 100644 --- a/spring-cloud/docker-compose.yml +++ b/spring-cloud/docker-compose.yml @@ -2,19 +2,19 @@ version: "3" services: rabbitmq: image: rabbitmq:3.8-management-alpine - ports: - - "5672:5672" + # ports: + # - "5672:5672" container_name: rabbitmq - labels: - - 'traefik.enable=true' - - 'traefik.http.routers.rabbitmq.tls=true' - - 'traefik.http.routers.rabbitmq.rule=Host(`rabbitmq.docker.internal`)' - - 'traefik.http.routers.rabbitmq.entrypoints=websecure' - - 'traefik.http.services.rabbitmq.loadbalancer.server.port=15672' - - 'traefik.docker.network=devops' - environment: - - 'RABBITMQ_DEFAULT_USER=guest' - - 'RABBITMQ_DEFAULT_PASS=p@ssw0rd' + # labels: + # - 'traefik.enable=true' + # - 'traefik.http.routers.rabbitmq.tls=true' + # - 'traefik.http.routers.rabbitmq.rule=Host(`rabbitmq.docker.internal`)' + # - 'traefik.http.routers.rabbitmq.entrypoints=websecure' + # - 'traefik.http.services.rabbitmq.loadbalancer.server.port=15672' + # - 'traefik.docker.network=devops' + # environment: + # - 'RABBITMQ_DEFAULT_USER=guest' + # - 'RABBITMQ_DEFAULT_PASS=p@ssw0rd' networks: - devops # eureka: