plc.directory mirror
1services:
2 postgres:
3 image: postgres:16-alpine
4 container_name: plc-mirror-db
5 restart: unless-stopped
6 ports:
7 - "5432:5432"
8 environment:
9 - POSTGRES_DB=${POSTGRES_DB}
10 - POSTGRES_USER=${POSTGRES_USER}
11 - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
12 volumes:
13 - postgres_data:/var/lib/postgresql/data
14 - ./init.sql:/docker-entrypoint-initdb.d/init.sql:ro
15 healthcheck:
16 test: ["CMD-SHELL", "pg_isready -U plc_user -d plc_mirror"]
17 interval: 10s
18 timeout: 5s
19 retries: 5
20 command: [
21 "postgres",
22 "-c", "log_statement=all",
23 "-c", "log_duration=on",
24 "-c", "log_min_duration_statement=0",
25 "-c", "max_connections=200",
26 "-c", "shared_preload_libraries=pg_stat_statements"
27 ]
28 networks:
29 - plc-network
30
31 api:
32 build: .
33 container_name: plc-api
34 restart: unless-stopped
35 command: ["./api"]
36 ports:
37 - "3000:3000"
38 volumes:
39 - ./plc.toml:/app/plc.toml:ro
40 depends_on:
41 postgres:
42 condition: service_healthy
43 healthcheck:
44 test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000/_health"]
45 interval: 30s
46 timeout: 10s
47 retries: 3
48 start_period: 40s
49 networks:
50 - plc-network
51
52 mirror:
53 build: .
54 container_name: plc-mirror
55 restart: unless-stopped
56 command: ["./mirror"]
57 volumes:
58 - ./plc.toml:/app/plc.toml:ro
59 depends_on:
60 postgres:
61 condition: service_healthy
62 networks:
63 - plc-network
64
65volumes:
66 postgres_data:
67 driver: local
68
69networks:
70 plc-network:
71 driver: bridge