Assist_Design/DEPLOYMENT.md
T. Narantuya 81c0efb0b8 Remove example environment configuration files and update Dockerfile for production dependency installation
- Deleted .env.dev.example and .env.production.example files to streamline configuration management.
- Updated Dockerfile to install production dependencies recursively, ensuring all necessary packages are included during the build process.
2025-08-29 16:25:59 +09:00

2.2 KiB

🚀 Deployment Guide

📁 Environment Files Overview

Development:

  • .env - Your local development environment (active)
  • .env.example - Development template for new developers

Production:

  • .env.production - Production environment for Plesk deployment
  • compose-plesk.yaml - Docker Stack definition

🔧 Plesk Deployment Steps

Step 1: Authenticate Docker (One-time)

# SSH to Plesk server
echo "YOUR_GITHUB_TOKEN" | docker login ghcr.io -u ntumurbars --password-stdin

Step 2: Upload Files to Plesk

Upload these files to your domain directory:

  1. compose-plesk.yaml - Docker Stack definition
  2. .env.production - Environment variables (rename to .env)

Step 3: Deploy Stack

  1. Plesk → Docker → Stacks → Add Stack
  2. Project name: customer-portal
  3. Method: Upload file or paste compose-plesk.yaml content
  4. Deploy

Step 4: Configure Nginx Proxy

  1. Plesk → Websites & Domains → yourdomain.com → Docker Proxy Rules
  2. Add rule: /portal-frontend → port 3000
  3. Add rule: /apiportal-backend → port 4000

🔄 Update Workflow

When You Push Code:

  1. GitHub Actions builds new images automatically
  2. SSH to Plesk and update:
    cd /var/www/vhosts/yourdomain.com/httpdocs/
    docker compose -f compose-plesk.yaml pull
    docker compose -f compose-plesk.yaml up -d
    

🔐 Environment Variables

Your compose file uses these key variables from .env.production:

Database:

  • POSTGRES_DB, POSTGRES_USER, POSTGRES_PASSWORD
  • DATABASE_URL - Full connection string

Application:

  • JWT_SECRET, CORS_ORIGIN
  • NEXT_PUBLIC_API_BASE, NEXT_PUBLIC_APP_NAME

External APIs:

  • WHMCS_BASE_URL, WHMCS_API_IDENTIFIER, WHMCS_API_SECRET
  • SF_LOGIN_URL, SF_CLIENT_ID, SF_USERNAME

Email & Logging:

  • SENDGRID_API_KEY, EMAIL_FROM
  • LOG_LEVEL, LOG_FORMAT

Ready to Deploy!

Your setup is clean and production-ready:

  • Environment variables properly configured
  • Docker secrets via environment variables
  • Database and Redis secured (localhost only)
  • Automated image building
  • Clean file structure