# Complete Deployment - All Steps ## ✅ Ready to Execute All deployment scripts and documentation are ready. Execute the following commands in your terminal: ## Step-by-Step Execution ### 1. Navigate to Project ```bash cd ~/projects/proxmox/explorer-monorepo ``` ### 2. Run Complete Deployment Script ```bash bash scripts/run-all-deployment.sh ``` This script will: - ✅ Test database connection - ✅ Run migration - ✅ Restart server with database - ✅ Test all endpoints - ✅ Provide status summary ## Alternative: Manual Execution If the script doesn't work, run these commands manually: ### Step 1: Test Database Connection ```bash PGPASSWORD='L@ker$2010' psql -h localhost -U explorer -d explorer -c "SELECT 1;" ``` ### Step 2: Check Existing Tables ```bash PGPASSWORD='L@ker$2010' psql -h localhost -U explorer -d explorer -c " SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'public' AND table_name IN ('wallet_nonces', 'operator_roles', 'addresses', 'token_transfers'); " ``` ### Step 3: Run Migration ```bash cd ~/projects/proxmox/explorer-monorepo PGPASSWORD='L@ker$2010' psql -h localhost -U explorer -d explorer \ -f backend/database/migrations/0010_track_schema.up.sql ``` ### Step 4: Stop Existing Server ```bash pkill -f api-server sleep 2 ``` ### Step 5: Start Server with Database ```bash cd ~/projects/proxmox/explorer-monorepo/backend export DB_PASSWORD='L@ker$2010' export JWT_SECRET='deployment-secret-$(date +%s)' export RPC_URL='http://192.168.11.250:8545' export CHAIN_ID=138 export PORT=8080 export DB_HOST='localhost' export DB_USER='explorer' export DB_NAME='explorer' nohup ./bin/api-server > logs/api-server.log 2>&1 & echo $! > logs/api-server.pid sleep 3 ``` ### Step 6: Verify Server ```bash # Check health curl http://localhost:8080/health # Check features curl http://localhost:8080/api/v1/features # Test Track 1 curl http://localhost:8080/api/v1/track1/blocks/latest?limit=5 # Test auth curl -X POST http://localhost:8080/api/v1/auth/nonce \ -H 'Content-Type: application/json' \ -d '{"address":"0x1234567890123456789012345678901234567890"}' ``` ## Expected Results After completion, you should see: ✅ **Database:** Connected and migrated ✅ **Server:** Running on port 8080 ✅ **Health:** Shows database as "ok" ✅ **Endpoints:** All responding correctly ✅ **Track 1:** Fully operational ✅ **Track 2-4:** Configured and protected ## Verification Commands ```bash # Check server process ps aux | grep api-server # Check server logs tail -f backend/logs/api-server.log # Test health endpoint curl http://localhost:8080/health | jq . # Test feature flags curl http://localhost:8080/api/v1/features | jq . # Verify database tables PGPASSWORD='L@ker$2010' psql -h localhost -U explorer -d explorer -c " SELECT table_name FROM information_schema.tables WHERE table_schema = 'public' AND table_name IN ('wallet_nonces', 'operator_roles', 'addresses', 'token_transfers') ORDER BY table_name; " ``` ## Next Steps After Deployment 1. **Test Authentication Flow** - Connect wallet in frontend - Request nonce - Sign message - Get JWT token 2. **Approve Users** ```bash export DB_PASSWORD='L@ker$2010' bash scripts/approve-user.sh