mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-05-08 03:37:28 +08:00
fix: rabbitmq 初始化
This commit is contained in:
@@ -30,8 +30,8 @@ REDIS_DATABASE=0
|
|||||||
|
|
||||||
# === RabbitMQ Configuration ===
|
# === RabbitMQ Configuration ===
|
||||||
RABBITMQ_HOST=rabbitmq
|
RABBITMQ_HOST=rabbitmq
|
||||||
RABBITMQ_USERNAME=guest
|
RABBITMQ_USERNAME=nagisa
|
||||||
RABBITMQ_PASSWORD=guest
|
RABBITMQ_PASSWORD=nagisa
|
||||||
|
|
||||||
# === Backend Application Secrets ===
|
# === Backend Application Secrets ===
|
||||||
JWT_SECRET=change-me-jwt-secret
|
JWT_SECRET=change-me-jwt-secret
|
||||||
|
|||||||
@@ -71,16 +71,26 @@ services:
|
|||||||
image: rabbitmq:3.13-management
|
image: rabbitmq:3.13-management
|
||||||
container_name: openisle-rabbitmq
|
container_name: openisle-rabbitmq
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
env_file:
|
environment:
|
||||||
- ../.env
|
RABBITMQ_DEFAULT_VHOST: ${RABBITMQ_VHOST:-/}
|
||||||
ports:
|
ports:
|
||||||
- "${RABBITMQ_PORT:-5672}:5672"
|
- "${RABBITMQ_PORT:-5672}:5672"
|
||||||
- "${RABBITMQ_MANAGEMENT_PORT:-15672}:15672"
|
- "${RABBITMQ_MANAGEMENT_PORT:-15672}:15672"
|
||||||
volumes:
|
volumes:
|
||||||
- rabbitmq-data:/var/lib/rabbitmq
|
- rabbitmq-data:/var/lib/rabbitmq
|
||||||
|
- ./rabbitmq/conf/rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf:ro
|
||||||
|
- ./rabbitmq/conf/enabled_plugins:/etc/rabbitmq/enabled_plugins:ro
|
||||||
|
- ./rabbitmq/definitions.json:/etc/rabbitmq/definitions.json:ro
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "rabbitmq-diagnostics", "-q", "ping"]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 30
|
||||||
|
start_period: 30s
|
||||||
networks:
|
networks:
|
||||||
- openisle-network
|
- openisle-network
|
||||||
|
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
image: redis:7
|
image: redis:7
|
||||||
container_name: openisle-redis
|
container_name: openisle-redis
|
||||||
@@ -101,6 +111,9 @@ services:
|
|||||||
working_dir: /app
|
working_dir: /app
|
||||||
env_file:
|
env_file:
|
||||||
- ../.env
|
- ../.env
|
||||||
|
environment:
|
||||||
|
SPRING_HEALTH_PATH: ${SPRING_HEALTH_PATH:-/actuator/health}
|
||||||
|
SERVER_PORT: ${SERVER_PORT:-8080}
|
||||||
ports:
|
ports:
|
||||||
- "${SERVER_PORT:-8080}:${SERVER_PORT:-8080}"
|
- "${SERVER_PORT:-8080}:${SERVER_PORT:-8080}"
|
||||||
volumes:
|
volumes:
|
||||||
@@ -117,7 +130,16 @@ services:
|
|||||||
condition: service_started
|
condition: service_started
|
||||||
opensearch:
|
opensearch:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
command: mvn clean spring-boot:run -Dmaven.test.skip=true
|
command: >
|
||||||
|
sh -c "apt-get update && apt-get install -y --no-install-recommends curl &&
|
||||||
|
mvn clean spring-boot:run -Dmaven.test.skip=true"
|
||||||
|
# healthcheck:
|
||||||
|
# test: ["CMD-SHELL",
|
||||||
|
# "curl -fsS http://127.0.0.1:${SERVER_PORT:-8080}${SPRING_HEALTH_PATH:-/actuator/health} | grep -q '\"status\"\\s*:\\s*\"UP\"'"]
|
||||||
|
# interval: 10s
|
||||||
|
# timeout: 5s
|
||||||
|
# retries: 30
|
||||||
|
# start_period: 90s
|
||||||
networks:
|
networks:
|
||||||
- openisle-network
|
- openisle-network
|
||||||
|
|
||||||
@@ -127,14 +149,27 @@ services:
|
|||||||
working_dir: /app
|
working_dir: /app
|
||||||
env_file:
|
env_file:
|
||||||
- ../.env
|
- ../.env
|
||||||
|
environment:
|
||||||
|
WS_HEALTH_PATH: ${WS_HEALTH_PATH:-/actuator/health}
|
||||||
|
WEBSOCKET_PORT: ${WEBSOCKET_PORT:-8082}
|
||||||
ports:
|
ports:
|
||||||
- "${WEBSOCKET_PORT:-8082}:${WEBSOCKET_PORT:-8082}"
|
- "${WEBSOCKET_PORT:-8082}:${WEBSOCKET_PORT:-8082}"
|
||||||
volumes:
|
volumes:
|
||||||
- ../websocket_service:/app
|
- ../websocket_service:/app
|
||||||
- websocket-maven-repo:/root/.m2
|
- websocket-maven-repo:/root/.m2
|
||||||
depends_on:
|
depends_on:
|
||||||
- rabbitmq
|
rabbitmq:
|
||||||
command: mvn clean spring-boot:run -Dmaven.test.skip=true
|
condition: service_healthy
|
||||||
|
command: >
|
||||||
|
sh -c "apt-get update && apt-get install -y --no-install-recommends curl &&
|
||||||
|
mvn clean spring-boot:run -Dmaven.test.skip=true"
|
||||||
|
# healthcheck:
|
||||||
|
# test: ["CMD-SHELL",
|
||||||
|
# "curl -fsS http://127.0.0.1:${WEBSOCKET_PORT:-8082}${WS_HEALTH_PATH:-/actuator/health} | grep -q '\"status\"\\s*:\\s*\"UP\"'"]
|
||||||
|
# interval: 10s
|
||||||
|
# timeout: 5s
|
||||||
|
# retries: 30
|
||||||
|
# start_period: 90s
|
||||||
networks:
|
networks:
|
||||||
- openisle-network
|
- openisle-network
|
||||||
|
|
||||||
@@ -151,8 +186,10 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- "${FRONTEND_PORT:-3000}:3000"
|
- "${FRONTEND_PORT:-3000}:3000"
|
||||||
depends_on:
|
depends_on:
|
||||||
- springboot
|
springboot:
|
||||||
- websocket-service
|
condition: service_started
|
||||||
|
websocket-service:
|
||||||
|
condition: service_started
|
||||||
networks:
|
networks:
|
||||||
- openisle-network
|
- openisle-network
|
||||||
profiles:
|
profiles:
|
||||||
@@ -173,8 +210,10 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- "${FRONTEND_SERVICE_PORT:-3001}:3000"
|
- "${FRONTEND_SERVICE_PORT:-3001}:3000"
|
||||||
depends_on:
|
depends_on:
|
||||||
- springboot
|
springboot:
|
||||||
- websocket-service
|
condition: service_started
|
||||||
|
websocket-service:
|
||||||
|
condition: service_started
|
||||||
networks:
|
networks:
|
||||||
- openisle-network
|
- openisle-network
|
||||||
profiles:
|
profiles:
|
||||||
|
|||||||
1
docker/rabbitmq/conf/enabled_plugins
Normal file
1
docker/rabbitmq/conf/enabled_plugins
Normal file
@@ -0,0 +1 @@
|
|||||||
|
[rabbitmq_management, rabbitmq_prometheus].
|
||||||
6
docker/rabbitmq/conf/rabbitmq.conf
Normal file
6
docker/rabbitmq/conf/rabbitmq.conf
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
# 管理插件加载 definitions(仅空库时生效)
|
||||||
|
management.load_definitions = /etc/rabbitmq/definitions.json
|
||||||
|
|
||||||
|
# (可选)禁用管理老式统计采集,转 Prometheus,避免弃用告警
|
||||||
|
management_agent.disable_metrics_collector = true
|
||||||
|
management.disable_stats = true
|
||||||
31
docker/rabbitmq/definitions.json
Normal file
31
docker/rabbitmq/definitions.json
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
"users": [
|
||||||
|
{ "name": "nagisa", "password": "nagisa", "tags": "administrator" }
|
||||||
|
],
|
||||||
|
"vhosts": [{ "name": "/" }],
|
||||||
|
"permissions": [
|
||||||
|
{ "user": "nagisa", "vhost": "/", "configure": ".*", "write": ".*", "read": ".*" }
|
||||||
|
],
|
||||||
|
"queues": [
|
||||||
|
{ "name": "notifications-queue", "vhost": "/", "durable": true, "auto_delete": false, "arguments": {} },
|
||||||
|
{ "name": "notifications-queue-0", "vhost": "/", "durable": true, "auto_delete": false, "arguments": {} },
|
||||||
|
{ "name": "notifications-queue-1", "vhost": "/", "durable": true, "auto_delete": false, "arguments": {} },
|
||||||
|
{ "name": "notifications-queue-2", "vhost": "/", "durable": true, "auto_delete": false, "arguments": {} },
|
||||||
|
{ "name": "notifications-queue-3", "vhost": "/", "durable": true, "auto_delete": false, "arguments": {} },
|
||||||
|
{ "name": "notifications-queue-4", "vhost": "/", "durable": true, "auto_delete": false, "arguments": {} },
|
||||||
|
{ "name": "notifications-queue-5", "vhost": "/", "durable": true, "auto_delete": false, "arguments": {} },
|
||||||
|
{ "name": "notifications-queue-6", "vhost": "/", "durable": true, "auto_delete": false, "arguments": {} },
|
||||||
|
{ "name": "notifications-queue-7", "vhost": "/", "durable": true, "auto_delete": false, "arguments": {} },
|
||||||
|
{ "name": "notifications-queue-8", "vhost": "/", "durable": true, "auto_delete": false, "arguments": {} },
|
||||||
|
{ "name": "notifications-queue-9", "vhost": "/", "durable": true, "auto_delete": false, "arguments": {} },
|
||||||
|
{ "name": "notifications-queue-a", "vhost": "/", "durable": true, "auto_delete": false, "arguments": {} },
|
||||||
|
{ "name": "notifications-queue-b", "vhost": "/", "durable": true, "auto_delete": false, "arguments": {} },
|
||||||
|
{ "name": "notifications-queue-c", "vhost": "/", "durable": true, "auto_delete": false, "arguments": {} },
|
||||||
|
{ "name": "notifications-queue-d", "vhost": "/", "durable": true, "auto_delete": false, "arguments": {} },
|
||||||
|
{ "name": "notifications-queue-e", "vhost": "/", "durable": true, "auto_delete": false, "arguments": {} },
|
||||||
|
{ "name": "notifications-queue-f", "vhost": "/", "durable": true, "auto_delete": false, "arguments": {} }
|
||||||
|
],
|
||||||
|
"exchanges": [],
|
||||||
|
"bindings": []
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user