tianyuan-api-server/docker-compose.yml
2024-10-02 00:57:17 +08:00

157 lines
2.9 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

version: '3'
services:
etcd:
image: bitnami/etcd
container_name: etcd
environment:
- TZ=${TZ}
- ALLOW_NONE_AUTHENTICATION=yes
#- ETCD_ADVERTISE_CLIENT_URLS=http://etcd:2379
- ETCD_ADVERTISE_CLIENT_URLS=http://127.0.0.1:2379
ports:
- "2379:2379" # 宿主机可以通过127.0.0.1:2379访问etcd服务
restart: always
etcdManage:
image: evildecay/etcdkeeper
container_name: etcdManage
environment:
- TZ=${TZ}
ports:
- "7000:8080" # 将容器的8080端口映射到宿主机的7000端口便于web访问
depends_on:
- etcd # 确保etcd容器先启动
restart: always
zookeeper:
image: wurstmeister/zookeeper
ports:
- "2181:2181"
kafka:
image: wurstmeister/kafka
ports:
- "9092:9092"
environment:
KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:9092
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
volumes:
- /var/run/docker.sock:/var/run/docker.sock
redis:
image: redis:7.4.0
ports:
- "6379:6379"
restart: always
mysql:
image: mysql:8.0.34
environment:
- MYSQL_ROOT_PASSWORD=rootpassword
- MYSQL_DATABASE=tianyuanapi
- MYSQL_USER=tianyuanapi
- MYSQL_PASSWORD=g3h98u0291j
ports:
- "3307:3306"
volumes:
- mysql_data:/var/lib/mysql
restart: always
# Gateway service
gateway:
build:
context: ./apps/gateway
dockerfile: Dockerfile
ports:
- "10001:10001"
environment:
- ENV=production
depends_on:
- etcd
- redis
- mysql
- user
- sentinel
# Admin service
admin:
build:
context: ./apps/admin
dockerfile: Dockerfile
ports:
- "10002:10002"
environment:
- ENV=production
depends_on:
- etcd
- redis
- mysql
- user
- sentinel
# API service
api:
build:
context: ./apps/api
dockerfile: Dockerfile
ports:
- "10003:10003"
environment:
- ENV=production
depends_on:
- etcd
- redis
- mysql
- user
- sentinel
- mqs
- kafka
# MQS service
mqs:
build:
context: ./apps/mqs
dockerfile: Dockerfile
ports:
- "12001:12001"
environment:
- ENV=production
depends_on:
- kafka
- etcd
- redis
- user
- sentinel
- kafka
# Sentinel service
sentinel:
build:
context: ./apps/sentinel
dockerfile: Dockerfile
ports:
- "11002:11002"
environment:
- ENV=production
depends_on:
- redis
- mysql
- etcd
# User service
user:
build:
context: ./apps/user
dockerfile: Dockerfile
ports:
- "11001:11001"
environment:
- ENV=production
depends_on:
- mysql
- redis
- etcd
volumes:
mysql_data:
driver: local