spr migrated books, and tester

This commit is contained in:
buenosairesam
2025-12-31 09:07:27 -03:00
parent 21b8eab3cb
commit cccc6b5a93
136 changed files with 15763 additions and 472 deletions

View File

@@ -2,7 +2,7 @@
## Purpose
Mainroom orchestrates the interaction between **soleprint** and **managed rooms** (external projects like amar).
Mainroom orchestrates **soleprint + managed rooms** together (e.g., amar).
Key principle: Connect soleprint to managed apps **without modifying either side**.
@@ -10,130 +10,136 @@ Key principle: Connect soleprint to managed apps **without modifying either side
```
mainroom/
├── CLAUDE.md # You are here
├── ctrl/ # Orchestration commands
│ ├── start.sh # Start services (sets env vars)
│ ├── stop.sh # Stop services
│ ├── build.sh # Build images
│ ├── logs.sh # View logs
│ ├── status.sh # Show status
│ ├── deploy.sh # Deploy to server
│ └── server/ # Server setup scripts
├── sbwrapper/ # Sidebar wrapper UI
│ ├── index.html # Wrapper shell
│ ├── sidebar.css # Styling
│ ├── sidebar.js # Logic
│ └── config.json # Per-room configuration
├── link/ # Adapter layer
│ ├── main.py # FastAPI service
│ ├── Dockerfile
├── amar -> ../cfg/amar # Symlink to room config
├── soleprint/ # Soleprint Docker config
│ ├── docker-compose.yml
── adapters/ # Framework-specific adapters
├── __init__.py # BaseAdapter interface
│ └── django.py # Django adapter (for amar)
└── soleprint/ # Docker configs for soleprint services
── docker-compose.yml
├── docker-compose.nginx.yml
── Dockerfile.fastapi
── docker-compose.nginx.yml
└── .env
├── sbwrapper/ # Sidebar wrapper UI
├── config.json # Room-specific (users, Jira)
│ ├── sidebar.js
── sidebar.css
└── ctrl/ # Orchestration scripts
── start.sh # Start all services
├── stop.sh
├── deploy.sh # Deploy to AWS
└── server/ # AWS setup scripts
```
## Usage
### Local Development
```bash
# First, build soleprint
cd spr/
python build.py dev --cfg amar
# Create shared network
docker network create soleprint_network
# Start everything
cd mainroom/ctrl
./start.sh -d # Detached
./start.sh # Foreground (logs)
./start.sh amar # Only amar
./start.sh soleprint # Only soleprint
./stop.sh # Stop all
```
### Deploy to AWS
```bash
cd mainroom/ctrl
./deploy.sh --dry-run # Preview
./deploy.sh # Deploy
```
## Components
### ctrl/ - Orchestration Commands
Scripts that set env vars and start/stop services. The managed project works with its own defaults; ctrl sets overrides for orchestration.
### ctrl/ - Orchestration
| Script | Purpose |
|--------|---------|
| start.sh | Start amar + soleprint |
| stop.sh | Stop all |
| deploy.sh | rsync to AWS |
| server/ | AWS setup scripts |
```bash
./ctrl/start.sh # Start soleprint + link
./ctrl/start.sh --with-nginx # Start with nginx proxy
./ctrl/stop.sh # Stop all
./ctrl/logs.sh # View logs
./ctrl/status.sh # Show status
```
### soleprint/ - Docker Config
Uses `SOLEPRINT_BARE_PATH` to mount gen/ into container.
### sbwrapper/ - Sidebar Wrapper UI
Collapsible sidebar overlay for ANY managed app. Provides dev tools without interfering with the managed application.
**Env vars:**
- `SOLEPRINT_BARE_PATH` - Path to gen/
- `DEPLOYMENT_NAME` - Container prefix
- `NETWORK_NAME` - Docker network (soleprint_network)
- `SOLEPRINT_PORT` - Default 12000
### sbwrapper/ - Sidebar Wrapper
Collapsible sidebar overlay for managed apps.
**Features:**
- Quick login panel (switch test users)
- Jira ticket info panel
- Quick login (switch test users)
- Jira ticket info
- Environment info
- Collapsible, resizable
- Keyboard shortcut: `Ctrl+Shift+P`
- Keyboard: `Ctrl+Shift+P`
**Implementation:** HTML injection via nginx reverse proxy or iframe approach.
### link/ - Adapter Layer
Framework-agnostic data navigation between soleprint and managed apps.
**Pattern:**
```
Managed App (DB) ←── link adapters ──→ Soleprint (Station tools)
```
**Endpoints:**
- `GET /health` - Health check
- `GET /api/queries` - List available queries
- `GET /api/navigate?query=<name>` - Execute predefined query
- `GET /api/navigate?entity=<type>&id=<id>` - Entity navigation
**JSON Contract:**
**config.json:**
```json
{
"nodes": [{"id": "User_123", "type": "User", "label": "john", "data": {...}}],
"edges": [{"from": "User_123", "to": "Pet_456", "label": "owns"}],
"summary": {"title": "User #123", "fields": {...}}
"room_name": "amar",
"wrapper": {
"users": [
{"id": "admin", "label": "Admin", "username": "admin@test.com", ...}
],
"jira": {"ticket_id": "VET-535"}
}
}
```
### soleprint/ - Docker Configs
Docker compose files for running soleprint services (hub, artery, atlas, station).
**Environment Variables:**
- `SOLEPRINT_BARE_PATH` - Path to soleprint source (gen/)
- `DEPLOYMENT_NAME` - Container prefix
- `NETWORK_NAME` - Docker network name
- `SOLEPRINT_PORT`, `ARTERY_PORT`, `ATLAS_PORT`, `STATION_PORT`
### amar/ - Room Symlink
Points to `../cfg/amar` which contains:
- docker-compose.yml
- .env
- Dockerfile.backend, Dockerfile.frontend
- databrowse/depot/, tester/tests/, monitors/, models/
## How It Works
1. **ctrl/** sets environment variables for orchestration
2. **soleprint/** docker configs use those vars to mount code and expose ports
3. **link/** connects to managed app's database via adapters
4. **sbwrapper/** overlays UI on managed app via nginx injection
The managed project is never modified - it runs with its own defaults, mainroom just provides the orchestration layer on top.
1. `build.py dev --cfg amar` creates gen/ with room config
2. `mainroom/amar` symlinks to `cfg/amar`
3. `ctrl/start.sh` finds docker-compose.yml in amar/ and soleprint/
4. Both share `soleprint_network` for inter-container communication
5. sbwrapper overlays UI on managed app
## Ports
| Service | Port |
|---------|------|
| Soleprint Hub | 12000 |
| Artery | 12001 |
| Atlas | 12002 |
| Station | 12003 |
| Link | 8100 |
| Soleprint | 12000 |
| Amar Backend | 8000 |
| Amar Frontend | 3000 |
## Adding a New Managed Room
## Integration with ppl/
1. Create adapter in `link/adapters/` (implement BaseAdapter)
2. Configure `sbwrapper/config.json` with room-specific users, Jira ticket, etc.
3. Set env vars in ctrl scripts pointing to managed app
4. Run `./ctrl/start.sh`
Deploy via ppl/ctrl for centralized infrastructure management:
```bash
cd /home/mariano/wdir/ppl/ctrl
./deploy-gen.sh # Build spr + deploy
./dns.sh add soleprint # Add DNS record
```
## Worktrees
## Server Structure (mcrn.ar)
Feature development:
- `/home/mariano/wdir/wts/spr/sbwrapper` - Sidebar wrapper development
- `/home/mariano/wdir/wts/spr/databrowse` - Data browser tool
```
~/mainroom/
├── amar/ # Amar Docker services
├── soleprint/ # Soleprint Docker services
└── ctrl/ # Server-side scripts
```
## External References
## External Paths
| What | Location |
|------|----------|
| Soleprint source | `../` (parent directory) |
| Amar backend | `/home/mariano/wdir/ama/amar_django_back` |
| Amar frontend | `/home/mariano/wdir/ama/amar_frontend` |
| Core room (legacy) | `/home/mariano/wdir/ama/core_room` |
| What | Path |
|------|------|
| Amar Backend | /home/mariano/wdir/ama/amar_django_back |
| Amar Frontend | /home/mariano/wdir/ama/amar_frontend |
| Soleprint gen | /home/mariano/wdir/spr/gen |
| Pipelines | /home/mariano/wdir/ppl |