chore: consolidate docker-compose and add integration tests
- Merge infrastructure/docker-compose.yml + docker-compose.app.yml into root docker-compose.yml with profiles (infra/app). - Add healthchecks for mysql/redis/rabbitmq/mci-server/channel-service and depends_on conditions. - Rewrite scripts/local-up.sh to use profiles and wait for healthy states. - Add curl to mci-server and channel-service Docker images for healthchecks. - Add npm test script to admin-web (type-check + build smoke test). - Add scripts/test-external-api.sh covering 11 API endpoints. - Verify Java (7/7), Python (6/6), npm build, external API (11/11), and UI flows.
This commit is contained in:
144
docker-compose.yml
Normal file
144
docker-compose.yml
Normal file
@@ -0,0 +1,144 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:8.0.36
|
||||
container_name: mci-mysql
|
||||
profiles: ["infra"]
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: root
|
||||
MYSQL_DATABASE: sino_mci
|
||||
ports:
|
||||
- "3306:3306"
|
||||
volumes:
|
||||
- mci-mysql-data:/var/lib/mysql
|
||||
networks:
|
||||
- mci-network
|
||||
healthcheck:
|
||||
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-proot"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 20
|
||||
start_period: 30s
|
||||
|
||||
redis:
|
||||
image: redis:7.2
|
||||
container_name: mci-redis
|
||||
profiles: ["infra"]
|
||||
ports:
|
||||
- "6379:6379"
|
||||
networks:
|
||||
- mci-network
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
start_period: 10s
|
||||
|
||||
rabbitmq:
|
||||
image: rabbitmq:3.13-management
|
||||
container_name: mci-rabbitmq
|
||||
profiles: ["infra"]
|
||||
environment:
|
||||
RABBITMQ_DEFAULT_USER: guest
|
||||
RABBITMQ_DEFAULT_PASS: guest
|
||||
ports:
|
||||
- "5672:5672"
|
||||
- "15672:15672"
|
||||
networks:
|
||||
- mci-network
|
||||
healthcheck:
|
||||
test: ["CMD", "rabbitmq-diagnostics", "ping"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 15
|
||||
start_period: 30s
|
||||
|
||||
seaweedfs:
|
||||
image: chrislusf/seaweedfs:3.62
|
||||
container_name: mci-seaweedfs
|
||||
profiles: ["infra"]
|
||||
ports:
|
||||
- "9333:9333"
|
||||
- "8888:8888"
|
||||
command: server -dir=/data
|
||||
volumes:
|
||||
- mci-seaweedfs-data:/data
|
||||
networks:
|
||||
- mci-network
|
||||
|
||||
mci-server:
|
||||
build:
|
||||
context: ./backend
|
||||
dockerfile: mci-server/Dockerfile
|
||||
container_name: mci-server
|
||||
profiles: ["app"]
|
||||
ports:
|
||||
- "8080:8080"
|
||||
environment:
|
||||
- SPRING_PROFILES_ACTIVE=dev
|
||||
- SPRING_DATASOURCE_URL=jdbc:mysql://mci-mysql:3306/sino_mci?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true
|
||||
- SPRING_DATASOURCE_USERNAME=root
|
||||
- SPRING_DATASOURCE_PASSWORD=root
|
||||
- SPRING_DATA_REDIS_HOST=mci-redis
|
||||
- SPRING_RABBITMQ_HOST=mci-rabbitmq
|
||||
networks:
|
||||
- mci-network
|
||||
depends_on:
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
rabbitmq:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-fsS", "http://localhost:8080/msg-platform/actuator/health"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 15
|
||||
start_period: 90s
|
||||
|
||||
admin-web:
|
||||
build:
|
||||
context: ./admin-web
|
||||
dockerfile: Dockerfile
|
||||
container_name: mci-admin-web
|
||||
profiles: ["app"]
|
||||
ports:
|
||||
- "80:80"
|
||||
networks:
|
||||
- mci-network
|
||||
depends_on:
|
||||
mci-server:
|
||||
condition: service_healthy
|
||||
|
||||
channel-service:
|
||||
build:
|
||||
context: ./channel-service
|
||||
dockerfile: Dockerfile
|
||||
container_name: mci-channel-service
|
||||
profiles: ["app"]
|
||||
ports:
|
||||
- "8000:8000"
|
||||
environment:
|
||||
- MCI_SERVER_URL=http://mci-server:8080/msg-platform
|
||||
networks:
|
||||
- mci-network
|
||||
depends_on:
|
||||
mci-server:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-fsS", "http://localhost:8000/health"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
start_period: 30s
|
||||
|
||||
volumes:
|
||||
mci-mysql-data:
|
||||
mci-seaweedfs-data:
|
||||
|
||||
networks:
|
||||
mci-network:
|
||||
driver: bridge
|
||||
Reference in New Issue
Block a user