Some checks failed
Deploy to Testnet / deploy-testnet (push) Successful in 1m13s
Integration Tests / test-service-integration (push) Successful in 2m38s
Python Tests / test-python (push) Failing after 1m5s
Security Scanning / security-scan (push) Failing after 17s
Node Failover Simulation / failover-test (push) Successful in 2s
Multi-Node Stress Testing / stress-test (push) Successful in 2s
Cross-Node Transaction Testing / transaction-test (push) Successful in 2s
- Convert SQLAlchemy objects to dictionaries in list_bids method - Add GET /v1/marketplace/orders endpoint for CLI compatibility - Fixes 500 error when listing bids - Fixes 404 error when CLI calls orders endpoint - Orders endpoint returns bids in expected format
AITBC Marketplace Service
Manages GPU marketplace operations.
Installation
cd /opt/aitbc
poetry install --with marketplace-service
Database Setup
Create a separate database for the marketplace service:
sudo -u postgres psql -f apps/marketplace-service/scripts/setup-database.sql
Or manually:
CREATE DATABASE aitbc_marketplace;
CREATE USER aitbc_marketplace WITH PASSWORD 'password';
GRANT ALL PRIVILEGES ON DATABASE aitbc_marketplace TO aitbc_marketplace;
Running
# Development
python -m marketplace_service.main
# Production (systemd)
sudo systemctl start marketplace-service
sudo systemctl enable marketplace-service
Endpoints
GET /health- Health checkGET /marketplace/status- Get marketplace statusGET /v1/marketplace/offers- Get marketplace offersGET /v1/marketplace/offers/{offer_id}- Get specific offerPOST /v1/marketplace/offers- Create new offerGET /v1/marketplace/bids- Get marketplace bidsPOST /v1/marketplace/bids- Create new bidGET /v1/marketplace/analytics- Get marketplace analytics
Testing
Prerequisites
- PostgreSQL running and aitbc_marketplace database created
- Poetry dependencies installed
Database Setup
sudo -u postgres psql -f scripts/setup-database.sql
Start Service (Development)
python -m marketplace_service.main
Health Check
curl http://localhost:8102/health
Expected response:
{"status": "healthy", "service": "marketplace-service"}
Marketplace Status
curl http://localhost:8102/marketplace/status
Expected response:
{
"status": "operational",
"service": "marketplace-service",
"message": "Marketplace service is running"
}
Get Marketplace Offers
curl http://localhost:8102/v1/marketplace/offers
Expected response:
[]
Create Marketplace Offer
curl -X POST http://localhost:8102/v1/marketplace/offers \
-H "Content-Type: application/json" \
-d '{
"provider": "test_provider",
"capacity": 100,
"price": 0.5,
"gpu_model": "NVIDIA A100"
}'
Test Through Gateway
-
Start the API gateway:
python -m api_gateway.main -
Test marketplace endpoints through the gateway:
curl http://localhost:8080/marketplace/health curl http://localhost:8080/marketplace/v1/marketplace/offers
For comprehensive testing procedures, see MICROSERVICES_TESTING_GUIDE.md.
Service Configuration
- Port: 8102
- Database: aitbc_marketplace
- Gateway route: /marketplace/*
Migration Status
Completed:
- Extracted marketplace domain models (MarketplaceOffer, MarketplaceBid, GlobalMarketplaceOffer, GlobalMarketplaceTransaction, etc.)
- Extracted marketplace services (MarketplaceService with CRUD operations)
- Extracted marketplace data structures
- Set up database session management
- Extracted marketplace router endpoints
- Created systemd service configuration
- Created database setup script
Remaining:
- Remove marketplace routers from coordinator-api (marketplace, marketplace_gpu, marketplace_offers, global_marketplace, global_marketplace_integration)
- Remove marketplace services from coordinator-api
- Remove marketplace domain models from coordinator-api
- Run database migration script to create aitbc_marketplace database
- Install and enable systemd service
- End-to-end testing with gateway
Note: The marketplace service is very large (~130K lines), so full removal from coordinator-api requires careful coordination to avoid breaking existing functionality. The foundation is in place for gradual migration.