chore: refactor logging module, update genesis timestamp, remove model relationships, and reorganize routers - Rename logging.py to logger.py and update import paths in poa.py and main.py - Update devnet genesis timestamp to 1766828620 - Remove SQLModel Relationship declarations from Block, Transaction, and Receipt models - Add SessionDep type alias and get_session dependency in coordinator-api deps - Reorganize coordinator-api routers: replace explorer/registry with exchange, users, marketplace
3.0 KiB
3.0 KiB
AITBC Domain Deployment Guide
Overview
Deploy AITBC services to your existing domain: https://aitbc.bubuit.net
Service URLs
- Marketplace: https://aitbc.bubuit.net/Marketplace
- Trade Exchange: https://aitbc.bubuit.net/Exchange
- API: https://aitbc.bubuit.net/api
- Blockchain RPC: https://aitbc.bubuit.net/rpc
- Admin: https://aitbc.bubuit.net/admin
Prerequisites
- Incus access (add user to incus group):
sudo usermod -aG incus $USER
# Log out and back in
- Domain pointing to your server
Deployment Steps
1. Deploy Services
./deploy-domain.sh
2. Configure Port Forwarding
Forward these ports to the container IP (10.1.223.93):
- Port 80 → 10.1.223.93:80
- Port 443 → 10.1.223.93:443
3. Install SSL Certificate
incus exec aitbc -- certbot --nginx -d aitbc.bubuit.net
4. Verify Services
Visit the URLs to ensure everything is working.
Nginx Configuration
The nginx configuration handles:
- HTTPS redirection
- SSL termination
- Path-based routing
- API proxying
- Security headers
Configuration file: /home/oib/windsurf/aitbc/nginx-aitbc.conf
Service Management
Check running services:
incus exec aitbc -- ps aux | grep python
View logs:
incus exec aitbc -- journalctl -u aitbc-coordinator -f
Restart services:
incus exec aitbc -- pkill -f uvicorn
incus exec aitbc -- /home/oib/start_aitbc.sh
Update nginx config:
incus file push nginx-aitbc.conf aitbc/etc/nginx/sites-available/aitbc
incus exec aitbc -- nginx -t && incus exec aitbc -- systemctl reload nginx
API Endpoints
Coordinator API
- GET
/api/marketplace/offers- List GPU offers - POST
/api/miners/register- Register miner - POST
/api/marketplace/bids- Create bid - GET
/api/marketplace/stats- Marketplace stats
Blockchain RPC
- GET
/rpc/head- Get latest block - GET
/rpc/getBalance/{address}- Get balance - POST
/rpc/admin/mintFaucet- Mint tokens
Security Considerations
- Firewall: Only open necessary ports (80, 443)
- SSL: Always use HTTPS
- API Keys: Use environment variables for sensitive keys
- Rate Limiting: Configure nginx rate limiting if needed
Monitoring
Health checks:
Metrics:
- https://aitbc.bubuit.net/metrics (if configured)
Troubleshooting
Services not accessible:
- Check port forwarding
- Verify nginx configuration
- Check container services
SSL issues:
- Renew certificate:
incus exec aitbc -- certbot renew - Check nginx SSL config
API errors:
- Check service logs
- Verify API endpoints
- Check CORS settings
Customization
Add new service:
- Update nginx-aitbc.conf
- Add service to start_aitbc.sh
- Restart services
Update UI:
- Modify HTML files in apps/
- Update base href if needed
- Restart web servers
Production Tips
- Set up monitoring alerts
- Configure backups
- Use environment variables for config
- Set up log rotation
- Monitor resource usage