Files
asle/DEPLOYMENT.md
defiQUG 507d9a35b1 Add initial project structure and documentation files
- Created .gitignore to exclude sensitive files and directories.
- Added API documentation in API_DOCUMENTATION.md.
- Included deployment instructions in DEPLOYMENT.md.
- Established project structure documentation in PROJECT_STRUCTURE.md.
- Updated README.md with project status and team information.
- Added recommendations and status tracking documents.
- Introduced testing guidelines in TESTING.md.
- Set up CI workflow in .github/workflows/ci.yml.
- Created Dockerfile for backend and frontend setups.
- Added various service and utility files for backend functionality.
- Implemented frontend components and pages for user interface.
- Included mobile app structure and services.
- Established scripts for deployment across multiple chains.
2025-12-03 21:22:31 -08:00

3.3 KiB

ASLE Deployment Guide

Prerequisites

  • Docker and Docker Compose
  • Node.js 20+ (for local development)
  • Foundry (for contract deployment)
  • PostgreSQL 15+ (or use Docker)
  • Environment variables configured

Environment Setup

  1. Copy environment files:
cp backend/.env.example backend/.env
cp frontend/.env.example frontend/.env.local
  1. Configure environment variables in .env files

Database Setup

  1. Start PostgreSQL:
docker-compose up -d postgres
  1. Run migrations:
cd backend
npm install
npx prisma migrate deploy
npx prisma generate

Contract Deployment

Local Development

cd contracts
forge build
forge test

# Deploy to local network
forge script script/Deploy.s.sol:DeployScript --rpc-url http://localhost:8545 --broadcast --private-key $PRIVATE_KEY

Mainnet/Testnet Deployment

  1. Set environment variables:
export PRIVATE_KEY=your_private_key
export RPC_URL=https://your-rpc-url
export DEPLOYER_ADDRESS=your_deployer_address
  1. Deploy:
forge script script/Deploy.s.sol:DeployScript \
  --rpc-url $RPC_URL \
  --broadcast \
  --verify \
  --etherscan-api-key $ETHERSCAN_API_KEY \
  --private-key $PRIVATE_KEY
  1. Update environment files with deployed addresses

Backend Deployment

Local Development

cd backend
npm install
npm run dev

Docker

docker-compose up -d backend

Production

  1. Build image:
cd backend
docker build -t asle-backend .
  1. Run container:
docker run -d \
  --name asle-backend \
  -p 4000:4000 \
  --env-file backend/.env \
  asle-backend

Frontend Deployment

Local Development

cd frontend
npm install
npm run dev

Docker

docker-compose up -d frontend

Production (Vercel/Next.js)

cd frontend
npm install
npm run build
npm start

Or use Vercel:

vercel deploy --prod

Full Stack Deployment

Development

docker-compose up

Production

  1. Set production environment variables
  2. Update docker-compose.prod.yml if needed
  3. Deploy:
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d

Health Checks

  • Backend: http://localhost:4000/health
  • Frontend: http://localhost:3000
  • GraphQL: http://localhost:4000/graphql

Monitoring

  • Check logs: docker-compose logs -f
  • Database access: docker-compose exec postgres psql -U asle -d asle
  • Redis access: docker-compose exec redis redis-cli

Troubleshooting

  1. Database connection errors: Check PostgreSQL is running and credentials are correct
  2. Contract deployment fails: Verify RPC URL and private key
  3. Frontend can't connect: Check NEXT_PUBLIC_API_URL is set correctly
  4. Port conflicts: Update ports in docker-compose.yml

Security Checklist

  • Change all default passwords
  • Use strong JWT_SECRET
  • Configure CORS properly
  • Enable HTTPS in production
  • Set up firewall rules
  • Regular security updates
  • Backup database regularly
  • Monitor logs for suspicious activity

Backup and Recovery

Database Backup

docker-compose exec postgres pg_dump -U asle asle > backup_$(date +%Y%m%d).sql

Database Restore

docker-compose exec -T postgres psql -U asle asle < backup_20240101.sql