4.4 KiB
4.4 KiB
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
cd ~/projects/proxmox/explorer-monorepo
2. Run Complete Deployment Script
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
PGPASSWORD='L@ker$2010' psql -h localhost -U explorer -d explorer -c "SELECT 1;"
Step 2: Check Existing Tables
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
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
pkill -f api-server
sleep 2
Step 5: Start Server with Database
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
# 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
# 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
-
Test Authentication Flow
- Connect wallet in frontend
- Request nonce
- Sign message
- Get JWT token
-
Approve Users
export DB_PASSWORD='L@ker$2010' bash scripts/approve-user.sh <address> <track_level> -
Test Track 2-4 Endpoints
- Use JWT token from authentication
- Test protected endpoints
-
Start Indexers (Optional)
cd backend/indexer go run main.go
Troubleshooting
If Database Connection Fails
- Verify PostgreSQL is running:
systemctl status postgresql - Check user exists:
sudo -u postgres psql -c "\du" - Verify password:
L@ker$2010
If Server Won't Start
- Check logs:
tail -50 backend/logs/api-server.log - Verify port 8080 is free:
netstat -tuln | grep 8080 - Check environment variables are set
If Migration Fails
- Some tables may already exist (this is OK)
- Check existing tables: See Step 2 above
- Migration is idempotent (safe to run multiple times)
Status
All deployment scripts and documentation are ready. Execute the commands above to complete the deployment.
Files Created:
- ✅
scripts/run-all-deployment.sh- Automated deployment - ✅
scripts/fix-database-connection.sh- Database connection helper - ✅
scripts/test-full-deployment.sh- Complete test suite - ✅
DEPLOYMENT_FINAL_STATUS.md- Status report - ✅
COMPLETE_DEPLOYMENT.md- This file
Ready for execution!