mirror of
https://github.com/Routstr/routstr-core.git
synced 2026-08-01 00:06:14 +00:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f3c1658d69 | ||
|
|
8870332980 |
+25
@@ -1,4 +1,21 @@
|
||||
services:
|
||||
nginx:
|
||||
image: nginx:latest
|
||||
ports:
|
||||
- 80:80
|
||||
- 443:443
|
||||
volumes:
|
||||
- ./nginx.conf:/etc/nginx/nginx.conf:ro
|
||||
depends_on:
|
||||
routstr:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "-q", "-O", "/dev/null", "http://localhost/v1/info"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 10s
|
||||
|
||||
ui:
|
||||
env_file:
|
||||
- .env
|
||||
@@ -15,6 +32,8 @@ services:
|
||||
|
||||
routstr:
|
||||
build: .
|
||||
deploy:
|
||||
replicas: 2
|
||||
depends_on:
|
||||
- ui
|
||||
volumes:
|
||||
@@ -30,6 +49,12 @@ services:
|
||||
- 8000:8000
|
||||
extra_hosts: # Needed to access locally running models
|
||||
- "host.docker.internal:host-gateway"
|
||||
healthcheck:
|
||||
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/v1/info')"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
|
||||
tor:
|
||||
image: ghcr.io/hundehausen/tor-hidden-service:latest
|
||||
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
resolver 127.0.0.11 valid=10s;
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
|
||||
location / {
|
||||
set $routstr_host "routstr";
|
||||
proxy_pass http://$routstr_host:8000;
|
||||
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 /health {
|
||||
set $routstr_host "routstr";
|
||||
proxy_pass http://$routstr_host:8000/health;
|
||||
access_log off;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,8 +29,7 @@ def check_token_balance(headers: dict, body: dict, max_cost_for_model: int) -> N
|
||||
},
|
||||
)
|
||||
elif auth := headers.get("authorization", None):
|
||||
parts = auth.split()
|
||||
cashu_token = parts[1] if len(parts) > 1 else ""
|
||||
cashu_token = auth.split(" ")[1] if len(auth.split(" ")) > 1 else ""
|
||||
logger.debug(
|
||||
"Using Authorization header token",
|
||||
extra={
|
||||
|
||||
+1
-2
@@ -390,8 +390,7 @@ async def get_bearer_token_key(
|
||||
headers: dict, path: str, session: AsyncSession, auth: str, min_cost: int = 0
|
||||
) -> ApiKey:
|
||||
"""Handle bearer token authentication proxy requests."""
|
||||
parts = auth.split()
|
||||
bearer_key = parts[1] if len(parts) > 1 and parts[0].lower() == "bearer" else ""
|
||||
bearer_key = auth.replace("Bearer ", "") if auth.startswith("Bearer ") else ""
|
||||
refund_address = headers.get("Refund-LNURL", None)
|
||||
key_expiry_time = headers.get("Key-Expiry-Time", None)
|
||||
|
||||
|
||||
@@ -81,11 +81,7 @@ if [ "$LOCAL_HASH" != "$REMOTE_HASH" ]; then
|
||||
if git pull origin $(git branch --show-current) 2>&1 | tee -a "$LOG_FILE"; then
|
||||
log_message "Successfully pulled latest changes"
|
||||
|
||||
# Stop current containers
|
||||
log_message "Stopping current containers..."
|
||||
sudo $DOCKER_COMPOSE_CMD down 2>&1 | tee -a "$LOG_FILE"
|
||||
|
||||
# Build and start updated containers
|
||||
# Build and start updated containers (rolling update - no downtime)
|
||||
log_message "Building and starting updated containers..."
|
||||
if sudo $DOCKER_COMPOSE_CMD up -d --build 2>&1 | tee -a "$LOG_FILE"; then
|
||||
log_message "Successfully updated and restarted containers"
|
||||
|
||||
Reference in New Issue
Block a user