lottery-docker-compose lottery 环境搭建
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

132 lines
3.5 KiB

version: '3'
services:
#redis服务
lottery-redis:
#构建镜像
build:
context: ./
dockerfile: dockerfile/DockerfileRedis
container_name: lottery-redis
ports:
- 6379:6379
volumes:
- ./config/redis/redis.conf:/etc/redis/redis.conf
- ./data/redis:/data
networks:
- lottery-net
restart: on-failure:3
command: redis-server --appendonly yes #开启持久化
#zk
lottery-zookeeper:
image: wurstmeister/zookeeper
container_name: lottery-zookeeper
ports:
- 2181:2181
networks:
- lottery-net
restart: on-failure:3
#kafka
lottery-kafka:
image: wurstmeister/kafka
container_name: lottery-kafka
ports:
- 9092:9092
environment:
- KAFKA_BROKER_ID=0
- KAFKA_ZOOKEEPER_CONNECT=lottery-zookeeper:2181
- KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://150.158.183.74:9092
- KAFKA_LISTENERS=PLAINTEXT://0.0.0.0:9092
networks:
- lottery-net
restart: on-failure:3
depends_on: #等待zk启动后启动kafka
- lottery-zookeeper
#mysql
lottery-mysql:
image: mysql:latest
container_name: lottery-mysql
ports:
- 3306:3306
networks:
- lottery-net
environment:
- MYSQL_ROOT_PASSWORD=123456
restart: on-failure:3
#nacos
lottery-nacos:
image: nacos/nacos-server:2.0.3
container_name: lottery-nacos
ports:
- 8848:8848
networks:
- lottery-net
environment:
- MODE=standalone
- MYSQL_SERVICE_HOST=lottery-mysql
- MYSQL_SERVICE_PORT=3306
- MYSQL_SERVICE_DB_NAME=nacos
- MYSQL_SERVICE_USER=nacos
- MYSQL_SERVICE_PASSWORD=nacos
depends_on:
- lottery-mysql
restart: on-failure:3
#elasticsearch
lottery-elasticsearch:
image: elasticsearch:7.6.2
container_name: lottery-elasticsearch
ports:
- 9200:9200
- 9300:9300
networks:
- lottery-net
environment:
- discovery.type=single-node
- ES_JAVA_OPTS=-Xms128m -Xmx256m
- http.host=0.0.0.0
privileged: true
volumes:
- ./data/elasticsearch:/usr/share/elasticsearch/data
- es-plugins:/usr/share/elasticsearch/plugins
depends_on:
- lottery-mysql
restart: on-failure:3
#kibana
lottery-kibana:
image: kibana:7.6.2
container_name: lottery-kibana
ports:
- 5601:5601
networks:
- lottery-net
environment:
- discovery.type=single-node
- ES_JAVA_OPTS=-Xms128m -Xmx256m
- http.host=0.0.0.0
privileged: true
volumes:
- ./config/kibana/kibana.yml:/usr/share/kibana/config/kibana.yml
depends_on:
- lottery-elasticsearch
- lottery-xxl-job
restart: on-failure:3
#xxl-job
lottery-xxl-job:
image: xuxueli/xxl-job-admin:2.3.0
container_name: lottery-xxl-job
ports:
- 7397:7397
networks:
- lottery-net
environment:
- PARAMS=" --server.port=7397 --spring.datasource.url=jdbc:mysql://lottery-mysql:3306/xxl_job?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8 --spring.datasource.username=xxl_job --spring.datasource.password=xxl_job --xxl.job.accessToken=xxl_job"
volumes:
- ./logs/xxl-job:/data/applogs
depends_on:
- lottery-xxl-job
restart: on-failure:3
networks:
lottery-net:
external: true
volumes:
#解决ERROR: Named volume "es-plugins:/usr/share/elasticsearch/plugins:rw" is used in service "lottery-elasticsearch" but no declaration was found in the volumes section.
es-plugins: