🚀 Deployment Guide

Production-Ready Deployment

Comprehensive deployment options and step-by-step guides for deploying the staffing portal to various hosting platforms with production-ready configurations.

🌐 Deployment Options

VPS/Cloud Hosting

  • Full Control - Complete server access
  • Scalability - Easy resource scaling
  • SSL Support - HTTPS configuration
  • Custom Domain - Your own domain
  • Database - PostgreSQL support
  • Cost - $5-50/month

Platform as a Service

  • Easy Setup - One-click deployment
  • Auto Scaling - Automatic resource management
  • CI/CD - Integrated deployment pipeline
  • Monitoring - Built-in analytics
  • Backups - Automated backups
  • Cost - $0-30/month

Shared Hosting

  • Low Cost - Budget-friendly option
  • Frontend Only - Static site deployment
  • Limited Backend - External API required
  • Easy Upload - FTP/cPanel upload
  • No Database - External database needed
  • Cost - $2-10/month

🔧 Quick Setup (Development)

# Clone the repository git clone <repository-url> cd staffing-portal # Backend Setup cd backend python -m venv virtual source virtual/bin/activate # Linux/Mac virtual\Scripts\activate # Windows pip install -r requirements.txt python manage.py migrate python manage.py createsuperuser python manage.py runserver # Frontend Setup (new terminal) cd frontend npm install npm run dev # Access Application Frontend: http://localhost:5173 Backend: http://localhost:8000

🏗️ Production Deployment Steps

1. Server Preparation

Set up a VPS with Ubuntu/CentOS, install Python 3.8+, Node.js 18+, PostgreSQL, and Nginx. Configure firewall and security settings.

2. Database Setup

Install and configure PostgreSQL, create database and user, set up connection settings, and run initial migrations.

3. Backend Configuration

Configure Django settings for production, set up environment variables, install dependencies, and configure Gunicorn WSGI server.

4. Frontend Build

Build React application for production, optimize assets, configure API endpoints, and prepare static files for serving.

5. Web Server Setup

Configure Nginx as reverse proxy, set up SSL certificates, configure static file serving, and enable HTTPS redirects.

6. Go Live

Start services, test all functionality, configure monitoring, set up backups, and monitor performance metrics.

🐳 Docker Deployment

# Docker Compose Configuration version: '3.8' services: db: image: postgres:13 environment: POSTGRES_DB: staffing_portal POSTGRES_USER: postgres POSTGRES_PASSWORD: password volumes: - postgres_data:/var/lib/postgresql/data backend: build: ./backend ports: - "8000:8000" depends_on: - db environment: - DATABASE_URL=postgresql://postgres:password@db:5432/staffing_portal frontend: build: ./frontend ports: - "80:80" depends_on: - backend volumes: postgres_data: # Deploy with Docker docker-compose up -d

☁️ Cloud Platform Deployment

Heroku

  • heroku create app-name
  • heroku addons:create heroku-postgresql
  • git push heroku main
  • Configure environment variables
  • Automatic SSL & domain

Railway

  • Connect GitHub repository
  • Add PostgreSQL service
  • Automatic deployment
  • Environment configuration
  • Built-in monitoring

AWS/DigitalOcean

  • EC2/Droplet instance
  • RDS/Managed database
  • S3/Spaces for files
  • Load balancer & SSL
  • CloudWatch monitoring

🔐 Environment Variables

# Backend Environment Variables (.env) DEBUG=False SECRET_KEY=your-secret-key-here DATABASE_URL=postgresql://user:password@host:port/dbname ALLOWED_HOSTS=yourdomain.com,www.yourdomain.com CORS_ALLOWED_ORIGINS=https://yourdomain.com # Email Configuration EMAIL_HOST=smtp.gmail.com EMAIL_PORT=587 EMAIL_HOST_USER=your-email@gmail.com EMAIL_HOST_PASSWORD=your-app-password # File Storage (AWS S3) AWS_ACCESS_KEY_ID=your-access-key AWS_SECRET_ACCESS_KEY=your-secret-key AWS_STORAGE_BUCKET_NAME=your-bucket-name # Frontend Environment Variables (.env) VITE_API_URL=https://api.yourdomain.com VITE_APP_NAME=Staffing Portal

📋 Deployment Checklist

Pre-Deployment

✅ Test all features locally
✅ Set up production database
✅ Configure environment variables
✅ Set up domain and SSL certificate
✅ Prepare backup strategy

Deployment

✅ Deploy backend API
✅ Run database migrations
✅ Build and deploy frontend
✅ Configure web server
✅ Test all endpoints

Post-Deployment

✅ Monitor application performance
✅ Set up error tracking
✅ Configure automated backups
✅ Test user workflows
✅ Document deployment process

🔧 Nginx Configuration

# /etc/nginx/sites-available/staffing-portal server { listen 80; server_name yourdomain.com www.yourdomain.com; return 301 https://$server_name$request_uri; } server { listen 443 ssl http2; server_name yourdomain.com www.yourdomain.com; ssl_certificate /path/to/certificate.crt; ssl_certificate_key /path/to/private.key; # Frontend location / { root /var/www/staffing-portal/frontend/dist; try_files $uri $uri/ /index.html; } # Backend API location /api/ { proxy_pass http://127.0.0.1:8000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } # Static files location /static/ { alias /var/www/staffing-portal/backend/static/; } # Media files location /media/ { alias /var/www/staffing-portal/backend/media/; } }