Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
64 lines (63 loc) · 1.83 KB
/
Copy pathdocker-compose.yml
File metadata and controls
64 lines (63 loc) · 1.83 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
services:
bot:
# build: .
image: ghcr.io/sudo-py-dev/lex-tg:latest
container_name: lex-tg
restart: unless-stopped
env_file:
- .env
volumes:
- ./sessions:/app/sessions
- ./logs:/app/logs
- ./data:/app/data
environment:
DATABASE_URL: "${DATABASE_URL:?Set DATABASE_URL for the bot database role}"
POSTGRES_PASSWORD: ""
BOT_DB_PASSWORD: ""
depends_on:
db:
condition: service_healthy
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
security_opt:
- no-new-privileges:true
cap_drop:
- ALL
read_only: true
tmpfs:
- /tmp
healthcheck:
test: ["CMD-SHELL", "test -f /app/data/heartbeat && test $$(($$(date +%s) - $$(cat /app/data/heartbeat))) -lt 120"]
interval: 60s
timeout: 5s
retries: 3
start_period: 60s
deploy:
resources:
limits:
memory: 512M
reservations:
memory: 128M
db:
image: postgres:16-alpine
entrypoint: ["/bin/sh", "/usr/local/bin/lex-postgres-entrypoint.sh"]
command: ["postgres"]
container_name: lex-tg-db
restart: always
environment:
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: "${POSTGRES_PASSWORD:?Set a unique PostgreSQL bootstrap password}"
POSTGRES_DB: ${POSTGRES_DB:-botdb}
BOT_DB_PASSWORD: "${BOT_DB_PASSWORD:?Set a separate password for lex_bot}"
volumes:
- ./pgdata:/var/lib/postgresql/data
- ./scripts/postgres_entrypoint.sh:/usr/local/bin/lex-postgres-entrypoint.sh:ro
- ./scripts/init_postgres.sh:/docker-entrypoint-initdb.d/10-lex-bot.sh:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -h 127.0.0.1 -U \"$$POSTGRES_USER\" -d \"$$POSTGRES_DB\""]
interval: 5s
timeout: 5s
retries: 5