This repository has been archived by the owner on Dec 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcompose.yaml
134 lines (125 loc) · 3.65 KB
/
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
version: '3.9'
services:
web-dev:
image: node:lts-alpine
profiles:
- dev
env_file: web/.env
environment:
NODE_ENV: development
BACKEND_BASE_URL: http://server-dev:3333
REACT_APP_BASE_URL: http://server-dev:3000
restart: on-failure
networks:
- backend
ports:
- '${PORT:-3000}:3000'
volumes:
- ./web:/app
- ./.prettierrc.yaml:/.prettierrc.yaml
working_dir: /app
command: sh -c 'yarn install && yarn start'
# web:
# image: node:lts-alpine
# profiles:
# - prod
# environment:
# - NODE_ENV=production
# restart: unless-stopped
# ports:
# - '80:80'
# # TODO transpile and serve
server-dev:
image: node:lts-alpine
profiles:
- dev
depends_on:
- postgres
- redis
env_file: server/.env
environment:
NODE_ENV: development
PORT: 3333
restart: on-failure
ports:
- '${PORT:-3333}:3333'
networks:
- backend
volumes:
- ./server:/app
- ./.prettierrc.yaml:/.prettierrc.yaml
working_dir: /app
command: sh -c 'yarn install && yarn typeorm migration:run && yarn typeorm migration:run --connection test && echo "## MIGRATIONS RAN ON TEST DB##" || echo "## MIGRATIONS FAILED TO RUN ON TEST DB. If you want to deploy the test database, pass the `--profile test` flag##" ; (yarn dev:queue & yarn dev:server)'
# server:
# image: node:lts-alpine
# profiles:
# - prod
# env_file: server/.env
# environment:
# - NODE_ENV=production
# # Treasury bond database
# - DB_TYPE=postgres
# - DB_HOST=postgres
# - DB_PORT=5432
# - DB_USERNAME=${DB_USERNAME} # TODO Change to required without breaking dev build
# # - DB_USERNAME=${DB_USERNAME?}
# - DB_PASSWORD=${DB_PASSWORD} # Change to required without breaking dev build
# # - DB_PASSWORD=${DB_PASSWORD?}
# - DB_DATABASE=${DB_USERNAME} # Change to required without breaking dev build
# # - DB_DATABASE=${DB_USERNAME?}
# # JWT secret for password hashing
# - JWT_SECRET=${JWT_SECRET} # Change to required without breaking dev build
# # - JWT_SECRET=${JWT_SECRET?}
# - JWT_EXPIRES_IN="1d"
# # Cron schedule for update-all-treasury-bond task
# - UPDATE_CRON=${UPDATE_CRON:-"*/2 * * * *"}
# # Cron schedule for check-all-notifications task
# - NOTIFICATIONS_CRON=${SEVER_NOTIFICATIONS_CRON:-"*/2 * * * *"}
# # Mailing credentials
# - MAIL_HOST=${MAIL_HOST:-smtp.mailtrap.io}
# - MAIL_PORT=${MAIL_PORT:-465}
# - MAIL_USER=${MAIL_USER} # Change to required without breaking dev build
# # - MAIL_USER=${MAIL_USER?}
# - MAIL_PASSWORD=${MAIL_PASSWORD} # Change to required without breaking dev build
# # - MAIL_PASSWORD=${MAIL_PASSWORD?}
# - MAIL_SECURE=false # TODO
# # Redis config
# - REDIS_HOST=redis
# - REDIS_PORT=6379
# - PORT=3333
# restart: unless-stopped
# ports:
# - '${SERVER_PORT:-3333}:3333'
# depends_on:
# - postgres
# - redis
# working_dir: /app
# # TODO transpile and serve
postgres:
image: postgres:alpine
env_file: server/.env
networks:
- backend
volumes:
- db-data:/var/lib/postgresql/data
restart: unless-stopped
postgres_test:
image: postgres:alpine
profiles:
- test
env_file: server/.env.test
networks:
- backend
volumes:
- db-data-test:/var/lib/postgresql/data
restart: unless-stopped
redis:
image: redis:alpine
networks:
- backend
restart: unless-stopped
networks:
backend:
volumes:
db-data:
db-data-test: