8 changed files with 1819 additions and 92 deletions
@ -1,17 +1,13 @@ |
|||||
# Copy to .env and fill in the values |
# Copy to .env and fill in the values |
||||
# cp .env.example .env |
# cp .env.example .env |
||||
|
|
||||
# --- PostgreSQL (docker-compose: container initialisation) --- |
# --- PostgreSQL --- |
||||
DB_NAME=dropzone |
DB_NAME=dropzone |
||||
DB_USER=dropzone |
DB_USER=dropzone |
||||
DB_PASSWORD=CHANGE_TO_STRONG_PASSWORD |
DB_PASSWORD=CHANGE_TO_STRONG_PASSWORD |
||||
|
|
||||
# --- Backend (go run ./cmd/server — outside Docker) --- |
|
||||
DATABASE_URL=postgres://dropzone:CHANGE_TO_STRONG_PASSWORD@localhost:15432/dropzone?sslmode=disable |
|
||||
PORT=8080 |
|
||||
|
|
||||
# --- JWT --- |
# --- JWT --- |
||||
JWT_SECRET=CHANGE_TO_RANDOM_STRING_MIN_32_CHARS |
JWT_SECRET=CHANGE_TO_RANDOM_STRING_MIN_32_CHARS |
||||
|
|
||||
# --- Nginx / domain (production) --- |
# --- Storage: path to disk with user files --- |
||||
DOMAIN=dropzone.example.com |
DISK_ROOT=/mnt/dysk |
||||
|
|||||
File diff suppressed because it is too large
@ -0,0 +1,11 @@ |
|||||
|
# Stage 1: build Vue frontend |
||||
|
FROM node:20-alpine AS frontend-builder |
||||
|
WORKDIR /app |
||||
|
COPY frontend/package.json frontend/package-lock.json ./ |
||||
|
RUN npm ci |
||||
|
COPY frontend/ . |
||||
|
RUN npm run build |
||||
|
|
||||
|
# Stage 2: nginx with built frontend baked in |
||||
|
FROM nginx:1.27-alpine |
||||
|
COPY --from=frontend-builder /app/dist /app/frontend/dist |
||||
@ -1,64 +0,0 @@ |
|||||
server { |
|
||||
listen 80; |
|
||||
server_name dropzone.example.com; |
|
||||
|
|
||||
# HTTP → HTTPS redirect |
|
||||
return 301 https://$host$request_uri; |
|
||||
} |
|
||||
|
|
||||
server { |
|
||||
listen 443 ssl; |
|
||||
server_name dropzone.example.com; |
|
||||
|
|
||||
ssl_certificate /etc/nginx/certs/fullchain.pem; |
|
||||
ssl_certificate_key /etc/nginx/certs/privkey.pem; |
|
||||
|
|
||||
# --- Large files: upload up to 6GB --- |
|
||||
client_max_body_size 6g; |
|
||||
|
|
||||
# Long timeouts for large uploads (5GB on slow connections) |
|
||||
proxy_read_timeout 3600s; |
|
||||
proxy_send_timeout 3600s; |
|
||||
proxy_connect_timeout 60s; |
|
||||
|
|
||||
# --- Frontend (Vue 3 built to /app/frontend/dist) --- |
|
||||
location / { |
|
||||
root /app/frontend/dist; |
|
||||
try_files $uri $uri/ /index.html; |
|
||||
} |
|
||||
|
|
||||
# --- Backend API --- |
|
||||
location /api/ { |
|
||||
proxy_pass http://backend:8080; |
|
||||
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-Proto $scheme; |
|
||||
proxy_buffering off; # important for large files |
|
||||
proxy_request_buffering off; # do not buffer uploads in Nginx |
|
||||
} |
|
||||
|
|
||||
# --- tus: resumable upload of large files --- |
|
||||
location /files/ { |
|
||||
proxy_pass http://backend:8080; |
|
||||
proxy_set_header Host $host; |
|
||||
proxy_set_header X-Real-IP $remote_addr; |
|
||||
proxy_buffering off; |
|
||||
proxy_request_buffering off; |
|
||||
|
|
||||
# Required by the tus protocol |
|
||||
proxy_http_version 1.1; |
|
||||
} |
|
||||
|
|
||||
# --- Direct file serving via Nginx (X-Accel-Redirect) --- |
|
||||
# Backend returns X-Accel-Redirect header instead of streaming the file |
|
||||
location /internal/public/ { |
|
||||
internal; |
|
||||
alias /mnt/dysk/public/; |
|
||||
} |
|
||||
|
|
||||
location /internal/userfiles/ { |
|
||||
internal; |
|
||||
alias /mnt/dysk/; |
|
||||
} |
|
||||
} |
|
||||
@ -0,0 +1,50 @@ |
|||||
|
server { |
||||
|
listen 80; |
||||
|
server_name q2dropzone.xyz; |
||||
|
|
||||
|
client_max_body_size 6g; |
||||
|
proxy_read_timeout 3600s; |
||||
|
proxy_send_timeout 3600s; |
||||
|
proxy_connect_timeout 60s; |
||||
|
|
||||
|
# --- Frontend --- |
||||
|
location / { |
||||
|
root /app/frontend/dist; |
||||
|
try_files $uri $uri/ /index.html; |
||||
|
} |
||||
|
|
||||
|
# --- Backend API --- |
||||
|
location /api/ { |
||||
|
proxy_pass http://backend:8080; |
||||
|
proxy_http_version 1.1; |
||||
|
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-Proto https; |
||||
|
proxy_buffering off; |
||||
|
proxy_request_buffering off; |
||||
|
} |
||||
|
|
||||
|
# --- tus: resumable large file uploads --- |
||||
|
location /files/ { |
||||
|
proxy_pass http://backend:8080; |
||||
|
proxy_http_version 1.1; |
||||
|
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-Proto https; |
||||
|
proxy_buffering off; |
||||
|
proxy_request_buffering off; |
||||
|
} |
||||
|
|
||||
|
# --- X-Accel-Redirect --- |
||||
|
location /internal/public/ { |
||||
|
internal; |
||||
|
alias ${DISK_ROOT}/public/; |
||||
|
} |
||||
|
|
||||
|
location /internal/userfiles/ { |
||||
|
internal; |
||||
|
alias ${DISK_ROOT}/; |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue