diff --git a/docker-compose.yaml b/docker-compose.yaml index f15413a7..65729628 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -3,8 +3,8 @@ version: "3" services: dbgate: - # build: docker - image: dbgate/dbgate:beta-alpine + build: docker + # image: dbgate/dbgate:beta-alpine restart: always ports: - 3100:3000 @@ -17,6 +17,12 @@ services: environment: WEB_ROOT: /dbgate + proxy: + # image: nginx + build: test/nginx + ports: + - 8082:80 + # volumes: # - /home/jena/test/chinook:/mnt/sqt # environment: diff --git a/packages/api/src/main.js b/packages/api/src/main.js index 0a08bb37..c95eaae8 100644 --- a/packages/api/src/main.js +++ b/packages/api/src/main.js @@ -55,6 +55,7 @@ function start() { res.set({ 'Cache-Control': 'no-cache', 'Content-Type': 'text/event-stream', + 'X-Accel-Buffering': 'no', Connection: 'keep-alive', }); res.flushHeaders(); diff --git a/packages/api/src/utility/socket.js b/packages/api/src/utility/socket.js index 86eb0433..639325a4 100644 --- a/packages/api/src/utility/socket.js +++ b/packages/api/src/utility/socket.js @@ -5,6 +5,7 @@ let init = ''; module.exports = { setSseResponse(value) { sseResponse = value; + setInterval(() => this.emit('ping'), 30 * 1000); }, setElectronSender(value) { electronSender = value; diff --git a/test/nginx/Dockerfile b/test/nginx/Dockerfile new file mode 100644 index 00000000..d6eac3e8 --- /dev/null +++ b/test/nginx/Dockerfile @@ -0,0 +1,3 @@ +FROM nginx + +COPY nginx.conf /etc/nginx/nginx.conf diff --git a/test/nginx/nginx.conf b/test/nginx/nginx.conf new file mode 100644 index 00000000..fd3f9100 --- /dev/null +++ b/test/nginx/nginx.conf @@ -0,0 +1,44 @@ +user nginx; +worker_processes auto; + +error_log /var/log/nginx/error.log notice; +pid /var/run/nginx.pid; + + +events { + worker_connections 1024; +} + + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + + sendfile on; + #tcp_nopush on; + + keepalive_timeout 65; + + #gzip on; + + # include /etc/nginx/conf.d/*.conf; + + server { + # listen 80; + + # return 302 https://dbgate.org; + + location /dbgate { + proxy_pass http://dbgate:3000; + + # proxy_http_version 1.1; + # proxy_set_header Connection ""; + } + } +}