From aae38a7ff3c1bfadef74dcc72134e3b925d92ec7 Mon Sep 17 00:00:00 2001 From: divyam234 Date: Thu, 24 Aug 2023 16:48:38 +0530 Subject: [PATCH] migrated to haxproxy ad nginx was causing upload errors --- README.md | 14 ++++---------- docker-compose.yml | 21 ++++++++++----------- haproxy.cfg | 28 ++++++++++++++++++++++++++++ nginx.conf | 32 -------------------------------- nginx_nossl.conf | 27 --------------------------- 5 files changed, 42 insertions(+), 80 deletions(-) create mode 100644 haproxy.cfg delete mode 100644 nginx.conf delete mode 100644 nginx_nossl.conf diff --git a/README.md b/README.md index 03f8d6b..32d8b9e 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,6 @@ ## Demo - ![demo](./public/demo.png) [UI Repo ](https://github.com/divyam234/teldrive-ui) @@ -34,23 +33,18 @@ First clone the repository git clone https://github.com/divyam234/teldrive cd teldrive ``` + + **Follow Below Steps** - Create the `.env` file with your variables and start your container. -- **If you are deploying without https replace nginx.conf with nginx_nossl.conf -in docker-compose.yml**. -**It should look like this below if you are not using https.** -```yml -volumes: - - ./nginx_nossl.conf:/etc/nginx/conf.d/default.conf -ports: - - 8000:8000 -``` ```sh docker compose up -d ``` +**Uploads from ui will be slower due to limitations of browser use [Teldrive Uploader](https://github.com/divyam234/teldrive-upload) for faster uploads.Make sure to use Multi Client mode if you are using uploader.** + ### Deploy without docker-compose(Not working will be fixed later) First clone the repository ```sh diff --git a/docker-compose.yml b/docker-compose.yml index 54c0603..dbd5aa6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,7 @@ version: "3.8" services: server: - image: ghcr.io/divyam234/teldrive/server:latest + image: ghcr.io/divyam234/teldrive/server:test restart: always container_name: server volumes: @@ -19,16 +19,15 @@ services: ports: - 3000 - nginx: - image: nginx:alpine - restart: always - container_name: nginx + haproxy: + image: haproxy:latest volumes: - - ./nginx.conf:/etc/nginx/conf.d/default.conf - - ./certs:/etc/nginx/certs:ro + - ./haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg + # ports: + # - 80:80 + # - 443:443 ports: - - 80:80 - - 443:443 + - 8000:8000 depends_on: - - server - - client \ No newline at end of file + - server + - client \ No newline at end of file diff --git a/haproxy.cfg b/haproxy.cfg new file mode 100644 index 0000000..4ce8a15 --- /dev/null +++ b/haproxy.cfg @@ -0,0 +1,28 @@ +# global +# tune.h2.initial-window-size 1048576 +# tune.h2.max-concurrent-streams 1000 + +defaults + mode http + timeout client 10s + timeout connect 5s + timeout server 10s + timeout http-request 10s + log global + +frontend http-in + # bind *:80 + # bind *:443 ssl crt /etc/ssl/fullchain.pem alpn h2,http/1.1 + bind *:8000 + mode http + acl is_api path_beg /api + use_backend api-backend if is_api + default_backend frontend + +backend api-backend + balance roundrobin + server go-backend server:8080 check + +backend frontend + balance roundrobin + server nextjs-frontend client:3000 check diff --git a/nginx.conf b/nginx.conf deleted file mode 100644 index 43d7394..0000000 --- a/nginx.conf +++ /dev/null @@ -1,32 +0,0 @@ -server { - listen 443 ssl http2; - server_name #HOST; - ssl_certificate /etc/nginx/certs/cert.pem; - ssl_certificate_key /etc/nginx/certs/key.pem; - - location / { - proxy_pass http://client:3000; - proxy_redirect default; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Host $server_name; - proxy_set_header X-Forwarded-Proto $scheme; - } - - location /api { - client_max_body_size 0; - proxy_pass http://server:8080; - proxy_redirect default; - proxy_set_header Host $host; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Host $server_name; - proxy_set_header X-Forwarded-Proto $scheme; - } - - } \ No newline at end of file diff --git a/nginx_nossl.conf b/nginx_nossl.conf deleted file mode 100644 index 106d2ec..0000000 --- a/nginx_nossl.conf +++ /dev/null @@ -1,27 +0,0 @@ -server { - listen 8000; - location / { - proxy_pass http://client:3000; - proxy_redirect default; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Host $server_name; - proxy_set_header X-Forwarded-Proto $scheme; - } - - location /api { - client_max_body_size 0; - proxy_pass http://server:8080; - proxy_redirect default; - proxy_set_header Host $host; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Host $server_name; - proxy_set_header X-Forwarded-Proto $scheme; - } - } \ No newline at end of file