-
Notifications
You must be signed in to change notification settings - Fork 29
/
docker-compose-erpnext.yml
234 lines (216 loc) · 7.56 KB
/
docker-compose-erpnext.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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
version: "3.7"
x-erpnext-image: &erpnext-image
image: frappe/erpnext:v15.12.2
platform: linux/amd64
x-redis-image: &redis-image
image: redis:6.2-alpine
x-ozone-networks: &ozone-networks
networks:
- ozone
- web
x-erpnext-volumes: &erpnext-volumes
volumes:
- erpnext-sites:/home/frappe/frappe-bench/sites
- erpnext-logs:/home/frappe/frappe-bench/logs
services:
erpnext-backend:
<<: [ *erpnext-image, *erpnext-volumes, *ozone-networks ]
restart: unless-stopped
erpnext-configurator:
<<: [ *erpnext-image, *erpnext-volumes, *ozone-networks ]
command:
- >
ls -1 apps > sites/apps.txt;
bench set-config -g db_host $$DB_HOST;
bench set-config -gp db_port $$DB_PORT;
bench set-config -g redis_cache "redis://$$REDIS_CACHE";
bench set-config -g redis_queue "redis://$$REDIS_QUEUE";
bench set-config -g redis_socketio "redis://$$REDIS_QUEUE";
bench set-config -gp socketio_port $$SOCKETIO_PORT;
entrypoint:
- bash
- -c
environment:
DB_HOST: mysql
DB_PORT: "3306"
REDIS_CACHE: erpnext-redis-cache:6379
REDIS_QUEUE: erpnext-redis-queue:6379
SOCKETIO_PORT: "9000"
erpnext-init:
<<: [ *erpnext-image, *ozone-networks ]
command:
- >
wait-for-it -t 120 mysql:3306;
wait-for-it -t 120 erpnext-redis-cache:6379;
wait-for-it -t 120 erpnext-redis-queue:6379;
export start=`date +%s`;
until [[ -n `grep -hs ^ sites/common_site_config.json | jq -r ".db_host // empty"` ]] && \
[[ -n `grep -hs ^ sites/common_site_config.json | jq -r ".redis_cache // empty"` ]] && \
[[ -n `grep -hs ^ sites/common_site_config.json | jq -r ".redis_queue // empty"` ]];
do
echo "Waiting for sites/common_site_config.json to be created";
sleep 5;
if (( `date +%s`-start > 120 )); then
echo "could not find sites/common_site_config.json with required keys";
exit 1
fi
done;
echo "sites/common_site_config.json found";
echo "Creating new site";
bench new-site --no-mariadb-socket --admin-password=$$ERPNEXT_ADMIN_PASSWORD --db-root-password=$$MYSQL_ADMIN_PASSWORD --db-name=$$ERPNEXT_DB_NAME --source_sql=/opt/erpnext/configs/sql/erpnext-v15.12.2-init-db.sql --install-app erpnext --set-default ozone-erpnext;
echo "==============================================================";
export startTime=`date +%s`;
until [[ -f sites/ozone-erpnext/site_config.json ]];
do
echo "Waiting for sites/ozone-erpnext/site_config.json to be created";
sleep 5;
if (( `date +%s`-startTime > 480 )); then
echo "could not find sites/ozone-erpnext/site_config.json";
exit 1
fi
done;
echo "Site fully initialized";
echo "Running data-import.sh script to import data into the new site";
source /opt/erpnext/scripts/data-import.sh;
echo "==============================================================";
depends_on:
erpnext-configurator:
condition: service_completed_successfully
mysql:
condition: service_started
erpnext-redis-cache:
condition: service_started
erpnext-redis-queue:
condition: service_started
entrypoint:
- bash
- -c
environment:
ERPNEXT_ADMIN_PASSWORD: ${ERPNEXT_PASSWORD}
MYSQL_ADMIN_PASSWORD: ${MYSQL_ROOT_PASSWORD}
ERPNEXT_DB_NAME: ${ERPNEXT_DB_NAME}
volumes:
- erpnext-sites:/home/frappe/frappe-bench/sites
- erpnext-logs:/home/frappe/frappe-bench/logs
- "${ERPNEXT_CONFIG_PATH}:/opt/erpnext/configs"
- "${ERPNEXT_SCRIPTS_PATH}:/opt/erpnext/scripts"
erpnext:
<<: [ *erpnext-image, *erpnext-volumes, *ozone-networks ]
command:
- nginx-entrypoint.sh
depends_on:
erpnext-websocket:
condition: service_started
erpnext-init:
condition: service_completed_successfully
mysql:
condition: service_started
env-substitution:
condition: service_completed_successfully
restart: on-failure
environment:
BACKEND: erpnext-backend:8000
FRAPPE_SITE_NAME_HEADER: ozone-erpnext
SOCKETIO: erpnext-websocket:9000
UPSTREAM_REAL_IP_ADDRESS: 127.0.0.1
UPSTREAM_REAL_IP_HEADER: X-Forwarded-For
UPSTREAM_REAL_IP_RECURSIVE: "off"
PROXY_READ_TIMEOUT: 120
CLIENT_MAX_BODY_SIZE: 50m
labels:
traefik.enable: "true"
traefik.http.routers.erpnext.rule: "Host(`${ERPNEXT_HOSTNAME}`)"
traefik.http.routers.erpnext.entrypoints: "websecure"
traefik.http.services.erpnext.loadbalancer.server.port: 8080
erpnext-queue-long:
<<: [ *erpnext-image, *erpnext-volumes, *ozone-networks ]
command:
- bench
- worker
- --queue
- long,default,short
restart: on-failure
erpnext-queue-short:
<<: [ *erpnext-image, *erpnext-volumes, *ozone-networks ]
command:
- bench
- worker
- --queue
- short,default
restart: on-failure
erpnext-redis-queue:
<<: [ *redis-image, *ozone-networks ]
restart: on-failure
volumes:
- erpnext-redis-queue-data:/data
erpnext-redis-cache:
<<: [ *redis-image, *ozone-networks ]
restart: on-failure
volumes:
- erpnext-redis-cache-data:/data
erpnext-scheduler:
<<: [ *erpnext-image, *erpnext-volumes, *ozone-networks ]
command:
- bench
- schedule
restart: on-failure
erpnext-websocket:
<<: [ *erpnext-image, *erpnext-volumes, *ozone-networks ]
command:
- node
- /home/frappe/frappe-bench/apps/frappe/socketio.js
restart: on-failure
eip-erpnext-openmrs:
<<: [ *ozone-networks ]
depends_on:
env-substitution:
condition: service_completed_successfully
openmrs:
condition: service_healthy
mysql:
condition: service_started
erpnext:
condition: service_started
environment:
- ERPNEXT_SERVER_URL=http://erpnext:8080/api
- ERPNEXT_USERNAME=${ERPNEXT_USER}
- ERPNEXT_PASSWORD=${ERPNEXT_PASSWORD}
- ERPNEXT_OPENMRS_ENABLE_PATIENT_SYNC=false
- EIP_DB_NAME_ERPNEXT=${EIP_DB_NAME_ERPNEXT}
- EIP_DB_USER_ERPNEXT=${EIP_DB_USER_ERPNEXT}
- EIP_DB_PASSWORD_ERPNEXT=${EIP_DB_PASSWORD_ERPNEXT}
- EIP_PROFILE=prod
- MYSQL_ADMIN_USER=root
- MYSQL_ADMIN_USER_PASSWORD=${MYSQL_ROOT_PASSWORD}
- OPENMRS_DB_HOST=${OPENMRS_DB_HOST}
- OPENMRS_DB_PORT=${OPENMRS_DB_PORT}
- OPENMRS_DB_NAME=${OPENMRS_DB_NAME}
- OPENMRS_DB_USER=${OPENMRS_DB_USER}
- OPENMRS_DB_PASSWORD=${OPENMRS_DB_PASSWORD}
- EIP_FHIR_RESOURCES=Patient,ServiceRequest,MedicationRequest,Encounter
- EIP_FHIR_SERVER_URL=http://openmrs:8080/openmrs/ws/fhir2/R4
- EIP_FHIR_USERNAME=${OPENMRS_USER}
- EIP_FHIR_PASSWORD=${OPENMRS_PASSWORD}
image: mekomsolutions/eip-client
networks:
ozone:
aliases:
- eip-client-erpnext
- eip-erpnext-openmrs
restart: unless-stopped
volumes:
- "${EIP_ERPNEXT_OPENMRS_ROUTES_PATH}:/eip-client/routes"
- eip-home-erpnext:/eip-home
mysql:
environment:
EIP_DB_NAME_ERPNEXT: ${EIP_DB_NAME_ERPNEXT}
EIP_DB_USER_ERPNEXT: ${EIP_DB_USER_ERPNEXT}
EIP_DB_PASSWORD_ERPNEXT: ${EIP_DB_PASSWORD_ERPNEXT}
volumes:
- "${SQL_SCRIPTS_PATH}/mysql/eip-erpnext-openmrs:/docker-entrypoint-initdb.d/db/eip-erpnext-openmrs"
volumes:
erpnext-redis-queue-data: ~
erpnext-redis-cache-data: ~
erpnext-sites: ~
erpnext-logs: ~
eip-home-erpnext: ~