chore(docker): tune production stack for 2C8G hosts
Nexus CI/CD / test (push) Waiting to run
Nexus CI/CD / deploy (push) Blocked by required conditions
Nexus Pre-commit Checks / quick-check (push) Waiting to run

Add mysql-prod-2c8g.cnf, container mem/cpu limits, Redis maxmemory,
and default Nexus pool 30/20 for 8GiB 1Panel deployments.
This commit is contained in:
Nexus Deploy
2026-06-05 22:44:06 +08:00
parent 2f67e9e2b9
commit bfda70bbe7
6 changed files with 89 additions and 1 deletions
+19 -1
View File
@@ -1,4 +1,6 @@
# Nexus 6.0 — production Compose (1Panel / bare Docker host)
# Tuned for 2 vCPU / 8 GiB — see docker/mysql-prod-2c8g.cnf
#
# Usage:
# cp docker/.env.prod.example docker/.env.prod # fill secrets from Baota .env
# docker compose -f docker/docker-compose.prod.yml --env-file docker/.env.prod up -d --build
@@ -18,6 +20,9 @@ services:
MYSQL_PASSWORD: ${MYSQL_PASSWORD:?set MYSQL_PASSWORD}
volumes:
- mysql-data:/var/lib/mysql
- ./mysql-prod-2c8g.cnf:/etc/mysql/conf.d/99-nexus-2c8g.cnf:ro
mem_limit: 2g
cpus: 1.5
healthcheck:
test: ["CMD-SHELL", "mysqladmin ping -h 127.0.0.1 -uroot -p\"$$MYSQL_ROOT_PASSWORD\" || exit 1"]
interval: 10s
@@ -30,9 +35,18 @@ services:
redis:
image: redis:7-alpine
restart: unless-stopped
command: ["redis-server", "--appendonly", "yes"]
command:
- redis-server
- --appendonly
- "yes"
- --maxmemory
- 256mb
- --maxmemory-policy
- allkeys-lru
volumes:
- redis-data:/data
mem_limit: 384m
cpus: 0.5
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
@@ -70,9 +84,13 @@ services:
NEXUS_API_KEY: ${NEXUS_API_KEY:?set NEXUS_API_KEY}
NEXUS_ENCRYPTION_KEY: ${NEXUS_ENCRYPTION_KEY:-}
NEXUS_API_BASE_URL: ${NEXUS_API_BASE_URL:?set NEXUS_API_BASE_URL}
NEXUS_DB_POOL_SIZE: ${NEXUS_DB_POOL_SIZE:-30}
NEXUS_DB_MAX_OVERFLOW: ${NEXUS_DB_MAX_OVERFLOW:-20}
volumes:
- nexus-state:/var/lib/nexus
- nexus-web-data:/app/web/data
mem_limit: 2g
cpus: 1.5
healthcheck:
test: ["CMD", "curl", "-sf", "http://127.0.0.1:8600/health"]
interval: 30s