Skip to content

Commit ca10b3c

Browse files
Merge pull request #8 from opexdev/release-v1.0.0-beta.3
Release v1.0.0-beta.3
2 parents 0c33c0b + 6b2739b commit ca10b3c

5 files changed

Lines changed: 58 additions & 86 deletions

File tree

.github/workflows/dev.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ jobs:
1515
- name: Build Docker images
1616
env:
1717
TAG: dev
18-
EXPOSED_PORT: 8443
1918
run: docker-compose build
2019
- name: Login to GitHub Container Registry
2120
uses: docker/login-action@v1

.github/workflows/main.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ jobs:
1515
- name: Build Docker images
1616
env:
1717
TAG: latest
18-
EXPOSED_PORT: 443
1918
run: docker-compose build
2019
- name: Login to GitHub Container Registry
2120
uses: docker/login-action@v1

Dockerfile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
FROM nginx:1.20.2
2-
COPY nginx.conf /etc/nginx/
3-
ARG EXPOSED_PORT=443
4-
ENV EXPOSED_PORT $EXPOSED_PORT
5-
RUN envsubst '\$EXPOSED_PORT' < /etc/nginx/nginx.conf | tee /etc/nginx/nginx.conf
2+
COPY nginx.conf /etc/nginx/nginx.conf.org
3+
ENV EXPOSED_PORT 443
4+
ENTRYPOINT sh -c 'envsubst \$EXPOSED_PORT < /etc/nginx/nginx.conf.org | tee /etc/nginx/nginx.conf && nginx -g "daemon off;"'
65
EXPOSE 443

docker-compose.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ version: '3.8'
22
services:
33
nginx:
44
image: ghcr.io/opexdev/nginx:$TAG
5-
build:
6-
context: .
7-
args:
8-
- EXPOSED_PORT=$EXPOSED_PORT
5+
build: .
6+
environment:
7+
- EXPOSED_PORT=$EXPOSED_PORT

nginx.conf

Lines changed: 52 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -18,61 +18,13 @@ http {
1818
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
1919
ssl_ciphers HIGH:!aNULL:!MD5;
2020

21-
upstream docker-wallet {
22-
server wallet:8080;
23-
}
24-
25-
upstream docker-auth {
26-
server auth:8080;
27-
}
28-
29-
upstream docker-matching-gateway {
30-
server matching-gateway:8080;
31-
}
32-
33-
upstream docker-api {
34-
server api:8080;
35-
}
36-
37-
upstream docker-storage {
38-
server storage:8080;
39-
}
40-
41-
upstream docker-websocket {
42-
server websocket:8080;
43-
}
44-
45-
upstream docker-admin {
46-
server admin:8080;
47-
}
48-
49-
upstream docker-web-app {
50-
server web-app:80;
51-
}
52-
53-
upstream docker-admin-panel {
54-
server admin-panel:80;
55-
}
56-
57-
upstream docker-ipg {
58-
server payment:8080;
59-
}
60-
61-
upstream docker-referral {
62-
server referral:8080;
63-
}
64-
65-
upstream docker-captcha {
66-
server captcha:8080;
67-
}
68-
6921
proxy_hide_header Access-Control-Allow-Credentials;
7022
proxy_hide_header Access-Control-Allow-Origin;
7123
proxy_hide_header Access-Control-Allow-Headers;
7224
proxy_hide_header Access-Control-Allow-Methods;
7325

74-
add_header Access-Control-Allow-Credentials false always;
75-
add_header Access-Control-Allow-Origin * always;
26+
add_header Access-Control-Allow-Credentials true always;
27+
add_header Access-Control-Allow-Origin $http_origin always;
7628
add_header Access-Control-Allow-Headers * always;
7729
add_header Access-Control-Allow-Methods 'POST, PUT, PATCH, GET, DELETE, OPTIONS, HEAD' always;
7830

@@ -83,14 +35,15 @@ http {
8335
proxy_set_header X-Forwarded-Host $server_name;
8436
proxy_set_header X-Forwarded-Port $EXPOSED_PORT;
8537

38+
resolver 127.0.0.11 valid=30s;
39+
8640
server {
8741
listen 443 ssl;
8842
listen [::]:443 ssl;
8943

9044
server_name dashbrd-demo.opex.dev;
9145

9246
location / {
93-
resolver 127.0.0.11;
9447
set $backend http://superset:8088;
9548
proxy_pass $backend;
9649
}
@@ -103,11 +56,13 @@ http {
10356
server_name adm-demo.opex.dev;
10457

10558
location ~* \.(.*)$ {
106-
proxy_pass http://docker-admin-panel;
59+
set $backend http://admin-panel;
60+
proxy_pass $backend;
10761
}
10862

10963
location / {
110-
proxy_pass http://docker-admin-panel;
64+
set $backend http://admin-panel;
65+
proxy_pass $backend;
11166
rewrite .* / break;
11267
}
11368
}
@@ -118,20 +73,31 @@ http {
11873

11974
server_name demo.opex.dev;
12075

121-
location ^~ /auth {
122-
proxy_pass http://docker-auth;
123-
}
124-
12576
location ~* \.(.*)$ {
126-
proxy_pass http://docker-web-app;
77+
set $backend http://web-app;
78+
proxy_pass $backend;
12779
}
12880

12981
location / {
130-
proxy_pass http://docker-web-app;
82+
set $backend http://web-app;
83+
proxy_pass $backend;
13184
rewrite .* / break;
13285
}
13386
}
13487

88+
server {
89+
listen 443 ssl;
90+
listen [::]:443 ssl;
91+
92+
server_name auth-demo.opex.dev;
93+
94+
location / {
95+
set $backend http://auth:8080;
96+
proxy_pass $backend;
97+
rewrite ^/(.*)$ /auth/$1 break;
98+
}
99+
}
100+
135101
server {
136102
listen 443 ssl;
137103
listen [::]:443 ssl;
@@ -144,10 +110,6 @@ http {
144110
return 204;
145111
}
146112

147-
location /auth {
148-
proxy_pass http://docker-auth;
149-
}
150-
151113
location /wallet/transfer {
152114
return 403;
153115
}
@@ -160,68 +122,82 @@ http {
160122
return 403;
161123
}
162124

125+
location /auth {
126+
set $backend http://auth:8080;
127+
proxy_pass $backend;
128+
}
129+
163130
location /wallet {
164-
proxy_pass http://docker-wallet;
131+
set $backend http://wallet:8080;
132+
proxy_pass $backend;
165133
rewrite ^/wallet/(.*)$ /$1 break;
166134
}
167135

168136
location /gateway {
169-
proxy_pass http://docker-matching-gateway;
137+
set $backend http://matching-gateway:8080;
138+
proxy_pass $backend;
170139
rewrite ^/gateway/(.*)$ /$1 break;
171140
}
172141

173142
location /storage {
174-
proxy_pass http://docker-storage;
143+
set $backend http://storage:8080;
144+
proxy_pass $backend;
175145
rewrite ^/storage/(.*)$ /$1 break;
176146
}
177147

178148
location /referral {
179-
proxy_pass http://docker-referral;
149+
set $backend http://referral:8080;
150+
proxy_pass $backend;
180151
rewrite ^/referral/(.*)$ /$1 break;
181152
}
182153

183154
location /stream {
184-
proxy_pass http://docker-websocket;
185155
# WS config
186156
proxy_http_version 1.1;
187157
proxy_set_header Upgrade $http_upgrade;
188158
proxy_set_header Connection "upgrade";
189159
###########
160+
set $backend http://websocket:8080;
161+
proxy_pass $backend;
190162
rewrite ^/stream/(.*)$ /$1 break;
191163
}
192164

193165
location /ipg {
194-
proxy_pass http://docker-ipg;
166+
set $backend http://payment:8080;
167+
proxy_pass $backend;
195168
rewrite ^/ipg/(.*)$ /$1 break;
196169
}
197170

198171
location /admin {
199-
proxy_pass http://docker-admin;
172+
set $backend http://admin:8080;
173+
proxy_pass $backend;
200174
rewrite ^/admin/(.*)$ /$1 break;
201175
}
202176

203177
location /api {
204-
proxy_pass http://docker-api;
178+
set $backend http://api:8080;
179+
proxy_pass $backend;
205180
rewrite ^/api/(.*)$ /$1 break;
206181
}
207182

208183
location /sapi {
209-
proxy_pass http://docker-api;
184+
set $backend http://api:8080;
185+
proxy_pass $backend;
210186
rewrite ^/sapi/(.*)$ /$1 break;
211187
}
212188

213189
location /captcha {
214-
add_header Access-Control-Allow-Credentials false always;
215-
add_header Access-Control-Allow-Origin * always;
190+
add_header Access-Control-Allow-Credentials true always;
191+
add_header Access-Control-Allow-Origin $http_origin always;
216192
add_header Access-Control-Allow-Headers * always;
217193
add_header Access-Control-Allow-Methods 'POST, PUT, PATCH, GET, DELETE, OPTIONS, HEAD' always;
218194
add_header Access-Control-Expose-Headers 'Captcha-Session-Key, Captcha-Expire-Timestamp' always;
219-
proxy_pass http://docker-captcha;
195+
set $backend http://captcha:8080;
196+
proxy_pass $backend;
220197
rewrite ^/captcha/(.*)$ /$1 break;
221198
}
222199

223200
location /binance {
224-
resolver 127.0.0.11;
225201
proxy_set_header Host api.binance.com;
226202
proxy_set_header X-Real-IP '';
227203
proxy_set_header X-Forwarded-For '';

0 commit comments

Comments
 (0)