feat:增加端口
This commit is contained in:
@@ -58,6 +58,8 @@ TZ=Asia/Shanghai
|
|||||||
POSTGRES_USER=sub2api
|
POSTGRES_USER=sub2api
|
||||||
POSTGRES_PASSWORD=change_this_secure_password
|
POSTGRES_PASSWORD=change_this_secure_password
|
||||||
POSTGRES_DB=sub2api
|
POSTGRES_DB=sub2api
|
||||||
|
# PostgreSQL 监听端口(同时用于 PG 服务端和应用连接,默认 5432)
|
||||||
|
DATABASE_PORT=5432
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# PostgreSQL 服务端参数(可选;主要用于 deploy/docker-compose-aicodex.yml)
|
# PostgreSQL 服务端参数(可选;主要用于 deploy/docker-compose-aicodex.yml)
|
||||||
@@ -106,6 +108,8 @@ DATABASE_CONN_MAX_IDLE_TIME_MINUTES=5
|
|||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# Redis Configuration
|
# Redis Configuration
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
|
# Redis 监听端口(同时用于应用连接和 Redis 服务端,默认 6379)
|
||||||
|
REDIS_PORT=6379
|
||||||
# Leave empty for no password (default for local development)
|
# Leave empty for no password (default for local development)
|
||||||
REDIS_PASSWORD=
|
REDIS_PASSWORD=
|
||||||
REDIS_DB=0
|
REDIS_DB=0
|
||||||
|
|||||||
@@ -165,6 +165,9 @@ services:
|
|||||||
- "postgres"
|
- "postgres"
|
||||||
- "-c"
|
- "-c"
|
||||||
- "listen_addresses=127.0.0.1"
|
- "listen_addresses=127.0.0.1"
|
||||||
|
# 监听端口:与应用侧 DATABASE_PORT 保持一致。
|
||||||
|
- "-c"
|
||||||
|
- "port=${DATABASE_PORT:-5432}"
|
||||||
# 连接数上限:需要结合应用侧 DATABASE_MAX_OPEN_CONNS 调整。
|
# 连接数上限:需要结合应用侧 DATABASE_MAX_OPEN_CONNS 调整。
|
||||||
# 注意:max_connections 过大可能导致内存占用与上下文切换开销显著上升。
|
# 注意:max_connections 过大可能导致内存占用与上下文切换开销显著上升。
|
||||||
- "-c"
|
- "-c"
|
||||||
@@ -177,7 +180,7 @@ services:
|
|||||||
- "-c"
|
- "-c"
|
||||||
- "maintenance_work_mem=${POSTGRES_MAINTENANCE_WORK_MEM:-128MB}"
|
- "maintenance_work_mem=${POSTGRES_MAINTENANCE_WORK_MEM:-128MB}"
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-sub2api} -d ${POSTGRES_DB:-sub2api}"]
|
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-sub2api} -d ${POSTGRES_DB:-sub2api} -p ${DATABASE_PORT:-5432}"]
|
||||||
interval: 10s
|
interval: 10s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 5
|
retries: 5
|
||||||
@@ -201,6 +204,7 @@ services:
|
|||||||
command: >
|
command: >
|
||||||
redis-server
|
redis-server
|
||||||
--bind 127.0.0.1
|
--bind 127.0.0.1
|
||||||
|
--port ${REDIS_PORT:-6379}
|
||||||
--maxclients ${REDIS_MAXCLIENTS:-50000}
|
--maxclients ${REDIS_MAXCLIENTS:-50000}
|
||||||
--save 60 1
|
--save 60 1
|
||||||
--appendonly yes
|
--appendonly yes
|
||||||
@@ -211,7 +215,7 @@ services:
|
|||||||
# REDISCLI_AUTH is used by redis-cli for authentication (safer than -a flag)
|
# REDISCLI_AUTH is used by redis-cli for authentication (safer than -a flag)
|
||||||
- REDISCLI_AUTH=${REDIS_PASSWORD:-}
|
- REDISCLI_AUTH=${REDIS_PASSWORD:-}
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "redis-cli", "ping"]
|
test: ["CMD-SHELL", "redis-cli -p ${REDIS_PORT:-6379} -a \"$REDISCLI_AUTH\" ping | grep -q PONG || redis-cli -p ${REDIS_PORT:-6379} ping | grep -q PONG"]
|
||||||
interval: 10s
|
interval: 10s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 5
|
retries: 5
|
||||||
|
|||||||
Reference in New Issue
Block a user