migrated to haxproxy ad nginx was causing upload errors

This commit is contained in:
divyam234 2023-08-24 16:48:38 +05:30
parent e3a34abe93
commit aae38a7ff3
5 changed files with 42 additions and 80 deletions

View file

@ -23,7 +23,6 @@
## Demo ## Demo
![demo](./public/demo.png) ![demo](./public/demo.png)
[UI Repo ](https://github.com/divyam234/teldrive-ui) [UI Repo ](https://github.com/divyam234/teldrive-ui)
@ -34,23 +33,18 @@ First clone the repository
git clone https://github.com/divyam234/teldrive git clone https://github.com/divyam234/teldrive
cd teldrive cd teldrive
``` ```
**Follow Below Steps** **Follow Below Steps**
- Create the `.env` file with your variables and start your container. - 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 ```sh
docker compose up -d 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) ### Deploy without docker-compose(Not working will be fixed later)
First clone the repository First clone the repository
```sh ```sh

View file

@ -2,7 +2,7 @@ version: "3.8"
services: services:
server: server:
image: ghcr.io/divyam234/teldrive/server:latest image: ghcr.io/divyam234/teldrive/server:test
restart: always restart: always
container_name: server container_name: server
volumes: volumes:
@ -19,16 +19,15 @@ services:
ports: ports:
- 3000 - 3000
nginx: haproxy:
image: nginx:alpine image: haproxy:latest
restart: always
container_name: nginx
volumes: volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf - ./haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg
- ./certs:/etc/nginx/certs:ro # ports:
# - 80:80
# - 443:443
ports: ports:
- 80:80 - 8000:8000
- 443:443
depends_on: depends_on:
- server - server
- client - client

28
haproxy.cfg Normal file
View file

@ -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

View file

@ -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;
}
}

View file

@ -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;
}
}