-
Notifications
You must be signed in to change notification settings - Fork 7
/
docker-compose.postgres.test.yml
137 lines (130 loc) · 3.86 KB
/
docker-compose.postgres.test.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
version: '2.3'
networks:
app_external_network:
app_internal_network:
internal: true
services:
app_backend:
build:
context: ./
dockerfile: ${DOCKERFILE_PATH}
args:
- VERSION=${TAG}
- VCS_REF=${VCS_REF}
- BUILD_DATE=${BUILD_DATE}
image: ${IMAGE_NAME}
container_name: app_backend
# [TODO] Enable auto-restart when production-ready
#restart: always
healthcheck:
test: CMD curl -v --silent http://localhost:${APP_SERVER_PORT}/${APP_SERVER_CONTEXT_PATH}/health 2>&1 | grep UP
interval: 1m30s
timeout: 10s
retries: 3
#start_period: 40s
ports:
- "8080:${APP_SERVER_PORT}"
networks:
- app_internal_network
- app_external_network
depends_on:
app_db:
condition: service_healthy
app_mailer:
condition: service_started
volumes:
- ${APP_HOME}_postgres/back/logs:/srv/app/logs
- ${APP_HOME}_postgres/back/keys:/srv/app/keys
- ${APP_HOME}_postgres/back/config:/srv/app/config
- ${APP_HOME}_postgres/back/data:/srv/app/data
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
environment:
# Application configuration
- APP_SERVER_PORT=${APP_SERVER_PORT}
- APP_SERVER_CONTEXT_PATH=/${APP_SERVER_CONTEXT_PATH}
- APP_TITLE=${APP_TITLE}
- APP_DOMAIN_NAME=${APP_DOMAIN_NAME}
- APP_ADMIN_PASSWORD=${APP_ADMIN_PASSWORD}
- APP_SIGNING_KEY=
- APP_SIGNING_KEYPAIR_PASS=${APP_SIGNING_KEYPAIR_PASS}
- APP_DEMO_DATA=true
# Database configuration (PostgreSQL)
- DB_PLATFORM=postgresql
- DB_HOST=app_db
- DB_PORT=5432
- DB_NAME=${APP_DB_NAME}
- DB_USER=${APP_DB_USER}
- DB_PASSWORD=${APP_DB_PASSWORD}
# Mail configuration
- MAIL_HOST=app_mailer
- MAIL_PORT=1025
- MAIL_PROTOCOL=smtp
- MAIL_USER=${APP_SMTP_USER}
- MAIL_PASSWORD=${APP_SMTP_PASSWD}
- MAIL_SSL=false
- MAIL_STARTTLS=false
# Wait for it...
- WAIT_FOR=app_db:5432
app_db:
image: postgres:10-alpine
container_name: app_db
# [TODO] Enable auto-restart when production-ready
#restart: always
healthcheck:
test: ["CMD", "pg_isready", "-U", "${APP_DB_USER}"]
expose:
- 5432
#ports:
# - "5432:5432"
networks:
- app_internal_network
volumes:
- ${APP_HOME}_postgres/db/data:/var/lib/postgresql/data
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
environment:
- POSTGRES_DB=${APP_DB_NAME}
- POSTGRES_USER=${APP_DB_USER}
- POSTGRES_PASSWORD=${APP_DB_PASSWORD}
# You can also add a web server (like NGinx or Apache) to serve as reverse proxy and enforce HTTPS
# Test services (do not use in production)
# https://docs.docker.com/docker-hub/builds/automated-testing/
sut:
build:
context: ./docker/test
dockerfile: Dockerfile
command: sh /docker_test.sh
networks:
- app_internal_network
- app_external_network
depends_on:
app_backend:
condition: service_started
environment:
- DOCKER_TEST_CONTAINER=app_backend
- DOCKER_WEB_CONTAINER=app_backend
- DOCKER_WEB_PORT=${APP_SERVER_PORT}
- DOCKER_WEB_HEALTH_API=${APP_SERVER_CONTEXT_PATH}/health
volumes_from:
- app_backend
# If you want, you can sync time & timezone with host
#volumes:
# - /etc/localtime:/etc/localtime:ro
# - /etc/timezone:/etc/timezone:ro
app_mailer:
image: sj26/mailcatcher:latest
hostname: app_mailer
container_name: app_mailer
restart: always
expose:
- '1025'
ports:
- "1080:1080"
networks:
- app_internal_network
- app_external_network
# If you want, you can sync time & timezone with host
#volumes:
# - /etc/localtime:/etc/localtime:ro
# - /etc/timezone:/etc/timezone:ro