2f830424a4
Merge install/upgrade into nexus-1panel.sh with 1c4g/2c8g/4c16g resource profiles; preflight Gitea and firewall hints; post-install HTTPS health probe. Co-authored-by: Cursor <cursoragent@cursor.com>
114 lines
3.2 KiB
YAML
114 lines
3.2 KiB
YAML
# Nexus 6.0 — production Compose (1Panel / bare Docker host)
|
|
# Resource profile: docker/profiles/{1c4g,2c8g,4c16g}.env — see deploy/nexus-1panel.sh
|
|
#
|
|
# Usage:
|
|
# bash deploy/nexus-1panel.sh install --profile 2c8g
|
|
# # or manually:
|
|
# docker compose -f docker/docker-compose.prod.yml \
|
|
# --env-file docker/.env.prod --env-file docker/profiles/2c8g.env up -d --build
|
|
#
|
|
# OpenResty on host proxies https://api.synaglobal.vip → 127.0.0.1:8600
|
|
|
|
name: nexus-prod
|
|
|
|
services:
|
|
mysql:
|
|
image: mysql:8.4
|
|
restart: unless-stopped
|
|
environment:
|
|
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:?set MYSQL_ROOT_PASSWORD}
|
|
MYSQL_DATABASE: nexus
|
|
MYSQL_USER: nexus
|
|
MYSQL_PASSWORD: ${MYSQL_PASSWORD:?set MYSQL_PASSWORD}
|
|
volumes:
|
|
- mysql-data:/var/lib/mysql
|
|
- ./${MYSQL_CNF_FILE:-mysql-prod-2c8g.cnf}:/etc/mysql/conf.d/99-nexus-prod.cnf:ro
|
|
mem_limit: ${MYSQL_MEM_LIMIT:-2g}
|
|
cpus: ${MYSQL_CPUS:-1.5}
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "mysqladmin ping -h 127.0.0.1 -uroot -p\"$$MYSQL_ROOT_PASSWORD\" || exit 1"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 8
|
|
start_period: 40s
|
|
networks:
|
|
- nexus-internal
|
|
|
|
redis:
|
|
image: redis:7-alpine
|
|
restart: unless-stopped
|
|
command:
|
|
- redis-server
|
|
- --appendonly
|
|
- "yes"
|
|
- --maxmemory
|
|
- ${REDIS_MAXMEMORY:-256mb}
|
|
- --maxmemory-policy
|
|
- allkeys-lru
|
|
volumes:
|
|
- redis-data:/data
|
|
mem_limit: ${REDIS_MEM_LIMIT:-384m}
|
|
cpus: ${REDIS_CPUS:-0.5}
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 10s
|
|
timeout: 3s
|
|
retries: 8
|
|
networks:
|
|
- nexus-internal
|
|
|
|
nexus:
|
|
build:
|
|
context: ..
|
|
dockerfile: Dockerfile.prod
|
|
restart: unless-stopped
|
|
depends_on:
|
|
mysql:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
ports:
|
|
- "127.0.0.1:${NEXUS_PUBLISH_PORT:-8600}:8600"
|
|
environment:
|
|
MYSQL_HOST: mysql
|
|
MYSQL_PORT: "3306"
|
|
REDIS_HOST: redis
|
|
REDIS_PORT: "6379"
|
|
NEXUS_PERSIST_DIR: /var/lib/nexus
|
|
NEXUS_DOCKER_WRITE_ENV: "1"
|
|
NEXUS_HOST: "0.0.0.0"
|
|
NEXUS_PORT: "8600"
|
|
NEXUS_DEPLOY_PATH: /app
|
|
NEXUS_DATABASE_URL: mysql+aiomysql://nexus:${MYSQL_PASSWORD}@mysql:3306/nexus
|
|
NEXUS_REDIS_URL: redis://redis:6379/0
|
|
NEXUS_CORS_ORIGINS: ${NEXUS_CORS_ORIGINS:?set NEXUS_CORS_ORIGINS}
|
|
NEXUS_SECRET_KEY: ${NEXUS_SECRET_KEY:?set NEXUS_SECRET_KEY}
|
|
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: ${NEXUS_MEM_LIMIT:-2g}
|
|
cpus: ${NEXUS_CPUS:-1.5}
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-sf", "http://127.0.0.1:8600/health"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 90s
|
|
networks:
|
|
- nexus-internal
|
|
|
|
networks:
|
|
nexus-internal:
|
|
driver: bridge
|
|
|
|
volumes:
|
|
mysql-data:
|
|
redis-data:
|
|
nexus-state:
|
|
nexus-web-data:
|