Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
168 lines (158 loc) · 4.94 KB
/
Copy pathdocker-compose.yml
File metadata and controls
168 lines (158 loc) · 4.94 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
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
# Local full-stack environment: Postgres, backend (+ migrations), frontend and
# the monitoring stack.
#
# The Dockerfiles live in this repo, but the application source lives in the
# SynapsVault/backend and SynapsVault/frontend repos. Clone them next to this
# repo (or point BACKEND_SRC / FRONTEND_SRC at them) and run compose from this
# repo's root directory:
#
# git clone https://github.com/SynapsVault/backend ../backend
# git clone https://github.com/SynapsVault/frontend ../frontend
# cp .env.example .env
# docker compose up --build
services:
postgres:
image: postgres:15-alpine
container_name: app_postgres
restart: unless-stopped
environment:
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
POSTGRES_DB: ${POSTGRES_DB:-app}
ports:
- "${POSTGRES_PORT:-5432}:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres} -d ${POSTGRES_DB:-app}"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
networks:
- app_network
# One-shot: applies Drizzle migrations, then exits.
migrate:
build:
context: ${BACKEND_SRC:-../backend}
dockerfile: ${PWD}/backend/Dockerfile
target: migrate
container_name: app_migrate
environment:
DATABASE_URL: postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-postgres}@postgres:5432/${POSTGRES_DB:-app}
depends_on:
postgres:
condition: service_healthy
networks:
- app_network
backend:
build:
context: ${BACKEND_SRC:-../backend}
dockerfile: ${PWD}/backend/Dockerfile
target: runtime
container_name: app_backend
restart: unless-stopped
env_file:
- path: .env
required: false
environment:
PORT: 3000
DATABASE_URL: postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-postgres}@postgres:5432/${POSTGRES_DB:-app}
ports:
- "${BACKEND_PORT:-3000}:3000"
depends_on:
postgres:
condition: service_healthy
migrate:
condition: service_completed_successfully
networks:
- app_network
frontend:
build:
context: ${FRONTEND_SRC:-../frontend}
dockerfile: ${PWD}/frontend/Dockerfile
args:
# Inlined into the bundle at build time; the browser calls the backend
# directly on its published port.
VITE_API_URL: ${VITE_API_URL:-http://localhost:3000}
VITE_NETWORK: ${VITE_STELLAR_NETWORK:-testnet}
container_name: app_frontend
restart: unless-stopped
ports:
- "${FRONTEND_PORT:-8080}:80"
depends_on:
backend:
condition: service_started
networks:
- app_network
postgres-exporter:
image: quay.io/prometheuscommunity/postgres-exporter:v0.15.0
container_name: app_postgres_exporter
restart: unless-stopped
environment:
DATA_SOURCE_NAME: postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-postgres}@postgres:5432/${POSTGRES_DB:-app}?sslmode=disable
depends_on:
postgres:
condition: service_healthy
networks:
- app_network
prometheus:
image: prom/prometheus:v2.53.2
container_name: app_prometheus
restart: unless-stopped
volumes:
- ./monitoring/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- ./monitoring/alert-rules.yml:/etc/prometheus/alert-rules.yml:ro
- prometheus_data:/prometheus
command:
- "--config.file=/etc/prometheus/prometheus.yml"
- "--storage.tsdb.path=/prometheus"
- "--web.enable-lifecycle"
ports:
- "${PROMETHEUS_PORT:-9090}:9090"
depends_on:
backend:
condition: service_started
networks:
- app_network
alertmanager:
image: prom/alertmanager:v0.27.0
container_name: app_alertmanager
restart: unless-stopped
volumes:
- ./monitoring/alertmanager.yml:/etc/alertmanager/alertmanager.yml:ro
- alertmanager_data:/alertmanager
command:
- "--config.file=/etc/alertmanager/alertmanager.yml"
- "--storage.path=/alertmanager"
ports:
- "${ALERTMANAGER_PORT:-9093}:9093"
networks:
- app_network
grafana:
image: grafana/grafana:11.2.0
container_name: app_grafana
restart: unless-stopped
environment:
GF_SECURITY_ADMIN_USER: ${GRAFANA_ADMIN_USER:-admin}
GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_ADMIN_PASSWORD:-admin}
GF_USERS_ALLOW_SIGN_UP: "false"
volumes:
- grafana_data:/var/lib/grafana
- ./monitoring/grafana/provisioning:/etc/grafana/provisioning:ro
- ./monitoring/grafana-dashboard.json:/var/lib/grafana/dashboards/backend-overview.json:ro
ports:
- "${GRAFANA_PORT:-3001}:3000"
depends_on:
prometheus:
condition: service_started
networks:
- app_network
volumes:
postgres_data:
prometheus_data:
alertmanager_data:
grafana_data:
networks:
app_network:
driver: bridge