forked from postalsys/emailengine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
116 lines (106 loc) · 4.13 KB
/
docker-compose.yml
File metadata and controls
116 lines (106 loc) · 4.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
name: emailengine
# IMPORTANT: EmailEngine is resource-intensive
# - Minimum: 8GB RAM, 4 CPU cores for production
# - Recommended: 16GB+ RAM, 8+ CPU cores
# - See DOCKER_DEPLOYMENT.md for deployment guidance
services:
emailengine:
restart: ${RESTART_POLICY:-unless-stopped}
image: postalsys/emailengine:${EMAILENGINE_VERSION:-latest}
ports:
# API and web interface
- '${EMAILENGINE_API_BIND:-127.0.0.1}:${EMAILENGINE_API_PORT:-3000}:3000'
# SMTP for message submission
- '${EMAILENGINE_SMTP_BIND:-127.0.0.1}:${EMAILENGINE_SMTP_PORT:-2525}:2525'
# IMAP proxy
- '${EMAILENGINE_IMAP_BIND:-127.0.0.1}:${EMAILENGINE_IMAP_PORT:-9993}:9993'
depends_on:
redis:
condition: ${REDIS_HEALTHCHECK:-service_healthy}
networks:
- emailengine-network
environment:
# Configuration via environment variables
# For full list see https://github.com/postalsys/emailengine#config-mapping
# Settings to write to v1/settings on startup
EENGINE_SETTINGS: ${EENGINE_SETTINGS:-}
# Encryption secret - REQUIRED for production
EENGINE_SECRET: ${EENGINE_SECRET:-default-dev-secret-change-in-production}
# Database connection URL
EENGINE_REDIS: ${EENGINE_REDIS:-redis://redis:6379/2}
# Additional settings
EENGINE_LOG_LEVEL: ${EENGINE_LOG_LEVEL:-info}
EENGINE_WORKERS: ${EENGINE_WORKERS:-4}
healthcheck:
test: ['CMD', 'wget', '--no-verbose', '--tries=1', '--spider', 'http://localhost:3000/health']
interval: ${HEALTHCHECK_INTERVAL:-30s}
timeout: ${HEALTHCHECK_TIMEOUT:-10s}
retries: ${HEALTHCHECK_RETRIES:-3}
start_period: ${HEALTHCHECK_START_PERIOD:-40s}
logging:
driver: 'json-file'
options:
max-size: '${LOG_MAX_SIZE:-100m}'
max-file: '${LOG_MAX_FILE:-10}'
compress: '${LOG_COMPRESS:-true}'
redis:
# IMPORTANT: Redis is used as a DATABASE, not a cache
# - No memory limits are set (uses available system memory)
# - Eviction policy is 'noeviction' to prevent data loss
# - Monitor memory usage: docker-compose exec redis redis-cli INFO memory
image: redis:${REDIS_VERSION:-7-alpine}
restart: ${RESTART_POLICY:-unless-stopped}
networks:
- emailengine-network
command: >
sh -c "
if [ -n \"$$REDIS_PASSWORD\" ]; then
exec redis-server \
--requirepass \"$$REDIS_PASSWORD\" \
--maxmemory-policy noeviction \
--tcp-backlog 511 \
--tcp-keepalive 300 \
--timeout 0 \
--databases 16 \
--loglevel ${REDIS_LOG_LEVEL:-notice} \
--save 900 1 \
--save 300 10 \
--save 60 10000 \
--stop-writes-on-bgsave-error yes \
--rdbcompression yes \
--rdbchecksum yes
else
exec redis-server \
--maxmemory-policy noeviction
fi
"
environment:
REDIS_PASSWORD: ${REDIS_PASSWORD:-}
REDIS_LOG_LEVEL: ${REDIS_LOG_LEVEL:-notice}
volumes:
- redis-data:/data
healthcheck:
test: >
sh -c "
if [ -n \"$$REDIS_PASSWORD\" ]; then
redis-cli --no-auth-warning -a \"$$REDIS_PASSWORD\" ping
else
redis-cli ping
fi
"
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
logging:
driver: 'json-file'
options:
max-size: '50m'
max-file: '5'
compress: '${LOG_COMPRESS:-true}'
networks:
emailengine-network:
driver: bridge
volumes:
redis-data:
driver: local