Files
smom-dbis-138/services/token-aggregation/SETUP_COMPLETE.md
2026-03-02 12:14:09 -08:00

145 lines
3.4 KiB
Markdown

# Setup Complete - Token Aggregation Service
## ✅ All Components Ready
The Token Aggregation Service with Control Panel is fully implemented and ready for deployment.
## Quick Start
### Option 1: Complete Automated Setup
```bash
cd smom-dbis-138/services/token-aggregation
# 1. Configure environment
cp .env.example .env
# Edit .env with your database URL and API keys
# 2. Run complete setup (migrations + verification)
./scripts/complete-setup.sh
# 3. Create admin user
./scripts/create-admin-user.sh
# 4. Deploy to Proxmox (if on Proxmox host)
./scripts/deploy-to-proxmox.sh
```
### Option 2: Manual Steps
```bash
# 1. Run migrations
./scripts/run-migrations.sh
# 2. Create admin user
./scripts/create-admin-user.sh
# 3. Install dependencies
npm install
cd frontend && npm install && cd ..
# 4. Build
npm run build
cd frontend && npm run build && cd ..
# 5. Start service
npm start
```
## What's Included
### Backend (22 TypeScript files)
- ✅ Token aggregation service
- ✅ Admin API with authentication
- ✅ Database repositories
- ✅ External API adapters
- ✅ Indexers (token, pool, volume, OHLCV)
### Frontend (12 files)
- ✅ Dashboard page
- ✅ Login page
- ✅ API Keys management
- ✅ Endpoints management
- ✅ DEX Factories management
- ✅ Layout and navigation
- ✅ Authentication store
### Database
- ✅ Migration 0011: Token aggregation schema
- ✅ Migration 0012: Admin configuration schema
### Deployment
- ✅ Proxmox deployment script
- ✅ Complete setup script
- ✅ Migration runner script
- ✅ Admin user creation script
## Configuration
### Environment Variables (.env)
```bash
# Database
DATABASE_URL=postgresql://user:password@host:5432/explorer_db
# RPC URLs
CHAIN_138_RPC_URL=https://rpc-http-pub.d-bis.org
CHAIN_651940_RPC_URL=https://mainnet-rpc.alltra.global
# API Keys (optional)
COINMARKETCAP_API_KEY=your-key-here
COINGECKO_API_KEY=your-key-here
DEXSCREENER_API_KEY=your-key-here
# Service
PORT=3000
NODE_ENV=production
JWT_SECRET=your-secret-here
```
## Access Points
After deployment:
- **Control Panel**: `http://<container-ip>` or `http://localhost:3001` (dev)
- **API**: `http://<container-ip>/api/v1` or `http://localhost:3000/api/v1`
- **Health Check**: `http://<container-ip>/health`
## Next Steps After Setup
1. **Login to Control Panel**: Use admin credentials created
2. **Add API Keys**: Configure CoinGecko, CoinMarketCap, DexScreener keys
3. **Add Endpoints**: Configure RPC endpoints for chains 138 and 651940
4. **Add DEX Factories**: Configure Uniswap/DODO factory addresses
5. **Monitor**: Check dashboard for service status
## Troubleshooting
### Database Connection Issues
- Verify PostgreSQL is running
- Check DATABASE_URL in .env
- Test connection: `psql $DATABASE_URL -c "SELECT 1;"`
### Migration Errors
- Check if tables already exist
- Verify migration files exist
- Check database permissions
### Service Won't Start
- Check logs: `journalctl -u token-aggregation -f`
- Verify .env file is configured
- Check port 3000 is available
### Frontend Not Loading
- Verify nginx is running: `systemctl status nginx`
- Check nginx logs: `tail -f /var/log/nginx/error.log`
- Verify frontend build exists: `ls -la frontend/dist`
## Support
See documentation:
- `README.md` - Service overview
- `CONTROL_PANEL.md` - Control panel features
- `PROXMOX_DEPLOYMENT.md` - Deployment guide
- `INTEGRATION_GUIDE.md` - Integration details