forked from icon-project/gochain-local
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
87 lines (87 loc) · 3.05 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
services:
tracker_mysql:
image: looploy/tracker_mysql:20220525
container_name: tracker_mysql
volumes:
- ./data/mysql:/var/lib/mysql
- ./logs/mysql:/var/log/mysql
environment:
TZ: "GMT-9"
ports:
- "3306:3306"
tracker_nginx:
image: 'jinwoo/nginx:1.15.0'
container_name: tracker_nginx
environment:
TZ: "GMT-9"
NGINX_LOG_OUTPUT: 'file'
NGINX_LOG_TYPE: 'main'
NGINX_USER: 'root'
VIEW_CONFIG: "yes"
PROXY_MODE: "yes"
USE_NGINX_THROTTLE: "yes"
NGINX_THROTTLE_BY_URI: "yes"
NGINX_RATE_LIMIT: "300r/s"
NGINX_BURST: "5"
NGINX_SET_NODELAY: "no"
PROXY_PASS_ENDPOINT: 'http://tracker_app:3000'
LOCATION: |
location /score { alias /score/;}
# backend api v0
location /v0 {
proxy_pass http://api_cluster;
}
# backend api v3
location /v3 {
proxy_pass http://api_cluster;
}
location /api/v3 {
if ($$request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain; charset=utf-8';
add_header 'Content-Length' 0;
return 204;
}
if ($$request_method = 'POST') {
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
}
if ($$request_method = 'GET') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
}
proxy_pass ${PEER_TYPE}://loop_cluster;
}
USE_DEFAULT_SERVER_CONF: |
upstream api_cluster {
server tracker_app:8080;
}
upstream loop_cluster {
server ${PEER_IPADDR};
}
ports:
- '80:80'
extra_hosts:
- 'host.docker.internal:host-gateway'
volumes:
- ./logs/nginx:/var/log/nginx/
- ./score:/score
tracker_app:
image: iconloop/tracker:20220720
container_name: tracker_app
volumes:
- ./score:/score
- ./logs/tracker:/home/ubuntu/logs
command: sh /start.sh
extra_hosts:
- 'host.docker.internal:host-gateway'
environment:
TZ: "GMT-9"
PEER_TYPE: ${PEER_TYPE}
PEER_IPADDR: ${PEER_IPADDR}