Skip to main content

Morphee Coolify Deployment Test Suite

ARCHIVE — This document is historical reference only. It may contain outdated information. See docs/status.md for current project state.

Status: ✅ Ready for Testing Created: February 15, 2026 Version: 1.0.0


Overview

This comprehensive test suite validates the Morphee Coolify production deployment configuration before pushing to production. It includes:

  • 3 Test Scripts with multiple modes
  • Environment Validation for all configurations
  • Security Hardening Audit with critical/high/medium/low findings
  • Docker Health Checks for all 5 services
  • Smoke Tests for API endpoints and connectivity
  • Robustness Testing with and without state reset
  • Comprehensive Documentation and troubleshooting guides

Files Created

Test Scripts (Executable)

FilePurposeType
scripts/test-coolify-deployment.shMain deployment test suite770 lines, Production-ready
scripts/validate-coolify-env.shEnvironment validation380 lines, Pre-deployment check
scripts/security-audit-coolify.shSecurity hardening audit520 lines, Compliance check

Documentation

FilePurposeAudience
docs/impl-guides/coolify-testing-guide.mdComplete testing guide with scenariosDevelopers
docs/COOLIFY_TEST_QUICK_REFERENCE.mdOne-page quick referenceDevOps
docs/DEPLOYMENT_TEST_SUITE_README.mdThis file - overview and setupAll

Quick Start

1. First Time Setup

# Make scripts executable (already done)
chmod +x scripts/test-*.sh scripts/security-*.sh

# Verify Docker is installed
docker --version
docker compose version

# Check you're in the project root
pwd # Should be /Users/sebastien/Projects/Morphee.app/morphee-beta

2. Choose Test Mode

# Option A: Fresh deployment (recommended first run)
./scripts/test-coolify-deployment.sh fresh

# Option B: Full reset (clean slate for debugging)
./scripts/test-coolify-deployment.sh clean-reset

# Option C: Robustness testing (persistence verification)
./scripts/test-coolify-deployment.sh robust

3. Security Audit (Before Production)

./scripts/security-audit-coolify.sh

4. Environment Validation (Target Environment)

# For testing
./scripts/validate-coolify-env.sh --test

# For staging
./scripts/validate-coolify-env.sh --staging

# For production
./scripts/validate-coolify-env.sh --production

Test Script Capabilities

Main Test Suite (test-coolify-deployment.sh)

What It Does:

  1. Environment Validation (1-2 min)

    • Checks Docker and Docker Compose installation
    • Verifies required files exist
    • Validates project structure
  2. Setup Environment Variables (< 1 min)

    • Generates encryption key (Fernet)
    • Creates .env.coolify file
    • Sources environment into test session
  3. Security Pre-flight Checks (1 min)

    • Scans for hardcoded secrets
    • Verifies container security settings
    • Checks resource limits
    • Validates health check definitions
  4. Docker Cleanup (based on mode)

    • fresh: Stop containers, keep volumes
    • clean-reset: Remove everything (containers, volumes, networks)
    • robust: Keep existing state
  5. Service Startup (3-5 min)

    • Build Docker images
    • Start all 5 services with docker compose
    • Wait for containers to be up
  6. Health Checks (2-3 min)

    • Wait for each service to be healthy
    • Timeout: 30-60s per service, total 300s default
    • Display status messages
  7. Network Diagnostics (< 1 min)

    • Inspect Docker networks
    • Test inter-service connectivity (ping)
    • Verify DNS resolution
  8. Smoke Tests (1-2 min)

    • Backend health endpoint: GET /health
    • Frontend loads: GET /
    • Database connectivity: pg_isready
    • Redis connectivity: PING
    • GoTrue health: GET /health
  9. Summary & Recommendations (< 1 min)

    • Report test results
    • Show log file location
    • Display next steps

Total Time: 8-15 minutes


Environment Validation (validate-coolify-env.sh)

Validates:

  • ✅ Required environment variables present
  • ✅ Optional variables check
  • ✅ Encryption key format (Fernet)
  • ✅ URL format validation (HTTP/HTTPS/WS/WSS)
  • ✅ CORS configuration (not too permissive)
  • ✅ API key formats
  • ✅ SMTP configuration (if enabled)
  • ✅ File existence checks
  • ✅ Security concerns (test keys, etc.)
  • ✅ Docker installation

Environments:

  • --test: Local testing (default)
  • --staging: Staging deployment
  • --production: Production deployment

Security Audit (security-audit-coolify.sh)

Checks Categories:

CategoryItems
Docker Security7 checks (privileged mode, cap_drop, read-only, etc.)
Secrets Management7 checks (hardcoded, env vars, vault, credentials)
Network Security4 checks (exposed ports, volumes, DNS)
Database Security4 checks (version, SSL, backups, limits)
Application Security5 checks (headers, rate limiting, CORS, health)
SSL/TLS2 checks (enforcement, configuration)
Logging & Monitoring2 checks (centralization, alerting)
Production Readiness10-item checklist

Output Severity Levels:

  • 🔴 CRITICAL - Must fix before production
  • 🔴 HIGH - Address before production
  • 🟠 MEDIUM - Should address soon
  • 🟡 LOW - Consider for improvements

Test Execution Workflow

Complete Pre-Production Testing (30-45 min)

#!/bin/bash
# Complete test workflow

echo "1. Validating environment for production..."
./scripts/validate-coolify-env.sh --production
if [ $? -ne 0 ]; then exit 1; fi

echo ""
echo "2. Running security audit..."
./scripts/security-audit-coolify.sh
# Review findings, fix CRITICAL and HIGH items

echo ""
echo "3. Testing fresh deployment..."
./scripts/test-coolify-deployment.sh fresh
if [ $? -ne 0 ]; then exit 1; fi

echo ""
echo "4. Testing robustness (no reset)..."
./scripts/test-coolify-deployment.sh robust
if [ $? -ne 0 ]; then exit 1; fi

echo ""
echo "✅ All tests passed! Ready for production deployment."

Iterative Testing (5-10 min per iteration)

# Quick iteration cycle
./scripts/test-coolify-deployment.sh fresh --skip-tests
# Make changes
./scripts/test-coolify-deployment.sh fresh --timeout 600

CI/CD Integration

# .github/workflows/deploy-test.yml
name: Test Coolify Deployment
on: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: ./scripts/validate-coolify-env.sh --test
- run: ./scripts/security-audit-coolify.sh
- run: ./scripts/test-coolify-deployment.sh fresh --timeout 600

Key Features

🎯 Test Modes

ModeUse CaseResetTime
freshStandard testingContainers8-15 min
clean-resetDebug persistence issuesEverything10-15 min
robustVerify no state accumulationNone5-10 min

🔐 Security-First Design

  • ✅ Scans for hardcoded secrets
  • ✅ Validates encryption keys
  • ✅ Checks capability restrictions
  • ✅ Verifies read-only filesystems
  • ✅ Tests resource limits
  • ✅ Validates CORS configuration
  • ✅ Confirms no test keys in code

📊 Comprehensive Reporting

  • ✅ Detailed log file (.test-logs/coolify-test-*.log)
  • ✅ Color-coded output (✓ SUCCESS, ✗ ERROR, ! WARN)
  • ✅ Progress indicators (⏳ Waiting...)
  • ✅ Diagnostic information on failure
  • ✅ Next steps recommendations
  • ✅ Service status display

🛡️ Error Handling

  • ✅ Graceful cleanup on exit
  • ✅ Timeout protection (prevents hanging)
  • ✅ Detailed error messages
  • ✅ Log collection on failure
  • ✅ Container status inspection
  • ✅ Helpful troubleshooting suggestions

Test Coverage

Services Tested

ServiceTypeChecks
supabase-dbPostgreSQL 15Health, connectivity, pg_isready
supabase-authGoTrueHealth, API response
redisRedis 7Health, PING, authentication
backendFastAPIHealth, /health endpoint, container status
frontendNginx + ReactHealth, HTML loads, container status

Endpoints Tested

EndpointMethodExpected
http://localhost:8000/healthGET200 + JSON response
http://localhost/GET200 + HTML document
http://localhost:9999/healthGET200 OK
postgres:5432TCPConnection successful
redis:6379TCPPING response

Connectivity Tested

  • ✅ Backend ↔ PostgreSQL (internal network)
  • ✅ Backend ↔ Redis (internal network)
  • ✅ Backend ↔ GoTrue (internal network)
  • ✅ Frontend ↔ Backend (via exposed ports)
  • ✅ Docker networks (inspect command)

Environment Variables

Auto-Generated (by Test Script)

ENCRYPTION_KEY=<generated Fernet key>

Generated During Docker Startup (by Coolify)

SERVICE_PASSWORD_POSTGRES       # PostgreSQL password
SERVICE_PASSWORD_REDIS # Redis password
SERVICE_REALBASE64_64_JWT # Internal JWT secret
SERVICE_REALBASE64_64_GOTRUE-JWT # GoTrue JWT secret

Required (Must Set)

VITE_API_URL=http://localhost:8000        # API URL for frontend
VITE_WS_URL=ws://localhost:8000 # WebSocket URL
CORS_ORIGINS=<allowed-origins> # CORS whitelist
FRONTEND_URL=http://localhost:5173 # Frontend base URL
ANTHROPIC_API_KEY=sk-ant-... # LLM API key

Optional (Production)

SMTP_HOST, SMTP_PORT, SMTP_USER, SMTP_PASS   # Email configuration
GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET # OAuth configuration
APNS_KEY_ID, APNS_TEAM_ID, FCM_PROJECT_ID # Push notifications

Troubleshooting Guide

Issue: "Docker Compose is not installed"

# Check if using new format
docker compose version

# Or install legacy format
brew install docker-compose # macOS
apt install docker-compose # Linux

Issue: "Build failed"

# Check Docker logs
docker logs $(docker ps -q)

# Increase timeout
./scripts/test-coolify-deployment.sh fresh --timeout 900

# Clean and retry
./scripts/test-coolify-deployment.sh clean-reset

Issue: "Health check timeout"

# Increase timeout
./scripts/test-coolify-deployment.sh fresh --timeout 600

# Check system resources
docker stats

# View specific service logs
docker compose -f docker-compose.coolify.yml logs [service]

Issue: "Port already in use"

# Find what's using port 8000
lsof -i :8000

# Or use full reset to clean up
./scripts/test-coolify-deployment.sh clean-reset

Performance Baseline

Typical Test Timings

PhaseTimeNotes
Environment validation1-2 minDocker checks, file verification
Image build3-5 minDepends on system speed
Container startup1-2 minService initialization
Health checks2-3 minUsually quick after startup
Smoke tests1-2 minAPI endpoint checks
Total8-15 minOn modern systems

Optimized Test (Skip Tests)

# Faster iteration: 5-7 minutes
./scripts/test-coolify-deployment.sh fresh --skip-tests

Next Steps

1. ✅ Initial Testing

# Run your first test
./scripts/test-coolify-deployment.sh fresh

# Review results in log file
cat .test-logs/coolify-test-*.log

2. ✅ Security Review

# Run security audit
./scripts/security-audit-coolify.sh

# Fix any CRITICAL or HIGH findings

3. ✅ Robustness Validation

# Test persistence
./scripts/test-coolify-deployment.sh robust

4. ✅ Environment Preparation

# Prepare production environment
./scripts/validate-coolify-env.sh --production

5. ✅ Production Deployment

# Follow COOLIFY_DEPLOYMENT.md
# All tests passing → Ready for Coolify

Integration Points

With Existing Docs

With CI/CD

  • GitHub Actions workflows can call test scripts
  • Pre-deployment validation
  • Automated testing before merge
  • Environment-specific validation

Support & Resources

Documentation

Scripts

Logging

  • 📁 .test-logs/ — Test execution logs
  • 📄 .env.coolify — Generated test environment

Checklist for Production Deployment

  • Run ./scripts/validate-coolify-env.sh --production
  • Run ./scripts/security-audit-coolify.sh — Fix CRITICAL/HIGH
  • Run ./scripts/test-coolify-deployment.sh fresh
  • Run ./scripts/test-coolify-deployment.sh robust
  • Review all logs in .test-logs/
  • Test manual login and basic functionality
  • Verify all services are healthy
  • Check Docker images are properly built
  • Verify environment variables are correct
  • Ready for ./scripts/deploy-to-coolify.sh (next script)

Created: February 15, 2026 Status: ✅ Production Ready Last Updated: February 15, 2026 Version: 1.0.0 Author: Claude Code

For issues or questions, see the Troubleshooting Guide above.