-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-compose.yaml
200 lines (190 loc) · 6.16 KB
/
docker-compose.yaml
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
version: "3.9"
services:
backend:
container_name: backend # Name of the backend container
build: # Build configuration for the backend
context: ./backend # Directory containing Dockerfile
dockerfile: Dockerfile.dev
image: io-1694:latest # Use the latest io-1694 image
restart: unless-stopped # Always restart unless explicitly stopped
environment: # Environment variables for configuration
HOST: 0.0.0.0
PORT: 8000
DATABASE_HOST: web_db # Link to the database service by name
DATABASE_NAME: 1694
DATABASE_USERNAME: voltaire
DATABASE_PASSWORD: postgres
NODE_ENV: development # Set node environment to development
volumes: # Mount points for persistent data and source code
- "./backend:/app"
ports:
- "8000:8000" # Expose port 8080 to the host
networks:
- io-1694 # Connect to the 'io-1694' network
depends_on:
- web_db # Depends on the database service
dbsync_db:
image: postgres:16.3-alpine3.19
environment:
- POSTGRES_LOGGING=true
- POSTGRES_DB_FILE=/run/secrets/postgres_db
- POSTGRES_PASSWORD_FILE=/run/secrets/postgres_password
- POSTGRES_USER_FILE=/run/secrets/postgres_user
secrets:
- postgres_password
- postgres_user
- postgres_db
ports:
- ${POSTGRES_PORT:-5432}:5432
volumes:
- dbsync-db-data:/var/lib/postgresql/data
restart: on-failure
networks:
- io-1694 # Connect to the 'io-1694' network
healthcheck:
# Use pg_isready to check postgres is running. Substitute different
# user `postgres` if you've setup differently to config/pgpass-mainnet
test: [ "CMD-SHELL", "pg_isready -U postgres" ]
interval: 10s
timeout: 5s
retries: 5
command: ${POSTGRES_ARGS:--c maintenance_work_mem=1GB -c max_parallel_maintenance_workers=4}
logging:
driver: "json-file"
options:
max-size: "200k"
max-file: "10"
web_db:
container_name: voltaire_db # Name of the database container
platform: linux/amd64 # Specify the platform (important for ARM64 architectures)
image: postgres:16.3-alpine3.19 # Use PostgreSQL 12 on Alpine for smaller size
restart: unless-stopped
ports:
- "5434:5432" # Expose port 5432 to the host
environment: # PostgreSQL user, password, and database name
POSTGRES_USER: voltaire
POSTGRES_PASSWORD: postgres
POSTGRES_DB: 1694
volumes:
- db-data:/var/lib/postgresql/data/ # Persistent storage for the database
networks:
- io-1694 # Connect to the 'io-1694' network
frontend:
container_name: frontend # Name of the frontend container
build: # Build configuration for the frontend
context: ./frontend
dockerfile: Dockerfile.dev
restart: unless-stopped
env_file:
- ./frontend/.env
ports:
- 3000:3000 # Expose port 3000 to the host
networks:
- io-1694
volumes:
- ./frontend:/app
depends_on:
- backend # Depends on the backend service
cardano-node:
image: ghcr.io/intersectmbo/cardano-node:9.1.1
command: [
"run",
"--config", "/config/config.json",
"--database-path", "/data/db",
"--socket-path", "/ipc/node.socket",
"--topology", "/config/topology.json"
]
volumes:
- ./cardanonode/config/network/${CARDANO_NETWORK:-preview}/cardano-node:/config
- ./cardanonode/config/network/${CARDANO_NETWORK:-preview}/genesis:/genesis
- node-db:/data
- node-ipc:/ipc
restart: on-failure
environment:
CARDANO_NODE_SOCKET_PATH: /ipc/node.socket
logging:
driver: "json-file"
options:
max-size: "400k"
max-file: "20"
healthcheck:
test: [ "CMD", "stat", "/ipc/node.socket" ]
interval: 30s
timeout: 10s
retries: 3
networks:
- io-1694 # Connect to the 'io-1694' network
cardano-db-sync:
image: ghcr.io/intersectmbo/cardano-db-sync:13.5.0.2
environment:
- DISABLE_LEDGER=${DISABLE_LEDGER}
- DB_SYNC_CONFIG=${DB_SYNC_CONFIG:-/config/config.json}
- NETWORK=${CARDANO_NETWORK:-preview}
- POSTGRES_HOST=dbsync_db
- POSTGRES_PORT=5432
- RESTORE_SNAPSHOT=${RESTORE_SNAPSHOT:-}
- RESTORE_RECREATE_DB=N
- EXTRA_DB_SYNC_ARGS=${EXTRA_DB_SYNC_ARGS:-}
depends_on:
# Depend on both services to be healthy before starting.
cardano-node:
condition: service_healthy
dbsync_db:
condition: service_healthy
secrets:
- postgres_password
- postgres_user
- postgres_db
volumes:
- db-sync-data:/var/lib/cexplorer
- node-ipc:/node-ipc
- ./cardanonode/config/network/${CARDANO_NETWORK:-preview}/cardano-db-sync:/config
- ./cardanonode/config/network/${CARDANO_NETWORK:-preview}/genesis:/genesis
restart: on-failure
networks:
- io-1694 # Connect to the 'io-1694' network
logging:
driver: "json-file"
options:
max-size: "200k"
max-file: "10"
adminer:
image: adminer
restart: always
ports:
- 8080:8080
networks:
- io-1694 # Connect to the 'io-1694' network
cypress:
image: cypress/included:cypress-13.13.1-node-20.15.1-chrome-126.0.6478.126-1-ff-128.0-edge-126.0.2592.102-1
# the Docker image to use from https://github.com/cypress-io/cypress-docker-images
# It is however recommended to use a specific image tag to avoid breaking changes when new images are released, especially when they include new major versions of Node.js or Cypress.
depends_on:
- frontend
environment:
# pass base url to test pointing at the web application
- CYPRESS_baseUrl=http://frontend:3000
working_dir: /e2e
networks:
- io-1694
command: ["npx", "cypress", "open",]
restart: unless-stopped
# share the current folder as volume to avoid copying
volumes:
- ./frontend:/e2e
volumes:
db-data:
db-sync-data:
dbsync-db-data:
node-db:
node-ipc:
secrets:
postgres_db:
file: ./config/secrets/postgres_db
postgres_password:
file: ./config/secrets/postgres_password
postgres_user:
file: ./config/secrets/postgres_user
networks:
io-1694:
driver: bridge