-
Notifications
You must be signed in to change notification settings - Fork 48
/
docker-compose.yml
178 lines (167 loc) · 5.48 KB
/
docker-compose.yml
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
version: '3.7'
services:
api:
image: ghcr.io/podkrepi-bg/api:master
profiles: ['api-docker']
container_name: ${COMPOSE_PROJECT_NAME?}-api
restart: always
environment:
PORT: ${API_PORT?}
TARGET_APP: api
DATABASE_URL: postgres://${DB_USER?}:${DB_PASS?}@${DB_HOST?}:${DB_PORT?}/${DB_NAME?}?schema=api
KEYCLOAK_URL: ${KEYCLOAK_URL?}
KEYCLOAK_REALM: ${KEYCLOAK_REALM?}
KEYCLOAK_CLIENT_ID: ${KEYCLOAK_CLIENT_ID?}
KEYCLOAK_SECRET: ${KEYCLOAK_SECRET?}
SENTRY_DSN: ${SENTRY_DSN?}
SENTRY_ORG: ${SENTRY_ORG?}
SENTRY_PROJECT: ${SENTRY_PROJECT?}
SENTRY_AUTH_TOKEN: ${SENTRY_AUTH_TOKEN?}
SENTRY_SERVER_ROOT_DIR: ${SENTRY_SERVER_ROOT_DIR?}
SENDGRID_API_KEY: ${SENDGRID_API_KEY?}
SENDGRID_SENDER_EMAIL: ${SENDGRID_SENDER_EMAIL?}
SENDGRID_INTERNAL_EMAIL: ${SENDGRID_INTERNAL_EMAIL?}
SENDGRID_CONTACTS_URL: ${SENDGRID_CONTACTS_URL?}
STRIPE_SECRET_KEY: ${STRIPE_SECRET_KEY?}
STRIPE_WEBHOOK_SECRET: ${STRIPE_WEBHOOK_SECRET?}
S3_REGION: ${S3_REGION?}
S3_ENDPOINT: ${S3_ENDPOINT?}
S3_ACCESS_KEY: ${S3_ACCESS_KEY?}
S3_SECRET_ACCESS_KEY: ${S3_SECRET_ACCESS_KEY?}
PAYPAL_URL: ${PAYPAL_URL?}
PAYPAL_CLIENT_ID: ${PAYPAL_CLIENT_ID?}
PAYPAL_CLIENT_SECRET: ${PAYPAL_CLIENT_SECRET?}
PAYPAL_WEBHOOK_ID: ${PAYPAL_WEBHOOK_ID?}
ports:
- '${API_PORT?}:${API_PORT?}'
depends_on:
- pg-db
networks:
backend-net:
aliases:
- api.podkrepi.localhost
## Postgres Development ##
migrate-db:
image: ghcr.io/podkrepi-bg/api/migrations:master
build:
context: .
dockerfile: ./Dockerfile.migrations
container_name: ${COMPOSE_PROJECT_NAME?}-migrate-db
restart: 'no'
environment:
DATABASE_URL: postgres://${DB_USER?}:${DB_PASS?}@${DB_HOST?}:${DB_PORT?}/${DB_NAME?}?schema=api
entrypoint: ['sh', '-c', 'sleep 5 && yarn prisma migrate deploy']
depends_on:
- pg-db
networks:
backend-net:
aliases:
- api.podkrepi.localhost
seed-db:
image: ghcr.io/podkrepi-bg/api/seed:master
build:
context: .
dockerfile: ./Dockerfile.migrations
container_name: ${COMPOSE_PROJECT_NAME?}-seed-db
restart: 'no'
environment:
DATABASE_URL: postgres://${DB_USER?}:${DB_PASS?}@${DB_HOST?}:${DB_PORT?}/${DB_NAME?}?schema=api
entrypoint: ['sh', '-c', 'sleep 15 && yarn prisma generate && yarn prisma db seed']
depends_on:
- pg-db
networks:
- backend-net
## Postgres Development ##
##########################
pg-db:
build:
context: ./db
dockerfile: ./Dockerfile
container_name: ${COMPOSE_PROJECT_NAME?}-pg-db
restart: always
volumes:
# Keycloak creates it's own /data and /conf folders
- keycloak-db-data:/var/lib/keycloak
- pg-db-data:/var/lib/postgresql/data
ports:
- '${DB_PORT?}:5432'
environment:
## https://hub.docker.com/_/postgres/
PGPASSWORD: ${DB_PASS?}
POSTGRES_USER: ${DB_USER?}
POSTGRES_PASSWORD: ${DB_PASS?}
POSTGRES_DB: ${DB_NAME?}
networks:
- backend-net
## Stripe Development ##
##########################
stripe-webhook:
image: stripe/stripe-cli:latest
restart: always
command:
[
'listen',
'--api-key',
'${STRIPE_SECRET_KEY}',
'--forward-to',
'localhost:5010/api/v1/stripe/webhook',
]
########################################
## LOCAL IDENTITY PROVIDER - KEYCLOAK ##
########################################
## Keycloak Server ##
#####################
keycloak:
container_name: ${COMPOSE_PROJECT_NAME?}-keycloak
image: quay.io/keycloak/keycloak:18.0.1-legacy
profiles: ['local-keycloak']
restart: always
environment:
- KEYCLOAK_USER=${KEYCLOAK_USER?}
- KEYCLOAK_PASSWORD=${KEYCLOAK_PASSWORD?}
- JAVA_OPTS_APPEND=-Dkeycloak.profile.feature.token_exchange=enabled -Dkeycloak.profile.feature.admin_fine_grained_authz=enabled
- KEYCLOAK_IMPORT=/opt/jboss/keycloak/config/keycloak-webapp-realm.json
- DEBUG=true
- DEBUG_PORT='*:8787'
- DB_VENDOR=${KEYCLOAK_DB_VENDOR?}
- DB_USER=${KEYCLOAK_DB_USER?}
- DB_PASSWORD=${KEYCLOAK_DB_PASSWORD?}
- DB_ADDR=${COMPOSE_PROJECT_NAME?}-pg-db
- DB_DATABASE=${KEYCLOAK_DB_NAME?}
ports:
- '8180:8080'
- '8787:8787'
volumes:
- './manifests/keycloak/theme_podkrepi:/opt/jboss/keycloak/themes/theme_podkrepi'
- './manifests/keycloak/config:/opt/jboss/keycloak/config'
depends_on:
- pg-db
networks:
- backend-net
# ## KEYCLOAK CONFIGURATOR - removes the need to recreate keycloak container upon config changes
# ## uncomment if you plan to tune the keycloak realm configuration
# ## usage: docker-compose up --build -d keycloak-config
# keycloak-config:
# container_name: ${COMPOSE_PROJECT_NAME?}-keycloak-config
# image: bitnami/keycloak-config-cli:latest
# profiles: ['local-keycloak']
# depends_on:
# - keycloak
# volumes:
# - './manifests/keycloak/config:/opt/bitnami/keycloak/config'
# environment:
# - keycloak.url=http://keycloak:8080/auth
# - keycloak.user=admin
# - keycloak.password=admin
# - keycloak.availability-check.enabled=true
# - import.cache.enabled=false
# - import.path=/opt/bitnami/keycloak/config
# networks:
# backend-net:
volumes:
pg-db-data:
driver: local
keycloak-db-data:
driver: local
networks:
backend-net: