GenNet

GenNet Platform - Deployment Guide

Quick Start

# Simple one-command deployment
./scripts/deploy.sh local

This will:

Production Deployment

# Deploy to production
./scripts/deploy.sh production prod

Prerequisites

For Local Deployment

For Production Deployment

Deployment Modes

1. Local Deployment

Local deployment uses Docker Compose to run all services locally.

# Deploy locally
./scripts/deploy.sh local

# Check service status
docker-compose ps

# View logs
docker-compose logs -f [service-name]

# Stop services
docker-compose down

# Stop and remove volumes
./scripts/undeploy.sh local

Services will be available at:

2. Production Deployment

Production deployment uses Terraform for infrastructure and Kubernetes for orchestration.

Step 1: Configure Terraform

cd infrastructure/terraform
cp terraform.tfvars.example terraform.tfvars
# Edit terraform.tfvars with your values

Step 2: Configure AWS Credentials

aws configure
# Or set environment variables:
export AWS_ACCESS_KEY_ID=your-key
export AWS_SECRET_ACCESS_KEY=your-secret
export AWS_DEFAULT_REGION=us-east-1

Step 3: Deploy

./scripts/deploy.sh production prod

The script will:

  1. Initialize Terraform
  2. Plan infrastructure changes
  3. Ask for confirmation
  4. Apply infrastructure
  5. Deploy to Kubernetes

Step 4: Verify Deployment

# Check Kubernetes deployments
kubectl get deployments -n gennet-system

# Check pods
kubectl get pods -n gennet-system

# View logs
kubectl logs -f deployment/auth-service -n gennet-system

Environment Variables

Common Variables

Service-Specific Variables

See individual service directories for required environment variables.

Example for auth-service:

export DATABASE_URL=postgresql://user:pass@host:5432/gennet
export REDIS_URL=redis://host:6379/0
export JWT_SECRET_KEY=your-secret-key

Advanced Usage

Deploy with Tests

RUN_TESTS=true ./scripts/deploy.sh local

Deploy without Building Images

SKIP_BUILD=true ./scripts/deploy.sh local

Custom Environment

./scripts/deploy.sh production staging

Manual Steps

If you prefer manual deployment:

Local:

# Install dependencies
pip install -r requirements-dev.txt
pip install -r services/*/requirements.txt

# Start services
docker-compose up -d

Production:

# Infrastructure
cd infrastructure/terraform
terraform init
terraform plan
terraform apply

# Kubernetes
kubectl apply -f infrastructure/kubernetes/

Troubleshooting

Common Issues

1. Docker daemon not running

# Start Docker
sudo systemctl start docker
# Or start Docker Desktop

2. Port already in use

# Check what's using the port
sudo lsof -i :8000
# Kill the process or change port in docker-compose.yml

3. Terraform authentication errors

# Verify AWS credentials
aws sts get-caller-identity
# Reconfigure if needed
aws configure

4. Kubernetes connection issues

# Check kubectl context
kubectl config current-context
# Switch context if needed
kubectl config use-context <context-name>

5. Service health check failures

# Check service logs
docker-compose logs [service-name]
# Or for Kubernetes
kubectl logs -f deployment/[service-name] -n gennet-system

Validation

Run validation script to check setup:

./scripts/validate_setup.sh

Logs

Local:

# All services
docker-compose logs -f

# Specific service
docker-compose logs -f auth-service

Production:

# All pods
kubectl logs -f -l app=gennet -n gennet-system

# Specific deployment
kubectl logs -f deployment/auth-service -n gennet-system

Undeployment

Local

./scripts/undeploy.sh local
# Or
docker-compose down -v

Production

./scripts/undeploy.sh production
# This will:
# - Remove Kubernetes resources
# - Ask for confirmation before destroying infrastructure

Security Considerations

Local Development

Production

Monitoring

Local

Production

Backup and Recovery

Database Backups

Infrastructure State

Rollback

Local

docker-compose down
# Edit docker-compose.yml or code
docker-compose up -d

Production

# Rollback Kubernetes deployment
kubectl rollout undo deployment/[service-name] -n gennet-system

# Rollback Terraform (if needed)
cd infrastructure/terraform
terraform plan -destroy
terraform apply -target=<resource>

Next Steps

After deployment:

  1. Verify all services are healthy
  2. Run smoke tests
  3. Check logs for errors
  4. Monitor resource usage
  5. Set up alerts (production)

For more details, see: