Deployments
Section titled “Deployments”Overview
Section titled “Overview”This document covers deployment processes for FSS websites, including automated FTP uploads and deployment workflows.
Automated FTP Deployment
Section titled “Automated FTP Deployment”SmartDebt Mission Page
Section titled “SmartDebt Mission Page”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:
- Double-click the desktop shortcut
- Script automatically uploads the file and displays confirmation
- 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
Deployment Logging
Section titled “Deployment Logging”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.htmlFailure Format:
[2025-12-11 14:50:23]: **ERROR** - Deployment failed: FTP permission errorSteps completed before failure: ✓ Source file validated: file.html (5000 bytes) ✓ Connected to ftp.talbotstevens.com ✓ Authentication successfulError details: 550 Permission deniedRationale:
- Success is expected → minimal logging
- Failure needs context → detailed diagnostic info
- Bold ERROR makes failures stand out in logs
Implementation Notes
Section titled “Implementation Notes”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:
-
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
-
Security Measures:
- ✅ Separate config file (not in source)
- ✅ Restrictive file permissions (Windows ACL)
- ✅ Git-ignored (never committed)
- ✅ Template for documentation
- ✅ Validation on script startup
-
Setup Process:
Terminal window # Copy templateCopy-Item .ftp_config.json.template .ftp_config.json# Edit with your credentialsnotepad .ftp_config.json# Permissions are automatically restricted -
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.
Parameterized Deployment Tool
Section titled “Parameterized Deployment Tool”The core ftp_deploy.py tool is fully parameterized for maximum reusability.
Usage:
python ftp_deploy.py <source_file> <remote_path> [--verify] [--config CONFIG]Examples:
# Deploy any file (remember /httpdocs/ root)python ftp_deploy.py D:\path\to\file.html /httpdocs/folder/file.html
# With verificationpython ftp_deploy.py file.html /httpdocs/docs/page.html --verify
# Different configpython ftp_deploy.py file.html /httpdocs/path/file.html --config custom_config.jsonArguments:
source_file: Local file path to uploadremote_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)
Deployment Script Template
Section titled “Deployment Script Template”The SmartDebt Mission script can be used as a template for other automated deployments.
To create a new deployment script:
-
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" -
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 rootFTP_URL = "https://talbotstevens.com/folder/your-file.html" -
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()
Deployment Folder Structure
Section titled “Deployment Folder Structure”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
Future Enhancements
Section titled “Future Enhancements”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
Troubleshooting
Section titled “Troubleshooting”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 Bypassflag - If running manually:
powershell -ExecutionPolicy Bypass -File "path\to\script.ps1"
Security
Section titled “Security”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
Related
Section titled “Related”- Background - Overview of FSS websites
- Cloudflare - Cloudflare deployment process
- Astro - Astro framework deployment considerations
SECURITY.md- Comprehensive security documentation
Last Updated: 2025-12-11