npm install -g ganache
ganache --database.dbPath ./blockchain-data --server.port 8545npm run contracts:compile
npm run contracts:deployCopy contract addresses and update .env.local:
NEXT_PUBLIC_CROP_MARKETPLACE_ADDRESS=0x...
NEXT_PUBLIC_PRICE_ORACLE_ADDRESS=0x...
# Voice/USSD API
node backend/voice-api.js
# In another terminal:
python backend/ai-service.pynpm run devVisit: http://localhost:3000
ssh user@your-server-ipcurl -fsSL https://raw.githubusercontent.com/your-team/jandhan-plus/main/server-setup/setup.sh | bashOr manually:
bash server-setup/setup.shcd ~/jandhan-plus
git clone https://github.com/your-team/jandhan-plus.git .
npm install --legacy-peer-depscp .env.local.example .env.local
# Edit .env.local with your PostgreSQL password and contract addressespsql -U jandhan_user -d jandhan_plus -h localhost < supabase/migrations/001_create_users.sql
psql -U jandhan_user -d jandhan_plus -h localhost < supabase/migrations/002_create_crops.sql
psql -U jandhan_user -d jandhan_plus -h localhost < supabase/migrations/003_create_offers.sql
psql -U jandhan_user -d jandhan_plus -h localhost < supabase/migrations/004_create_payments.sql
psql -U jandhan_user -d jandhan_plus -h localhost < supabase/migrations/005_create_transactions.sqlnpm run contracts:deploy
# Update .env.local with new addressesnpm run build
pm2 start npm --name "jandhan-next" -- start
pm2 start backend/voice-api.js --name "jandhan-voice"
pm2 start backend/ai-service.py --name "jandhan-ai" --interpreter python3
# Start Ganache as service
pm2 start "ganache --database.dbPath ~/jandhan-blockchain --server.port 8545 --server.host 0.0.0.0" --name "ganache"
pm2 save
pm2 startupsudo cp server-setup/nginx.conf /etc/nginx/sites-available/jandhan-plus
sudo ln -s /etc/nginx/sites-available/jandhan-plus /etc/nginx/sites-enabled/
sudo rm /etc/nginx/sites-enabled/default
sudo nginx -t
sudo systemctl reload nginxsudo ufw enable
sudo ufw allow 22/tcp
sudo ufw allow 80/tcp
sudo ufw allow 443/tcphttp://your-server-ip/
- Farmer: http://your-server-ip/farmer
- Buyer: http://your-server-ip/buyer
- Consumer: http://your-server-ip/consumer
- Admin: http://your-server-ip/admin
- USSD: http://your-server-ip/ussd
# Check Ganache
curl http://127.0.0.1:8545
# Check Next.js
curl http://localhost:3000
# Check Voice API
curl http://localhost:4000/market/prices
# Check AI Service
curl http://localhost:5000/# Check services
pm2 list
# View logs
pm2 logs
# Check database
psql -U jandhan_user -d jandhan_plus -h localhost -c "\dt"
# Check Nginx
sudo systemctl status nginxPort already in use?
# Find what's using port 3000
lsof -i :3000
# Kill it
kill -9 <PID>Contract deployment fails?
- Make sure Ganache is running
- Check GANACHE_RPC_URL in .env.local
Database connection fails?
- Verify PostgreSQL is running:
sudo systemctl status postgresql - Check password in .env.local matches setup
Nginx not routing?
- Check config:
sudo nginx -t - View errors:
sudo tail -f /var/log/nginx/error.log
- Enable Redis caching
- Use PM2 clustering:
pm2 start npm --name "jandhan-next" -i max -- start - Monitor with:
pm2 monit