fuxking work pls

This commit is contained in:
2026-08-22 20:58:27 +02:00
parent 2cd7abb403
commit 2b4d07785a
5 changed files with 72 additions and 29 deletions
+10 -2
View File
@@ -6,11 +6,12 @@ DATABASE_URL=postgres://surprise:surprise_dev_password@localhost:5432/surprise?s
# SQLITE_PATH=./data/surprise.db
PORT=8080
API_URL=http://localhost:8080
CORS_ORIGIN=http://localhost:5173,http://127.0.0.1:5173
SESSION_SECRET=local-development-session-secret-change-me
COOKIE_SECURE=false
# ── MinIO / Storage ──
STORAGE_ENDPOINT=localhost:9000
STORAGE_PUBLIC_ENDPOINT=
STORAGE_ACCESS_KEY=minioadmin
@@ -19,5 +20,12 @@ STORAGE_BUCKET=gallery-media
STORAGE_USE_SSL=false
MINIO_API_PORT=9000
MINIO_CONSOLE_PORT=9001
NGINX_PORT=8099
VITE_API_BASE_URL=http://localhost:8080
# ── Frontend (when running dev, not behind the nginx proxy) ──
# VITE_API_BASE_URL=http://localhost:8080
# ── Production ──
# NPM points to the nginx container (sndit-nginx:8099) which proxies:
# /api/* → sndit-api:8080
# /* → sndit-frontend:80
+31 -4
View File
@@ -3,6 +3,8 @@ services:
image: postgres:16-alpine
container_name: sndit-postgres
restart: unless-stopped
networks:
- scoobydoo
environment:
POSTGRES_DB: surprise
POSTGRES_USER: surprise
@@ -22,6 +24,8 @@ services:
image: minio/minio:latest
container_name: sndit-minio
restart: unless-stopped
networks:
- scoobydoo
command: server /data --console-address ":9001"
environment:
MINIO_ROOT_USER: ${STORAGE_ACCESS_KEY:-minioadmin}
@@ -42,13 +46,14 @@ services:
build: ./backend
container_name: sndit-api
restart: unless-stopped
networks:
- scoobydoo
ports:
- "${PORT:-8080}:8080"
environment:
DB_DRIVER: postgres
DATABASE_URL: postgres://surprise:surprise_dev_password@postgres:5432/surprise?sslmode=disable
PORT: "8080"
CORS_ORIGIN: "http://localhost:8081"
SESSION_SECRET: "${SESSION_SECRET:-docker-compose-session-secret-change-me}"
COOKIE_SECURE: "${COOKIE_SECURE:-false}"
STORAGE_ENDPOINT: "minio:9000"
@@ -66,6 +71,8 @@ services:
migrate:
build: ./backend
container_name: sndit-migrate
networks:
- scoobydoo
command: ["migrate", "-dir", "/migrations"]
environment:
DB_DRIVER: postgres
@@ -79,6 +86,8 @@ services:
seed:
build: ./backend
container_name: sndit-seed
networks:
- scoobydoo
command: ["seed"]
environment:
DB_DRIVER: postgres
@@ -91,14 +100,32 @@ services:
build:
context: ./frontend
args:
VITE_API_BASE_URL: ""
VITE_API_BASE_URL: "${VITE_API_BASE_URL}"
container_name: sndit-frontend
restart: unless-stopped
ports:
- "${FRONTEND_PORT:-8081}:80"
networks:
- scoobydoo
depends_on:
- api
nginx:
image: nginx:alpine
container_name: sndit-nginx
restart: unless-stopped
networks:
- scoobydoo
ports:
- "${NGINX_PORT:-8099}:80"
volumes:
- ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf:ro
depends_on:
- frontend
- api
volumes:
postgres_data:
minio_data:
networks:
scoobydoo:
external: true
-18
View File
@@ -2,24 +2,6 @@ server {
listen 80;
root /usr/share/nginx/html;
location /api/ {
proxy_pass http://api:8080/api/;
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;
}
location /swagger/ {
proxy_pass http://api:8080/swagger/;
proxy_set_header Host $host;
}
location /health {
proxy_pass http://api:8080/health;
proxy_set_header Host $host;
}
location / {
try_files $uri /index.html;
}
+1 -4
View File
@@ -7,10 +7,7 @@ import type {
PublicGallery,
} from '../types/gallery';
const apiBaseUrl = (import.meta.env.VITE_API_BASE_URL || 'http://localhost:8080').replace(
/\/$/,
'',
);
const apiBaseUrl = (import.meta.env.VITE_API_BASE_URL || '').replace(/\/$/, '');
export class ApiError extends Error {
readonly status: number;
+29
View File
@@ -0,0 +1,29 @@
server {
listen 80;
location /api/ {
proxy_pass http://sndit-api:8080/api/;
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;
}
location /swagger/ {
proxy_pass http://sndit-api:8080/swagger/;
proxy_set_header Host $host;
}
location /health {
proxy_pass http://sndit-api:8080/health;
proxy_set_header Host $host;
}
location / {
proxy_pass http://sndit-frontend:80/;
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;
}
}