Compare commits
3 Commits
f92e14348f
...
42bca3d114
| Author | SHA1 | Date | |
|---|---|---|---|
|
42bca3d114
|
|||
|
cf0a39c43b
|
|||
|
06346b5fcd
|
@@ -4,6 +4,7 @@ server {
|
||||
server_name _;
|
||||
access_log /dev/stdout;
|
||||
error_log /dev/stdout info;
|
||||
client_max_body_size 8M;
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://python:8000/api/;
|
||||
|
||||
@@ -4,6 +4,7 @@ server {
|
||||
server_name _;
|
||||
access_log /dev/stdout;
|
||||
error_log /dev/stdout info;
|
||||
client_max_body_size 8M;
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://mapmaker:8000/api/;
|
||||
|
||||
@@ -2,3 +2,41 @@
|
||||
|
||||
## run migrations
|
||||
docker compose exec python alembic upgrade head
|
||||
|
||||
|
||||
```yaml
|
||||
services:
|
||||
app:
|
||||
hostname: mapmaker
|
||||
image: git.shihaam.dev/sarlink/mapmaker/api
|
||||
env_file: .env
|
||||
volumes:
|
||||
- ./storage/images:/var/www/html/storage/images
|
||||
depends_on:
|
||||
- postgres
|
||||
|
||||
nginx:
|
||||
hostname: mapmaker-nginx
|
||||
image: git.shihaam.dev/sarlink/mapmaker/nginx
|
||||
volumes_from:
|
||||
- app
|
||||
ports:
|
||||
- 8000:80
|
||||
depends_on:
|
||||
- app
|
||||
|
||||
postgres:
|
||||
image: postgis/postgis:15-3.3
|
||||
hostname: database
|
||||
restart: always
|
||||
environment:
|
||||
POSTGRES_USER: mapmaker
|
||||
POSTGRES_PASSWORD: mapmaker
|
||||
POSTGRES_DB: mapmaker
|
||||
volumes:
|
||||
- ./storage/database:/var/lib/postgresql/data
|
||||
# ports:
|
||||
# - "5432:5432"
|
||||
```
|
||||
## prod docker compose.yml
|
||||
|
||||
|
||||
@@ -51,9 +51,9 @@ export function useMapWebSocket({
|
||||
// Get the token for authenticated users
|
||||
const token = authService.getAccessToken();
|
||||
|
||||
// Build WebSocket URL
|
||||
// Build WebSocket URL - always use current domain
|
||||
const wsProtocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
|
||||
const wsHost = import.meta.env.VITE_API_URL?.replace(/^https?:\/\//, '') || window.location.host;
|
||||
const wsHost = window.location.host;
|
||||
let wsUrl = `${wsProtocol}//${wsHost}/ws/maps/${mapId}`;
|
||||
|
||||
// Add authentication
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import axios from 'axios';
|
||||
|
||||
const API_URL = import.meta.env.VITE_API_URL || 'http://localhost:8000';
|
||||
// Always use current domain - nginx proxies /api to backend
|
||||
const API_URL = window.location.origin;
|
||||
|
||||
export const apiClient = axios.create({
|
||||
baseURL: API_URL,
|
||||
|
||||
@@ -25,7 +25,8 @@ class UploadService {
|
||||
}
|
||||
|
||||
getImageUrl(path: string): string {
|
||||
const apiUrl = import.meta.env.VITE_API_URL || 'http://localhost:8000';
|
||||
// Always use current domain
|
||||
const apiUrl = window.location.origin;
|
||||
|
||||
// If it's a path like /api/uploads/image/xxx.jpg
|
||||
if (path.startsWith('/api/uploads/image/')) {
|
||||
|
||||
Reference in New Issue
Block a user