summaryrefslogtreecommitdiff
path: root/stacks/db/compose.yml
blob: 9a44712ee740fe754fb2b81b8c259453d78d506b (plain)
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
name: ${STACK}

networks:
  edge-net:
    name: ${EDGE_NET}
    external: true
  db-net:
    name: ${DB_NET}
    external: true

volumes:
  db-data:
    name: ${DB_VOLUME}
    external: true

secrets:
  DB_PASSWORD:
    file: '/srv/secrets/DB_PASSWORD'

services:
  db:
    container_name: ${DB_CONTAINER}
    image: postgres:16
    restart: unless-stopped
    environment:
      POSTGRES_USER: 'admin'
    env_file:
      - .run.env # Runtime ENV
      - .env # Compose ENV
    user: '${UID}:${GID}'
    volumes:
      - ./data/:/var/lib/postgresql/data
    networks:
      - db-net
    expose:
      - 5432
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER}"]
      interval: 5s
      retries: 5
  db-admin:
    container_name: ${DBA_CONTAINER}
    image: adminer:latest
    env_file:
      - .run.env
      - .env
    depends_on:
      - db-test
    networks:
      - edge-net
      - db-net
    expose:
      - 8080