From 9e1401a65142dce9d89724bc3f369282c77240c0 Mon Sep 17 00:00:00 2001 From: BryantHe Date: Mon, 29 May 2023 16:10:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=96=B0=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 21 +++++++++++++++++++++ docker-compose-logging.yml | 5 +++++ docker-compose-metrics.yml | 3 +++ docker-compose-mysql.yml | 21 +++++++++++++++++++++ docker-compose-rabbitmq.yml | 25 +++++++++++++++++++++++++ 5 files changed, 75 insertions(+) create mode 100644 docker-compose-mysql.yml create mode 100644 docker-compose-rabbitmq.yml diff --git a/README.md b/README.md index e7e8158..dfe0056 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,10 @@ chassis 微服务基座依赖的服务 - Logstash - Kibana - Fluentd +- MiddleWares + - RabbitMQ + - Mysql + - …… ## 启动 Metrics 相关服务 @@ -31,6 +35,23 @@ grafana 的配置在:./service_configs/admin_service/grafana/xxxx.json (根 `docker-compose -f docker-compose-logging.yml up -d --build --remove-orphans` +## 启动 RabbitMQ + + +启动服务的命令: + +`docker-compose -f docker-compose-rabbitmq.yml up -d --build --remove-orphans` + + +## 启动 Mysql + + +启动服务的命令: + +`docker-compose -f docker-compose-mysql.yml up -d --build --remove-orphans` + + + ## TODO - Metrics diff --git a/docker-compose-logging.yml b/docker-compose-logging.yml index 38e0aa6..9bacffb 100644 --- a/docker-compose-logging.yml +++ b/docker-compose-logging.yml @@ -3,6 +3,8 @@ version: "3" services: kibana: image: kibana:8.7.1 + hostname: "kibana" + container_name: "kibana" ports: - "5610:5601" networks: @@ -12,6 +14,7 @@ services: elasticsearch: image: elasticsearch:8.7.1 hostname: "elasticsearch" + container_name: "elasticsearch" environment: - "discovery.type=single-node" #单机模式启动 - "TZ=Asia/Shanghai" # 设置时区 @@ -24,6 +27,8 @@ services: networks: chassis_agent_logging: fluentd: + hostname: "fluentd" + container_name: "fluentd" build: context: ./fluentd volumes: diff --git a/docker-compose-metrics.yml b/docker-compose-metrics.yml index 1c1fd4d..caf0b13 100644 --- a/docker-compose-metrics.yml +++ b/docker-compose-metrics.yml @@ -3,6 +3,8 @@ version: "3" services: statsd-agent: image: statsd/statsd:latest + hostname: "statsd-agent" + container_name: "statsd-agent" restart: always ports: - "8125:8125/udp" @@ -14,6 +16,7 @@ services: statsd-exporter: image: prom/statsd-exporter:latest hostname: "statsd-exporter" + container_name: "statsd-exporter" command: "--statsd.mapping-config=/tmp/statsd_mapping.yml" ports: - "9102:9102" diff --git a/docker-compose-mysql.yml b/docker-compose-mysql.yml new file mode 100644 index 0000000..444c442 --- /dev/null +++ b/docker-compose-mysql.yml @@ -0,0 +1,21 @@ +version: "3" + +services: + mysql: + image: mysql:8 + container_name: 'mysql' + hostname: 'mysql' + ports: + - "3306:3306" + volumes: + - mysql_data:/var/lib/mysql + environment: + - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-root} + - MYSQL_USER=user + - MYSQL_PASSWORD=${MYSQL_PASSWORD:-user} + restart: always + + +volumes: + mysql_data: + driver: local \ No newline at end of file diff --git a/docker-compose-rabbitmq.yml b/docker-compose-rabbitmq.yml new file mode 100644 index 0000000..0b5b0fb --- /dev/null +++ b/docker-compose-rabbitmq.yml @@ -0,0 +1,25 @@ +version: "3" + +services: + rabbitmq: + image: rabbitmq:3-management + container_name: 'rabbitmq' + hostname: 'rabbitmq' + ports: + - "5672:5672" + - "15672:15672" + - "25672:25672" + volumes: + - rabbitmq_data:/var/lib/rabbitmq + - rabbitmq_log:/var/log/rabbitmq + environment: + RABBITMQ_DEFAULT_USER: ${RABBITMQ_DEFAULT_USER:-admin} + RABBITMQ_DEFAULT_PASS: ${RABBITMQ_DEFAULT_PASS:-admin} + restart: always + + +volumes: + rabbitmq_data: + driver: local + rabbitmq_log: + driver: local \ No newline at end of file