Skip to content

This document covers deployment processes for FSS websites, including automated FTP uploads and deployment workflows.



Purpose: Automate uploading smartdebt-mission.html from local development to production website.

Setup: One-time configuration (already completed)

Location:

  • Core Tool: ftp_deploy.py - Parameterized FTP deployment utility
  • Wrapper: deploy_smartdebt_mission.py - Specific configuration for this page
  • Shortcut: Desktop shortcut “Upload SmartDebt Mission”

Usage:

  1. Double-click the desktop shortcut
  2. Script automatically uploads the file and displays confirmation
  3. View results in PowerShell window (stays open)

Technical Details:

  • Source: D:\FSS\Websites\SDC.com\Mission\smartdebt-mission.html
  • FTP Path: /httpdocs/sdc/smartdebt-mission.html
  • Web URL: https://talbotstevens.com/sdc/smartdebt-mission.html
  • FTP Server: ftp.talbotstevens.com
  • Protocol: FTP via Python’s ftplib (binary mode)
  • Implementation: Python 3 (following global standards for system utilities)
  • Directory Handling: Auto-creates remote directories if needed

Important: The FTP server uses /httpdocs/ as the web root. Files must be uploaded to /httpdocs/<path> to be accessible at https://talbotstevens.com/<path>.

Features:

  • 4-stage deployment process: Verify file → Test connection → Upload → Verify
  • Professional console output: Color-coded progress with clear status indicators
  • Comprehensive logging: All deployments logged to deployment-log.md
  • Persistent window: Window stays open to show results (press any key to close)
  • Error handling: Detailed error messages with timestamps
  • Deployment metrics: File size, duration, timestamps for each deployment
  • Validates source file exists before upload
  • Tests FTP connection before attempting upload
  • Uses passive FTP mode for firewall compatibility
  • Binary transfer mode for reliability

All deployment activities are automatically logged to maintain a complete audit trail.

Log file location: D:\FSS\Websites\utils\deployment-scripts\deployment.log

Logging Philosophy:

  • Success: One concise line (default expected outcome)
  • Failure: Detailed steps + bolded ERROR for debugging

Success Format:

[2025-12-11 14:42:08]: Deployed D:\FSS\Websites\SDC.com\Mission\smartdebt-mission.html to ftp.talbotstevens.com/sdc/smartdebt-mission.html

Failure Format:

[2025-12-11 14:50:23]: **ERROR** - Deployment failed: FTP permission error
Steps completed before failure:
✓ Source file validated: file.html (5000 bytes)
✓ Connected to ftp.talbotstevens.com
✓ Authentication successful
Error details: 550 Permission denied

Rationale:

  • Success is expected → minimal logging
  • Failure needs context → detailed diagnostic info
  • Bold ERROR makes failures stand out in logs

2025-12-11: Migrated from PowerShell to Python implementation

  • Python version: Requires Python 3.6+

Credential Management:

⚠️ CRITICAL SECURITY UPDATE (2025-12-11):

Credentials are never stored in source code. Instead:

  1. Configuration File: .ftp_config.json

    • Stored separately from script code
    • Restricted file permissions (owner-only access on Windows)
    • Excluded from version control via .gitignore
    • Template provided: .ftp_config.json.template
  2. Security Measures:

    • ✅ Separate config file (not in source)
    • ✅ Restrictive file permissions (Windows ACL)
    • ✅ Git-ignored (never committed)
    • ✅ Template for documentation
    • ✅ Validation on script startup
  3. Setup Process:

    Terminal window
    # Copy template
    Copy-Item .ftp_config.json.template .ftp_config.json
    # Edit with your credentials
    notepad .ftp_config.json
    # Permissions are automatically restricted
  4. Future Enhancements:

    • Environment variables for CI/CD
    • Doppler or similar secret manager for team environments
    • Windows Credential Manager integration

This follows professional world-class security standards.


The core ftp_deploy.py tool is fully parameterized for maximum reusability.

Usage:

Terminal window
python ftp_deploy.py <source_file> <remote_path> [--verify] [--config CONFIG]

Examples:

Terminal window
# Deploy any file (remember /httpdocs/ root)
python ftp_deploy.py D:\path\to\file.html /httpdocs/folder/file.html
# With verification
python ftp_deploy.py file.html /httpdocs/docs/page.html --verify
# Different config
python ftp_deploy.py file.html /httpdocs/path/file.html --config custom_config.json

Arguments:

  • source_file: Local file path to upload
  • remote_path: Remote FTP destination (e.g., /sdc/file.html)
  • --verify: Verify upload by checking remote file size
  • --config: Config file path (default: .ftp_config.json)
  • --log: Log file path (default: deployment.log)

The SmartDebt Mission script can be used as a template for other automated deployments.

To create a new deployment script:

  1. Copy the existing script:

    Terminal window
    Copy-Item "D:\FSS\Websites\utils\deployment-scripts\upload_smartdebt_mission.py" `
    "D:\FSS\Websites\utils\deployment-scripts\upload_yourfile.py"
  2. Edit the configuration section in main():

    SOURCE_FILE = Path(r"D:\FSS\path\to\your-file.html")
    FTP_PATH = "/httpdocs/folder/your-file.html" # Note: /httpdocs/ is web root
    FTP_URL = "https://talbotstevens.com/folder/your-file.html"
  3. Create a desktop shortcut:

    Terminal window
    $WshShell = New-Object -ComObject WScript.Shell
    $Shortcut = $WshShell.CreateShortcut("$env:USERPROFILE\Desktop\Upload YourFile.lnk")
    $Shortcut.TargetPath = "python"
    $Shortcut.Arguments = "`"D:\FSS\Websites\utils\deployment-scripts\upload_yourfile.py`""
    $Shortcut.IconLocation = "shell32.dll,16"
    $Shortcut.Save()

D:\FSS\Websites\utils\
└── deployment-scripts\
├── upload_smartdebt_mission.py
├── .ftp_config.json # Credentials (git-ignored, restricted permissions)
├── .ftp_config.json.template # Template for setup
├── .gitignore # Protects credentials from git
├── deployment-log.md
├── README.md
└── [other deployment scripts]

Why this structure:

  • Centralized location for all website utilities
  • Separate from website content (not deployed)
  • Easy to version control if needed
  • Desktop shortcuts point to stable paths

Potential improvements:

  • Add batch deployment for multiple files
  • Integrate with git hooks for automatic deployment on commit
  • Add deployment logging/history
  • Create deployment dashboard or GUI
  • Add deployment notifications (email/Slack)
  • Implement rollback functionality

Script fails with “file not found”:

  • Verify source file path is correct
  • Check that file exists: Test-Path "D:\FSS\Websites\SDC.com\Mission\smartdebt-mission.html"

FTP connection fails:

  • Verify internet connection
  • Check FTP credentials: cmdkey /list:FTP_talbotstevens.com
  • Confirm FTP server is accessible: Test-NetConnection ftp.talbotstevens.com -Port 21

Permission denied errors:

  • Verify FTP user has write permissions to destination folder
  • Check Windows Firewall isn’t blocking outbound FTP

Script won’t run (execution policy):

  • Shortcut includes -ExecutionPolicy Bypass flag
  • If running manually: powershell -ExecutionPolicy Bypass -File "path\to\script.ps1"

See D:\FSS\Websites\utils\deployment-scripts\SECURITY.md for complete security documentation including:

  • Credential management best practices
  • Security checklist
  • Verification commands
  • Incident response procedures
  • Upgrade paths for enhanced security

Key Security Features:

  • ✅ No credentials in source code
  • ✅ Restrictive file permissions (Windows ACL)
  • ✅ Git-ignored configuration
  • ✅ Runtime validation
  • ✅ Professional standards compliant

  • Background - Overview of FSS websites
  • Cloudflare - Cloudflare deployment process
  • Astro - Astro framework deployment considerations
  • SECURITY.md - Comprehensive security documentation

Last Updated: 2025-12-11