File size: 2,770 Bytes
a8eed5c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
117
118
119
version: "3.9"

services:
  postgres:
    image: postgres:15-alpine
    container_name: astromesh-postgres
    environment:
      POSTGRES_DB: astromesh
      POSTGRES_USER: astromesh
      POSTGRES_PASSWORD: astromesh
    ports:
      - "5432:5432"
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U astromesh -d astromesh"]
      interval: 5s
      timeout: 5s
      retries: 10
    volumes:
      - pgdata:/var/lib/postgresql/data
    networks:
      - astromesh-net

  node1:
    build: .
    container_name: astromesh-node1
    environment:
      NODE_ID: "1"
      HTTP_PORT: "8081"
      PEER_PORTS: "8082,8083,8084"
      DB_URL: "postgres://astromesh:astromesh@postgres:5432/astromesh?sslmode=disable"
      PEER_HOSTS: "node2,node3,node4"
    ports:
      - "8081:8081"
    depends_on:
      postgres:
        condition: service_healthy
    restart: unless-stopped
    networks:
      - astromesh-net

  node2:
    build: .
    container_name: astromesh-node2
    environment:
      NODE_ID: "2"
      HTTP_PORT: "8082"
      PEER_PORTS: "8081,8083,8084"
      DB_URL: "postgres://astromesh:astromesh@postgres:5432/astromesh?sslmode=disable"
      PEER_HOSTS: "node1,node3,node4"
    ports:
      - "8082:8082"
    depends_on:
      postgres:
        condition: service_healthy
    restart: unless-stopped
    networks:
      - astromesh-net

  node3:
    build: .
    container_name: astromesh-node3
    environment:
      NODE_ID: "3"
      HTTP_PORT: "8083"
      PEER_PORTS: "8081,8082,8084"
      DB_URL: "postgres://astromesh:astromesh@postgres:5432/astromesh?sslmode=disable"
      PEER_HOSTS: "node1,node2,node4"
    ports:
      - "8083:8083"
    depends_on:
      postgres:
        condition: service_healthy
    restart: unless-stopped
    networks:
      - astromesh-net

  node4:
    build: .
    container_name: astromesh-node4
    environment:
      NODE_ID: "4"
      HTTP_PORT: "8084"
      PEER_PORTS: "8081,8082,8083"
      DB_URL: "postgres://astromesh:astromesh@postgres:5432/astromesh?sslmode=disable"
      PEER_HOSTS: "node1,node2,node3"
    ports:
      - "8084:8084"
    depends_on:
      postgres:
        condition: service_healthy
    restart: unless-stopped
    networks:
      - astromesh-net

  middleware:
    build: .
    container_name: astromesh-middleware
    environment:
      NODE_ID: "0"
      HTTP_PORT: "8090"
      PEER_PORTS: "8081,8082,8083,8084"
      DB_URL: "postgres://astromesh:astromesh@postgres:5432/astromesh?sslmode=disable"
      PEER_HOSTS: "node1,node2,node3,node4"
    ports:
      - "8090:8090"
    depends_on:
      postgres:
        condition: service_healthy
    restart: unless-stopped
    networks:
      - astromesh-net

networks:
  astromesh-net:
    driver: bridge

volumes:
  pgdata: