chore: add dev configs and local infrastructure
This commit is contained in:
20
backend/mci-server/src/main/resources/application-dev.yml
Normal file
20
backend/mci-server/src/main/resources/application-dev.yml
Normal file
@@ -0,0 +1,20 @@
|
||||
spring:
|
||||
datasource:
|
||||
url: jdbc:mysql://localhost:3306/sino_mci?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true
|
||||
username: root
|
||||
password: root
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
data:
|
||||
redis:
|
||||
host: localhost
|
||||
port: 6379
|
||||
database: 0
|
||||
rabbitmq:
|
||||
host: localhost
|
||||
port: 5672
|
||||
username: guest
|
||||
password: guest
|
||||
flyway:
|
||||
enabled: true
|
||||
locations: classpath:db/migration
|
||||
baseline-on-migrate: true
|
||||
26
backend/mci-server/src/main/resources/application.yml
Normal file
26
backend/mci-server/src/main/resources/application.yml
Normal file
@@ -0,0 +1,26 @@
|
||||
server:
|
||||
port: 8080
|
||||
servlet:
|
||||
context-path: /msg-platform
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: mci-server
|
||||
|
||||
jackson:
|
||||
default-property-inclusion: non_null
|
||||
|
||||
mybatis-plus:
|
||||
configuration:
|
||||
map-underscore-to-camel-case: true
|
||||
global-config:
|
||||
db-config:
|
||||
logic-delete-field: deleted
|
||||
logic-delete-value: 1
|
||||
logic-not-delete-value: 0
|
||||
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: health,info
|
||||
43
infrastructure/docker-compose.yml
Normal file
43
infrastructure/docker-compose.yml
Normal file
@@ -0,0 +1,43 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:8.0.36
|
||||
container_name: mci-mysql
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: root
|
||||
MYSQL_DATABASE: sino_mci
|
||||
ports:
|
||||
- "3306:3306"
|
||||
volumes:
|
||||
- mci-mysql-data:/var/lib/mysql
|
||||
|
||||
redis:
|
||||
image: redis:7.2
|
||||
container_name: mci-redis
|
||||
ports:
|
||||
- "6379:6379"
|
||||
|
||||
rabbitmq:
|
||||
image: rabbitmq:3.13-management
|
||||
container_name: mci-rabbitmq
|
||||
environment:
|
||||
RABBITMQ_DEFAULT_USER: guest
|
||||
RABBITMQ_DEFAULT_PASS: guest
|
||||
ports:
|
||||
- "5672:5672"
|
||||
- "15672:15672"
|
||||
|
||||
seaweedfs:
|
||||
image: chrislusf/seaweedfs:3.62
|
||||
container_name: mci-seaweedfs
|
||||
ports:
|
||||
- "9333:9333"
|
||||
- "8888:8888"
|
||||
command: server -dir=/data
|
||||
volumes:
|
||||
- mci-seaweedfs-data:/data
|
||||
|
||||
volumes:
|
||||
mci-mysql-data:
|
||||
mci-seaweedfs-data:
|
||||
50
scripts/local-up.sh
Executable file
50
scripts/local-up.sh
Executable file
@@ -0,0 +1,50 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
cd "$SCRIPT_DIR/.."
|
||||
|
||||
echo "Starting local infrastructure..."
|
||||
docker compose -f infrastructure/docker-compose.yml up -d
|
||||
|
||||
echo "Waiting for MySQL..."
|
||||
MAX_RETRIES=60
|
||||
RETRY_COUNT=0
|
||||
until docker exec mci-mysql mysql -uroot -proot -e "SELECT 1" > /dev/null 2>&1; do
|
||||
RETRY_COUNT=$((RETRY_COUNT + 1))
|
||||
if [ "$RETRY_COUNT" -ge "$MAX_RETRIES" ]; then
|
||||
echo "Error: MySQL did not become ready within ${MAX_RETRIES} seconds." >&2
|
||||
exit 1
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
echo "Waiting for Redis..."
|
||||
MAX_RETRIES=30
|
||||
RETRY_COUNT=0
|
||||
until docker exec mci-redis redis-cli ping | grep -q "PONG"; do
|
||||
RETRY_COUNT=$((RETRY_COUNT + 1))
|
||||
if [ "$RETRY_COUNT" -ge "$MAX_RETRIES" ]; then
|
||||
echo "Error: Redis did not become ready within ${MAX_RETRIES} seconds." >&2
|
||||
exit 1
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
echo "Waiting for RabbitMQ..."
|
||||
MAX_RETRIES=30
|
||||
RETRY_COUNT=0
|
||||
until curl -s -o /dev/null -w "%{http_code}" http://guest:guest@localhost:15672/api/overview | grep -q "200"; do
|
||||
RETRY_COUNT=$((RETRY_COUNT + 1))
|
||||
if [ "$RETRY_COUNT" -ge "$MAX_RETRIES" ]; then
|
||||
echo "Error: RabbitMQ did not become ready within ${MAX_RETRIES} seconds." >&2
|
||||
exit 1
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
echo "Local infrastructure is ready."
|
||||
echo "MySQL: jdbc:mysql://localhost:3306/sino_mci"
|
||||
echo "Redis: localhost:6379"
|
||||
echo "RabbitMQ: localhost:5672 / http://localhost:15672"
|
||||
echo "SeaweedFS: http://localhost:9333"
|
||||
Reference in New Issue
Block a user