-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
104 lines (95 loc) · 2.87 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
# This is local config.
# It allow to run database, ejabberd, kratos and mailslurper in docker environment
# but main application should be runnig manualy to simplify development. All configs
# for this environment contiain "localhost" instead of docker hosts aliases and
# connect with outerworld via "host.docker.internal:host-gateway".
# To run everything in docker configuration should be changed!
name: chatapp
volumes:
postgres_data:
postgres_ejabberd_data:
networks:
intranet:
services:
postgres:
image: postgres:15
environment:
- POSTGRES_USER=chatuser
- POSTGRES_PASSWORD=chatpassword
- POSTGRES_MULTIPLE_DATABASES=kratos,ejabberd
ports:
- 5432:5432
volumes:
- ./config/db/:/docker-entrypoint-initdb.d/
- postgres_data:/var/lib/postgresql/data/
healthcheck:
test: ["CMD-SHELL", "pg_isready -U chatuser -d postgres"]
interval: 5s
timeout: 5s
retries: 5
networks:
- intranet
kratos-migrate:
image: oryd/kratos:v1.2.0
environment:
# we do not need to create separate "kratos" schema in this database yet.
# - DSN=postgres://muser:mpassword@postgres:5432/kratos?sslmode=disable&max_conns=20&max_idle_conns=4&search_path=kratos
- DSN=postgres://chatuser:chatpassword@postgres:5432/kratos?sslmode=disable&max_conns=20&max_idle_conns=4
volumes:
- ./config/kratos:/etc/config/kratos
command: -c /etc/config/kratos/kratos.yml migrate sql -e --yes
networks:
- intranet
kratos:
image: oryd/kratos:v1.2.0
env_file:
- .env
ports:
- 4433:4433
- 4434:4434
volumes:
- ./config/kratos:/etc/config/kratos
command: serve -c /etc/config/kratos/kratos.yml --dev --watch-courier
networks:
- intranet
extra_hosts:
- "host.docker.internal:host-gateway"
ejabberd:
image: ejabberd/ecs:23.10
restart: on-failure
ports:
- 5222:5222 # client to server
- 5280:5280 # web console
# - websocket
environment:
- CTL_ON_CREATE=register ${EJABBERD_ADMIN_USERNAME} localhost ${EJABBERD_ADMIN_PASSWORD}
volumes:
- ./config/ejabberd/config/ejabberd.yml:/home/ejabberd/conf/ejabberd.yml
depends_on:
migrate_ejabberd_db:
condition: service_completed_successfully
networks:
- intranet
# Migration task. Create schema in the database before ejabberd starts
migrate_ejabberd_db:
build: ./config/ejabberd/migrate
environment:
- DB_HOST=postgres
- DB_NAME=ejabberd
- DB_USER=chatuser
- PGPASSWORD=chatpassword
restart: on-failure
volumes:
- postgres_ejabberd_data:/var/lib/postgresql/data/
depends_on:
postgres:
condition: service_healthy
networks:
- intranet
mailslurper:
image: oryd/mailslurper:latest-smtps
ports:
- 4436:4436
- 4437:4437
networks:
- intranet