223 lines
7.2 KiB
Markdown
223 lines
7.2 KiB
Markdown
# Chain 138 Integration and Proxmox Deployment - Implementation Summary
|
|
|
|
This document summarizes the implementation of Chain 138 integration and Proxmox VE deployment for the Solace Treasury DApp.
|
|
|
|
## Implementation Status
|
|
|
|
### Phase 1: Chain 138 Network Configuration ✅
|
|
|
|
#### Frontend Configuration
|
|
- ✅ Updated `frontend/lib/web3/config.ts` to include Chain 138
|
|
- ✅ Added Chain 138 definition with RPC endpoints (192.168.11.250-252:8545)
|
|
- ✅ Added WebSocket support for Chain 138
|
|
- ✅ Set Chain 138 as primary network in wagmi config
|
|
|
|
#### Backend Configuration
|
|
- ✅ Updated `backend/src/indexer/indexer.ts` to support Chain 138
|
|
- ✅ Added Chain 138 to supported chains mapping
|
|
- ✅ Configured RPC URL for Chain 138 indexing
|
|
|
|
#### Smart Contract Deployment
|
|
- ✅ Updated `contracts/hardhat.config.ts` with Chain 138 network configuration
|
|
- ✅ Created `contracts/scripts/deploy-chain138.ts` for Chain 138 specific deployment
|
|
- ✅ Added `deploy:chain138` script to `contracts/package.json`
|
|
- ✅ Deployment script saves addresses to `contracts/deployments/chain138.json`
|
|
|
|
### Phase 2: Proxmox VE Deployment Infrastructure ✅
|
|
|
|
#### Deployment Scripts
|
|
- ✅ Created `deployment/proxmox/deploy-dapp.sh` - Main orchestrator
|
|
- ✅ Created `deployment/proxmox/deploy-database.sh` - PostgreSQL deployment
|
|
- ✅ Created `deployment/proxmox/deploy-backend.sh` - Backend API deployment
|
|
- ✅ Created `deployment/proxmox/deploy-indexer.sh` - Event indexer deployment
|
|
- ✅ Created `deployment/proxmox/deploy-frontend.sh` - Frontend deployment
|
|
|
|
#### Configuration Files
|
|
- ✅ Created `deployment/proxmox/config/dapp.conf` - Deployment configuration template
|
|
- ✅ Created `deployment/proxmox/templates/nextjs.service` - Frontend systemd service
|
|
- ✅ Created `deployment/proxmox/templates/backend.service` - Backend systemd service
|
|
- ✅ Created `deployment/proxmox/templates/indexer.service` - Indexer systemd service
|
|
- ✅ Created `deployment/proxmox/templates/nginx.conf` - Nginx reverse proxy configuration
|
|
|
|
#### Setup Scripts
|
|
- ✅ Created `scripts/setup-chain138.sh` - Chain 138 configuration helper
|
|
|
|
### Phase 3: Documentation ✅
|
|
|
|
- ✅ Updated `README.md` with Chain 138 and Proxmox deployment sections
|
|
- ✅ Created `deployment/proxmox/README.md` - Comprehensive deployment guide
|
|
|
|
## File Structure
|
|
|
|
```
|
|
solace-bg-dubai/
|
|
├── contracts/
|
|
│ ├── hardhat.config.ts # Updated with Chain 138 network
|
|
│ └── scripts/
|
|
│ └── deploy-chain138.ts # Chain 138 deployment script
|
|
├── frontend/
|
|
│ └── lib/web3/
|
|
│ └── config.ts # Updated with Chain 138 support
|
|
├── backend/
|
|
│ └── src/indexer/
|
|
│ └── indexer.ts # Updated with Chain 138 support
|
|
├── deployment/
|
|
│ └── proxmox/
|
|
│ ├── deploy-dapp.sh # Main orchestrator
|
|
│ ├── deploy-database.sh # Database deployment
|
|
│ ├── deploy-backend.sh # Backend deployment
|
|
│ ├── deploy-indexer.sh # Indexer deployment
|
|
│ ├── deploy-frontend.sh # Frontend deployment
|
|
│ ├── config/
|
|
│ │ └── dapp.conf # Configuration template
|
|
│ ├── templates/
|
|
│ │ ├── nextjs.service # Frontend service template
|
|
│ │ ├── backend.service # Backend service template
|
|
│ │ ├── indexer.service # Indexer service template
|
|
│ │ └── nginx.conf # Nginx configuration
|
|
│ └── README.md # Deployment guide
|
|
├── scripts/
|
|
│ └── setup-chain138.sh # Chain 138 setup helper
|
|
└── README.md # Updated with deployment info
|
|
```
|
|
|
|
## Key Features Implemented
|
|
|
|
### Chain 138 Integration
|
|
|
|
1. **Network Definition**
|
|
- Chain ID: 138
|
|
- RPC Endpoints: 192.168.11.250-252:8545
|
|
- WebSocket: 192.168.11.250-252:8546
|
|
- Block Explorer: http://192.168.11.140
|
|
|
|
2. **Frontend Support**
|
|
- Chain 138 added to wagmi configuration
|
|
- WebSocket transport support
|
|
- Environment variable configuration
|
|
|
|
3. **Backend Support**
|
|
- Chain 138 added to indexer supported chains
|
|
- RPC URL configuration
|
|
- Event indexing support
|
|
|
|
4. **Contract Deployment**
|
|
- Hardhat network configuration
|
|
- Deployment script with address saving
|
|
- Gas price configuration (zero base fee)
|
|
|
|
### Proxmox Deployment
|
|
|
|
1. **Container Specifications**
|
|
- Frontend: VMID 3000, 2GB RAM, 2 CPU, 20GB disk
|
|
- Backend: VMID 3001, 2GB RAM, 2 CPU, 20GB disk
|
|
- Database: VMID 3002, 4GB RAM, 2 CPU, 50GB disk
|
|
- Indexer: VMID 3003, 2GB RAM, 2 CPU, 30GB disk
|
|
|
|
2. **Automated Deployment**
|
|
- One-command deployment via `deploy-dapp.sh`
|
|
- Individual component deployment scripts
|
|
- Dependency-aware deployment order
|
|
|
|
3. **Service Management**
|
|
- Systemd service files for all components
|
|
- Auto-start configuration
|
|
- Logging and monitoring setup
|
|
|
|
4. **Network Configuration**
|
|
- VLAN 103 (Services network)
|
|
- Static IP assignment
|
|
- Internal service communication
|
|
|
|
## Next Steps for Deployment
|
|
|
|
1. **Deploy Contracts**
|
|
```bash
|
|
cd contracts
|
|
pnpm run deploy:chain138
|
|
```
|
|
|
|
2. **Configure Environment**
|
|
```bash
|
|
./scripts/setup-chain138.sh
|
|
# Edit .env files with contract addresses and credentials
|
|
```
|
|
|
|
3. **Deploy to Proxmox**
|
|
```bash
|
|
cd deployment/proxmox
|
|
sudo ./deploy-dapp.sh
|
|
```
|
|
|
|
4. **Post-Deployment**
|
|
- Copy environment files to containers
|
|
- Run database migrations
|
|
- Start all services
|
|
- Configure Nginx for public access
|
|
|
|
## Configuration Requirements
|
|
|
|
### Environment Variables
|
|
|
|
**Frontend** (`frontend/.env.production`):
|
|
- `NEXT_PUBLIC_CHAIN138_RPC_URL`
|
|
- `NEXT_PUBLIC_CHAIN138_WS_URL`
|
|
- `NEXT_PUBLIC_CHAIN_ID=138`
|
|
- `NEXT_PUBLIC_TREASURY_WALLET_ADDRESS`
|
|
- `NEXT_PUBLIC_SUB_ACCOUNT_FACTORY_ADDRESS`
|
|
- `NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID`
|
|
- `NEXT_PUBLIC_API_URL`
|
|
|
|
**Backend** (`backend/.env`):
|
|
- `DATABASE_URL`
|
|
- `RPC_URL`
|
|
- `CHAIN_ID=138`
|
|
- `CONTRACT_ADDRESS`
|
|
- `PORT=3001`
|
|
- `NODE_ENV=production`
|
|
|
|
**Indexer** (`backend/.env.indexer`):
|
|
- `DATABASE_URL`
|
|
- `RPC_URL`
|
|
- `CHAIN_ID=138`
|
|
- `CONTRACT_ADDRESS`
|
|
- `START_BLOCK=0`
|
|
|
|
### Proxmox Configuration
|
|
|
|
**Required Settings** (`deployment/proxmox/config/dapp.conf`):
|
|
- `PROXMOX_STORAGE`: Storage pool name
|
|
- `PROXMOX_BRIDGE`: Network bridge
|
|
- `DATABASE_PASSWORD`: PostgreSQL password
|
|
- IP addresses (if different from defaults)
|
|
|
|
## Testing Checklist
|
|
|
|
- [ ] Chain 138 RPC connectivity
|
|
- [ ] Contract deployment to Chain 138
|
|
- [ ] Frontend connection to Chain 138
|
|
- [ ] Backend API functionality
|
|
- [ ] Database connectivity
|
|
- [ ] Event indexer synchronization
|
|
- [ ] Service auto-start on boot
|
|
- [ ] Nginx reverse proxy (if configured)
|
|
- [ ] SSL/TLS certificates (if configured)
|
|
|
|
## Notes
|
|
|
|
- All deployment scripts are executable and ready to use
|
|
- Configuration templates are provided for easy setup
|
|
- Services are configured with systemd for reliable operation
|
|
- Network configuration assumes VLAN 103 for services
|
|
- Database password must be set before deployment
|
|
- Contract addresses must be updated after deployment
|
|
|
|
## Support
|
|
|
|
For deployment issues:
|
|
1. Check service logs: `pct exec <VMID> -- journalctl -u <service> -f`
|
|
2. Verify network connectivity
|
|
3. Check environment variable configuration
|
|
4. Review deployment logs
|
|
|