Use host Redis (127.0.0.1:6379) with password, switch to host network mode
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -10,9 +10,6 @@ SERVER_PORT=5000
|
||||
# 服务器主机(默认0.0.0.0,接受所有连接)
|
||||
SERVER_HOST=0.0.0.0
|
||||
|
||||
# Redis缓存地址(Docker内部自动连接,无需修改)
|
||||
REDIS_URL=redis://redis:6379/0
|
||||
|
||||
# 时区设置
|
||||
TZ=Asia/Shanghai
|
||||
|
||||
|
||||
2
cache.py
2
cache.py
@@ -13,7 +13,7 @@ import redis.asyncio as redis
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
REDIS_URL = os.getenv('REDIS_URL', 'redis://redis:6379/0')
|
||||
REDIS_URL = 'redis://:redis_XMiXNa@127.0.0.1:6379/0'
|
||||
|
||||
# 缓存过期时间(秒)
|
||||
TTL_ACCOUNTS = 300 # 账户列表 5分钟
|
||||
|
||||
@@ -4,24 +4,14 @@ services:
|
||||
outlook-mail-system:
|
||||
build: .
|
||||
container_name: outlook-mail-automation
|
||||
ports:
|
||||
- "5000:5001"
|
||||
network_mode: host
|
||||
volumes:
|
||||
# 挂载配置文件,便于修改邮箱配置
|
||||
- ./config.txt:/app/config.txt
|
||||
# 持久化SQLite数据库,防止容器重建丢失数据
|
||||
- ./data:/app/data
|
||||
# 可选:挂载日志目录
|
||||
- ./logs:/app/logs
|
||||
environment:
|
||||
# 管理员令牌,可以通过环境变量设置
|
||||
- ADMIN_TOKEN=${ADMIN_TOKEN:-admin123}
|
||||
- REDIS_URL=redis://redis:6379/0
|
||||
# 可选:设置时区
|
||||
- TZ=Asia/Shanghai
|
||||
depends_on:
|
||||
redis:
|
||||
condition: service_healthy
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:5001/"]
|
||||
@@ -29,27 +19,3 @@ services:
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
networks:
|
||||
- outlook-mail-network
|
||||
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
container_name: outlook-redis
|
||||
command: redis-server --maxmemory 64mb --maxmemory-policy allkeys-lru
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
interval: 10s
|
||||
timeout: 3s
|
||||
retries: 3
|
||||
networks:
|
||||
- outlook-mail-network
|
||||
|
||||
volumes:
|
||||
redis_data:
|
||||
|
||||
networks:
|
||||
outlook-mail-network:
|
||||
driver: bridge
|
||||
|
||||
Reference in New Issue
Block a user