fix: moved ws to api/v1/ws

This commit is contained in:
2025-02-05 16:59:50 +01:00
parent 028749695c
commit b0fb8e204c
4 changed files with 17 additions and 51 deletions

View File

@ -279,7 +279,7 @@ class RedisWebsocket:
redis_options={"username": "ingestor", "password": redis_password}, redis_options={"username": "ingestor", "password": redis_password},
), ),
) )
self.app = socketio.ASGIApp(self.socket) self.app = socketio.ASGIApp(self.socket, socketio_path=f"{prefix}/ws")
self.loop = asyncio.get_event_loop() self.loop = asyncio.get_event_loop()
self.users = {} self.users = {}

View File

@ -14,8 +14,8 @@ events {
http { http {
# include mime.types; #include mime.types;
default_type application/octet-stream; #default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" ' #log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" ' # '$status $body_bytes_sent "$http_referer" '
@ -38,14 +38,22 @@ http {
#gzip on; #gzip on;
server { server {
listen 80; listen 80;
server_name yourdomain.com; # Replace with your domain or IP listen [::]:80 default_server;
server_name bec-atlas.psi.ch; # Replace with your domain or IP
root /var/nginx/bec-atlas-build/browser;
index index.html index.htm;
# Configure SSL if needed # Configure SSL if needed
# listen 443 ssl; # listen 443 ssl;
# ssl_certificate /path/to/cert.pem; # ssl_certificate /path/to/cert.pem;
# ssl_certificate_key /path/to/key.pem; # ssl_certificate_key /path/to/key.pem;
# serve the angular frontend
location / { location / {
try_files $uri $uri/ /index.html;
}
location /api {
proxy_pass http://fastapi_backend; proxy_pass http://fastapi_backend;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@ -58,57 +66,12 @@ http {
proxy_set_header Connection "upgrade"; proxy_set_header Connection "upgrade";
} }
location /nginx_status {
stub_status on;
access_log off;
allow 127.0.0.1; # Allow localhost
deny all; # Deny all others
}
# Optional: Serve static files
location /static/ {
root /path/to/static/files; # Adjust the path
}
# Optional: Add caching for static files # Optional: Add caching for static files
location ~* \.(jpg|jpeg|png|gif|css|js|ico|svg|woff|woff2|ttf|otf|eot|ttf|otf|html)$ { location ~* \.(jpg|jpeg|png|gif|css|js|ico|svg|woff|woff2|ttf|otf|eot|ttf|otf|html)$ {
expires 30d; expires 30d;
access_log off; access_log off;
} }
} }
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
include servers/*; include servers/*;
} }

View File

@ -26,6 +26,7 @@ export class RedisConnectorService {
autoConnect: true, // Automatically connect autoConnect: true, // Automatically connect
reconnection: true, // Enable automatic reconnection reconnection: true, // Enable automatic reconnection
timeout: 500, // Connection timeout in milliseconds timeout: 500, // Connection timeout in milliseconds
path: '/api/v1/ws', // Path to the WebSocket server
auth: { auth: {
user: 'john_doe', user: 'john_doe',
token: '1234', token: '1234',

View File

@ -9,11 +9,13 @@ export class ServerSettingsService {
getServerAddress() { getServerAddress() {
return ( return (
this.appConfigService.getConfig().baseUrl ?? 'http://localhost/api/v1/' this.appConfigService.getConfig().baseUrl ?? 'http://localhost/api/v1'
); );
} }
getSocketAddress() { getSocketAddress() {
return this.appConfigService.getConfig().wsUrl ?? 'http://localhost/'; let out = this.appConfigService.getConfig().wsUrl ?? 'http://localhost';
console.log(out);
return out;
} }
} }