fixed network issue with multiple managed rooms

This commit is contained in:
buenosairesam
2026-01-27 02:26:03 -03:00
parent dd47f9c66f
commit 8c5deb74e8
12 changed files with 401 additions and 3 deletions

6
cfg/.gitignore vendored
View File

@@ -1,13 +1,15 @@
# Environment files with credentials (use .env.example as template)
**/.env
!sample/**/.env
# Database dumps (sensitive data)
*/dumps/*.sql
**/dumps/*.sql
# Python
__pycache__/
*.pyc
*.pyo
# Standalone is kept in main soleprint repo as sample
# These are kept in main soleprint repo as templates
standalone/
sample/

15
cfg/sample/config.json Normal file
View File

@@ -0,0 +1,15 @@
{
"managed": {
"name": "sample",
"repos": {
"frontend": "/path/to/your/frontend/repo",
"backend": "/path/to/your/backend/repo"
}
},
"framework": {
"name": "soleprint"
},
"auth": {
"enabled": false
}
}

28
cfg/sample/ctrl/start.sh Executable file
View File

@@ -0,0 +1,28 @@
#!/bin/bash
# Start all sample services
# Usage: ./ctrl/start.sh [-d]
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT_DIR="$(dirname "$SCRIPT_DIR")"
DETACH=""
if [[ "$1" == "-d" ]]; then
DETACH="-d"
fi
echo "=== Starting sample services ==="
# Start soleprint
echo "Starting soleprint..."
cd "$ROOT_DIR/soleprint"
docker compose up $DETACH &
# Start sample app
if [[ -f "$ROOT_DIR/sample/docker-compose.yml" ]]; then
echo "Starting sample app..."
cd "$ROOT_DIR/sample"
docker compose up $DETACH &
fi
wait
echo "=== All services started ==="

22
cfg/sample/ctrl/stop.sh Executable file
View File

@@ -0,0 +1,22 @@
#!/bin/bash
# Stop all sample services
# Usage: ./ctrl/stop.sh
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT_DIR="$(dirname "$SCRIPT_DIR")"
echo "=== Stopping sample services ==="
# Stop sample app
if [[ -f "$ROOT_DIR/sample/docker-compose.yml" ]]; then
echo "Stopping sample app..."
cd "$ROOT_DIR/sample"
docker compose down
fi
# Stop soleprint
echo "Stopping soleprint..."
cd "$ROOT_DIR/soleprint"
docker compose down
echo "=== All services stopped ==="

15
cfg/sample/sample/.env Normal file
View File

@@ -0,0 +1,15 @@
# =============================================================================
# Sample Managed App - Environment Configuration
# =============================================================================
# Copy this to cfg/<your-room>/<app-name>/.env and customize
# =============================================================================
# DEPLOYMENT
# =============================================================================
DEPLOYMENT_NAME=sample
NETWORK_NAME=sample_network
# =============================================================================
# PORTS
# =============================================================================
FRONTEND_PORT=3020

View File

@@ -0,0 +1,19 @@
# Sample Mock Frontend
# Simple nginx serving static HTML
#
# For a real app, customize this with your actual services
services:
frontend:
image: nginx:alpine
container_name: ${DEPLOYMENT_NAME}_frontend
volumes:
- ./index.html:/usr/share/nginx/html/index.html:ro
ports:
- "${FRONTEND_PORT}:80"
networks:
- default
networks:
default:
name: ${NETWORK_NAME}

View File

@@ -0,0 +1,35 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sample App</title>
<style>
body {
font-family: system-ui, -apple-system, sans-serif;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
margin: 0;
background: #f5f5f5;
}
.container {
text-align: center;
padding: 2rem;
background: white;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
h1 { color: #333; }
p { color: #666; }
</style>
</head>
<body>
<div class="container">
<h1>Sample App</h1>
<p>This is a sample managed room for Soleprint.</p>
<p>Replace this with your actual frontend.</p>
</div>
</body>
</html>

40
cfg/sample/soleprint/.env Normal file
View File

@@ -0,0 +1,40 @@
# =============================================================================
# SOLEPRINT - Sample Room Configuration
# =============================================================================
# Copy this to cfg/<your-room>/soleprint/.env and customize
# =============================================================================
# DEPLOYMENT
# =============================================================================
DEPLOYMENT_NAME=sample_spr
# =============================================================================
# NETWORK (unique per room to allow concurrent operation)
# =============================================================================
NETWORK_NAME=sample_network
# =============================================================================
# PORTS (choose unique ports for each room)
# =============================================================================
SOLEPRINT_PORT=12020
# =============================================================================
# GOOGLE OAUTH (optional - for auth)
# =============================================================================
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
GOOGLE_REDIRECT_URI=http://sample.spr.local.ar/spr/artery/google/oauth/callback
# =============================================================================
# AUTH
# =============================================================================
AUTH_SESSION_SECRET=change-this-in-production
# =============================================================================
# DATABASE (optional - if your app uses a database)
# =============================================================================
DB_HOST=sample_db
DB_PORT=5432
DB_NAME=sampledb
DB_USER=postgres
DB_PASSWORD=localdev123

View File

@@ -0,0 +1,36 @@
# Soleprint Services - Docker Compose
#
# Runs soleprint hub as a single service
# Artery, atlas, station are accessed via path-based routing
#
# Usage:
# cd gen/<room>/soleprint && docker compose up -d
name: ${DEPLOYMENT_NAME}
services:
soleprint:
build:
context: .
dockerfile: Dockerfile
container_name: ${DEPLOYMENT_NAME}
user: "${UID:-1000}:${GID:-1000}"
volumes:
- .:/app
ports:
- "${SOLEPRINT_PORT}:8000"
env_file:
- .env
environment:
# For single-port mode, all subsystems are internal routes
- ARTERY_EXTERNAL_URL=/artery
- ATLAS_EXTERNAL_URL=/atlas
- STATION_EXTERNAL_URL=/station
networks:
- default
# Use run.py for single-port bare-metal mode
command: uvicorn run:app --host 0.0.0.0 --port 8000 --reload
networks:
default:
name: ${NETWORK_NAME}

View File

@@ -5,12 +5,15 @@
# Usage:
# cd gen/standalone && docker compose up -d
name: soleprint_standalone
services:
soleprint:
build:
context: .
dockerfile: Dockerfile
container_name: soleprint
user: "${UID:-1000}:${GID:-1000}"
volumes:
- .:/app
ports: