fuxking work pls
This commit is contained in:
+10
-2
@@ -6,11 +6,12 @@ DATABASE_URL=postgres://surprise:surprise_dev_password@localhost:5432/surprise?s
|
|||||||
# SQLITE_PATH=./data/surprise.db
|
# SQLITE_PATH=./data/surprise.db
|
||||||
|
|
||||||
PORT=8080
|
PORT=8080
|
||||||
API_URL=http://localhost:8080
|
|
||||||
CORS_ORIGIN=http://localhost:5173,http://127.0.0.1:5173
|
CORS_ORIGIN=http://localhost:5173,http://127.0.0.1:5173
|
||||||
|
|
||||||
SESSION_SECRET=local-development-session-secret-change-me
|
SESSION_SECRET=local-development-session-secret-change-me
|
||||||
COOKIE_SECURE=false
|
COOKIE_SECURE=false
|
||||||
|
|
||||||
|
# ── MinIO / Storage ──
|
||||||
STORAGE_ENDPOINT=localhost:9000
|
STORAGE_ENDPOINT=localhost:9000
|
||||||
STORAGE_PUBLIC_ENDPOINT=
|
STORAGE_PUBLIC_ENDPOINT=
|
||||||
STORAGE_ACCESS_KEY=minioadmin
|
STORAGE_ACCESS_KEY=minioadmin
|
||||||
@@ -19,5 +20,12 @@ STORAGE_BUCKET=gallery-media
|
|||||||
STORAGE_USE_SSL=false
|
STORAGE_USE_SSL=false
|
||||||
MINIO_API_PORT=9000
|
MINIO_API_PORT=9000
|
||||||
MINIO_CONSOLE_PORT=9001
|
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
@@ -3,6 +3,8 @@ services:
|
|||||||
image: postgres:16-alpine
|
image: postgres:16-alpine
|
||||||
container_name: sndit-postgres
|
container_name: sndit-postgres
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
networks:
|
||||||
|
- scoobydoo
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_DB: surprise
|
POSTGRES_DB: surprise
|
||||||
POSTGRES_USER: surprise
|
POSTGRES_USER: surprise
|
||||||
@@ -22,6 +24,8 @@ services:
|
|||||||
image: minio/minio:latest
|
image: minio/minio:latest
|
||||||
container_name: sndit-minio
|
container_name: sndit-minio
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
networks:
|
||||||
|
- scoobydoo
|
||||||
command: server /data --console-address ":9001"
|
command: server /data --console-address ":9001"
|
||||||
environment:
|
environment:
|
||||||
MINIO_ROOT_USER: ${STORAGE_ACCESS_KEY:-minioadmin}
|
MINIO_ROOT_USER: ${STORAGE_ACCESS_KEY:-minioadmin}
|
||||||
@@ -42,13 +46,14 @@ services:
|
|||||||
build: ./backend
|
build: ./backend
|
||||||
container_name: sndit-api
|
container_name: sndit-api
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
networks:
|
||||||
|
- scoobydoo
|
||||||
ports:
|
ports:
|
||||||
- "${PORT:-8080}:8080"
|
- "${PORT:-8080}:8080"
|
||||||
environment:
|
environment:
|
||||||
DB_DRIVER: postgres
|
DB_DRIVER: postgres
|
||||||
DATABASE_URL: postgres://surprise:surprise_dev_password@postgres:5432/surprise?sslmode=disable
|
DATABASE_URL: postgres://surprise:surprise_dev_password@postgres:5432/surprise?sslmode=disable
|
||||||
PORT: "8080"
|
PORT: "8080"
|
||||||
CORS_ORIGIN: "http://localhost:8081"
|
|
||||||
SESSION_SECRET: "${SESSION_SECRET:-docker-compose-session-secret-change-me}"
|
SESSION_SECRET: "${SESSION_SECRET:-docker-compose-session-secret-change-me}"
|
||||||
COOKIE_SECURE: "${COOKIE_SECURE:-false}"
|
COOKIE_SECURE: "${COOKIE_SECURE:-false}"
|
||||||
STORAGE_ENDPOINT: "minio:9000"
|
STORAGE_ENDPOINT: "minio:9000"
|
||||||
@@ -66,6 +71,8 @@ services:
|
|||||||
migrate:
|
migrate:
|
||||||
build: ./backend
|
build: ./backend
|
||||||
container_name: sndit-migrate
|
container_name: sndit-migrate
|
||||||
|
networks:
|
||||||
|
- scoobydoo
|
||||||
command: ["migrate", "-dir", "/migrations"]
|
command: ["migrate", "-dir", "/migrations"]
|
||||||
environment:
|
environment:
|
||||||
DB_DRIVER: postgres
|
DB_DRIVER: postgres
|
||||||
@@ -79,6 +86,8 @@ services:
|
|||||||
seed:
|
seed:
|
||||||
build: ./backend
|
build: ./backend
|
||||||
container_name: sndit-seed
|
container_name: sndit-seed
|
||||||
|
networks:
|
||||||
|
- scoobydoo
|
||||||
command: ["seed"]
|
command: ["seed"]
|
||||||
environment:
|
environment:
|
||||||
DB_DRIVER: postgres
|
DB_DRIVER: postgres
|
||||||
@@ -91,14 +100,32 @@ services:
|
|||||||
build:
|
build:
|
||||||
context: ./frontend
|
context: ./frontend
|
||||||
args:
|
args:
|
||||||
VITE_API_BASE_URL: ""
|
VITE_API_BASE_URL: "${VITE_API_BASE_URL}"
|
||||||
container_name: sndit-frontend
|
container_name: sndit-frontend
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
ports:
|
networks:
|
||||||
- "${FRONTEND_PORT:-8081}:80"
|
- scoobydoo
|
||||||
depends_on:
|
depends_on:
|
||||||
- api
|
- 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:
|
volumes:
|
||||||
postgres_data:
|
postgres_data:
|
||||||
minio_data:
|
minio_data:
|
||||||
|
|
||||||
|
networks:
|
||||||
|
scoobydoo:
|
||||||
|
external: true
|
||||||
@@ -2,24 +2,6 @@ server {
|
|||||||
listen 80;
|
listen 80;
|
||||||
root /usr/share/nginx/html;
|
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 / {
|
location / {
|
||||||
try_files $uri /index.html;
|
try_files $uri /index.html;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,10 +7,7 @@ import type {
|
|||||||
PublicGallery,
|
PublicGallery,
|
||||||
} from '../types/gallery';
|
} 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 {
|
export class ApiError extends Error {
|
||||||
readonly status: number;
|
readonly status: number;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user