Yan / ERPNext

Last active 19 hours ago

Like 0

https://github.com/frappe/erpnext

ERPNext Raw
1x-erpnext: &erpnext
2 image: frappe/erpnext:latest
3 security_opt:
4 - no-new-privileges:true
5 volumes:
6 - sites:/home/frappe/frappe-bench/sites
7 - logs:/home/frappe/frappe-bench/logs
8
9services:
10 db:
11 image: mariadb:10.6
12 container_name: ERPNext-DB
13 hostname: db
14 security_opt:
15 - no-new-privileges:true
16 healthcheck:
17 test: ["CMD-SHELL", "mysqladmin ping -h localhost --password=$$MARIADB_ROOT_PASSWORD"]
18 interval: 10s
19 timeout: 5s
20 retries: 10
21 command:
22 - --character-set-server=utf8mb4
23 - --collation-server=utf8mb4_unicode_ci
24 - --skip-character-set-client-handshake
25 - --skip-innodb-read-only-compressed
26 environment:
27 MARIADB_ROOT_PASSWORD: CHANGE-ME-DB-ROOT
28 volumes:
29 - /volume1/docker/erpnext/db:/var/lib/mysql:rw
30 restart: on-failure:5
31
32 redis-cache:
33 image: redis:6.2-alpine
34 container_name: ERPNext-REDIS-CACHE
35 hostname: redis-cache
36 security_opt:
37 - no-new-privileges:true
38 healthcheck:
39 test: ["CMD", "redis-cli", "ping"]
40 interval: 10s
41 timeout: 5s
42 retries: 5
43 restart: on-failure:5
44
45 redis-queue:
46 image: redis:6.2-alpine
47 container_name: ERPNext-REDIS-QUEUE
48 hostname: redis-queue
49 security_opt:
50 - no-new-privileges:true
51 healthcheck:
52 test: ["CMD", "redis-cli", "ping"]
53 interval: 10s
54 timeout: 5s
55 retries: 5
56 volumes:
57 - redis-queue:/data
58 restart: on-failure:5
59
60 configurator:
61 <<: *erpnext
62 container_name: ERPNext-CONFIGURATOR
63 entrypoint: ["bash", "-c"]
64 command:
65 - >
66 ls -1 apps > sites/apps.txt;
67 bench set-config -g db_host $$DB_HOST;
68 bench set-config -gp db_port $$DB_PORT;
69 bench set-config -g redis_cache "redis://$$REDIS_CACHE";
70 bench set-config -g redis_queue "redis://$$REDIS_QUEUE";
71 bench set-config -g redis_socketio "redis://$$REDIS_QUEUE";
72 bench set-config -gp socketio_port $$SOCKETIO_PORT;
73 environment:
74 DB_HOST: db
75 DB_PORT: "3306"
76 REDIS_CACHE: redis-cache:6379
77 REDIS_QUEUE: redis-queue:6379
78 SOCKETIO_PORT: "9000"
79 depends_on:
80 db:
81 condition: service_healthy
82 redis-cache:
83 condition: service_healthy
84 redis-queue:
85 condition: service_healthy
86 restart: "no"
87
88 create-site:
89 <<: *erpnext
90 container_name: ERPNext-CREATE-SITE
91 entrypoint: ["bash", "-c"]
92 command:
93 - >
94 wait-for-it -t 120 db:3306;
95 wait-for-it -t 120 redis-cache:6379;
96 wait-for-it -t 120 redis-queue:6379;
97 export start=`date +%s`;
98 until [[ -n `grep -hs ^ sites/common_site_config.json | jq -r ".db_host // empty"` ]] &&
99 [[ -n `grep -hs ^ sites/common_site_config.json | jq -r ".redis_cache // empty"` ]] &&
100 [[ -n `grep -hs ^ sites/common_site_config.json | jq -r ".redis_queue // empty"` ]];
101 do
102 echo "Waiting for sites/common_site_config.json";
103 sleep 5;
104 if (( `date +%s`-start > 120 )); then
105 echo "common_site_config.json not found";
106 exit 1;
107 fi;
108 done;
109 bench new-site --mariadb-user-host-login-scope='%'
110 --admin-password=CHANGE-ME-ADMIN
111 --db-root-username=root
112 --db-root-password=CHANGE-ME-DB-ROOT
113 --install-app erpnext
114 --set-default frontend;
115 depends_on:
116 configurator:
117 condition: service_completed_successfully
118 restart: "no"
119
120 backend:
121 <<: *erpnext
122 container_name: ERPNext-BACKEND
123 hostname: backend
124 depends_on:
125 configurator:
126 condition: service_completed_successfully
127 restart: on-failure:5
128
129 websocket:
130 <<: *erpnext
131 container_name: ERPNext-WEBSOCKET
132 hostname: websocket
133 command:
134 - node
135 - /home/frappe/frappe-bench/apps/frappe/socketio.js
136 depends_on:
137 configurator:
138 condition: service_completed_successfully
139 restart: on-failure:5
140
141 queue:
142 <<: *erpnext
143 container_name: ERPNext-QUEUE
144 hostname: queue
145 command: bench worker --queue short,default,long
146 depends_on:
147 configurator:
148 condition: service_completed_successfully
149 restart: on-failure:5
150
151 scheduler:
152 <<: *erpnext
153 container_name: ERPNext-SCHEDULER
154 hostname: scheduler
155 command: bench schedule
156 depends_on:
157 configurator:
158 condition: service_completed_successfully
159 restart: on-failure:5
160
161 frontend:
162 <<: *erpnext
163 container_name: ERPNext-FRONTEND
164 hostname: frontend
165 command: nginx-entrypoint.sh
166 ports:
167 - 8087:8080
168 environment:
169 BACKEND: backend:8000
170 SOCKETIO: websocket:9000
171 FRAPPE_SITE_NAME_HEADER: frontend
172 UPSTREAM_REAL_IP_ADDRESS: 127.0.0.1
173 UPSTREAM_REAL_IP_HEADER: X-Forwarded-For
174 UPSTREAM_REAL_IP_RECURSIVE: "off"
175 PROXY_READ_TIMEOUT: "120"
176 CLIENT_MAX_BODY_SIZE: 50m
177 depends_on:
178 - backend
179 - websocket
180 restart: on-failure:5
181
182volumes:
183 sites:
184 logs:
185 redis-queue: