fix(gateway): 默认监听端口改为 8084 以支持非 root 运行

- Dockerfile 及 main.rs 默认 bind 从 0.0.0.0:80 改为 0.0.0.0:8084
- docker-compose 以 UID:GID 非 root 用户启动 app 容器
- compose 端口映射与容器内监听端口保持一致,通过 AETHER_GATEWAY_BIND 注入
This commit is contained in:
fawney19
2026-04-11 13:55:11 +08:00
parent 940a28cff4
commit 8cd2c4d5bd
5 changed files with 10 additions and 7 deletions

View File

@@ -19,10 +19,10 @@ COPY dist/frontend/ /srv/frontend
WORKDIR /app
ENV RUST_LOG=aether_gateway=info \
AETHER_GATEWAY_BIND=0.0.0.0:80 \
AETHER_GATEWAY_BIND=0.0.0.0:8084 \
AETHER_GATEWAY_STATIC_DIR=/srv/frontend
EXPOSE 80
EXPOSE 8084
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD ["/usr/local/bin/aether-gateway", "--healthcheck"]

View File

@@ -120,10 +120,10 @@ WORKDIR /app
ENV LANG=C.UTF-8 \
LC_ALL=C.UTF-8 \
RUST_LOG=aether_gateway=info \
AETHER_GATEWAY_BIND=0.0.0.0:80 \
AETHER_GATEWAY_BIND=0.0.0.0:8084 \
AETHER_GATEWAY_STATIC_DIR=/srv/frontend
EXPOSE 80
EXPOSE 8084
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD ["/usr/local/bin/aether-gateway", "--healthcheck"]

View File

@@ -495,7 +495,7 @@ impl GatewayLoggingArgs {
about = "Phase 3a Rust ingress gateway for Aether"
)]
struct Args {
#[arg(long, env = "AETHER_GATEWAY_BIND", default_value = "0.0.0.0:80")]
#[arg(long, env = "AETHER_GATEWAY_BIND", default_value = "0.0.0.0:8084")]
bind: String,
/// 容器内健康检查入口:根据当前 bind 端口探测本地 /health。

View File

@@ -50,13 +50,14 @@ services:
DATABASE_URL: postgresql://postgres:${DB_PASSWORD}@postgres:5432/aether
REDIS_URL: redis://:${REDIS_PASSWORD}@redis:6379/0
TZ: Asia/Shanghai
AETHER_GATEWAY_BIND: 0.0.0.0:${APP_PORT:-8084}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
ports:
- "${APP_PORT:-8084}:80"
- "${APP_PORT:-8084}:${APP_PORT:-8084}"
volumes:
- ./logs:/app/logs
restart: unless-stopped

View File

@@ -35,6 +35,7 @@ services:
app:
image: ${APP_IMAGE:-ghcr.io/fawney19/aether:pre}
container_name: aether-app
user: "${UID:-1000}:${GID:-1000}"
env_file:
- .env
environment:
@@ -47,13 +48,14 @@ services:
AETHER_LOG_ROTATION: ${AETHER_LOG_ROTATION:-daily}
AETHER_LOG_RETENTION_DAYS: ${AETHER_LOG_RETENTION_DAYS:-7}
AETHER_LOG_MAX_FILES: ${AETHER_LOG_MAX_FILES:-30}
AETHER_GATEWAY_BIND: 0.0.0.0:${APP_PORT:-8084}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
ports:
- "${APP_PORT:-8084}:80"
- "${APP_PORT:-8084}:${APP_PORT:-8084}"
volumes:
- ./logs:/app/logs
restart: unless-stopped