2025-10-28 10:38:12 +01:00
|
|
|
# Tasks: add-ftps-deployment
|
|
|
|
|
|
|
|
|
|
## Implementation Tasks
|
|
|
|
|
|
|
|
|
|
### 1. Create deployment script structure
|
2025-10-28 10:53:45 +01:00
|
|
|
- [x] Create `scripts/` directory in project root if it doesn't exist
|
|
|
|
|
- [x] Create `scripts/deploy.sh` with proper shebang and execution permissions
|
|
|
|
|
- [x] Add basic script structure with functions for connection, upload, and error handling
|
2025-10-28 10:38:12 +01:00
|
|
|
- **Validates**: Script file exists and is executable
|
|
|
|
|
|
|
|
|
|
### 2. Implement prerequisite checks
|
2025-10-28 10:53:45 +01:00
|
|
|
- [x] Check for existence and non-empty state of `public/` directory
|
|
|
|
|
- [x] Verify `lftp` is installed and available in PATH
|
|
|
|
|
- [x] Check that `FTPS_PASSWORD` environment variable is set
|
|
|
|
|
- [x] Display clear error messages for any missing prerequisites
|
2025-10-28 10:38:12 +01:00
|
|
|
- **Validates**: Script exits early with helpful errors when prerequisites are missing
|
|
|
|
|
|
|
|
|
|
### 3. Implement FTPS connection logic
|
2025-10-28 10:53:45 +01:00
|
|
|
- [x] Configure lftp connection to www.markusgraf.ch with username "gurix"
|
|
|
|
|
- [x] Use `FTPS_PASSWORD` environment variable for authentication
|
|
|
|
|
- [x] Set FTPS-specific lftp settings (SSL/TLS requirements)
|
|
|
|
|
- [x] Implement connection timeout and retry logic
|
2025-10-28 10:38:12 +01:00
|
|
|
- **Validates**: Script can establish FTPS connection with correct credentials
|
|
|
|
|
|
|
|
|
|
### 4. Implement file upload functionality
|
2025-10-28 10:53:45 +01:00
|
|
|
- [x] Use lftp mirror command to upload `public/` contents to `httpsdocs/`
|
|
|
|
|
- [x] Configure upload to preserve file permissions and timestamps
|
|
|
|
|
- [x] Enable parallel transfers for improved performance
|
|
|
|
|
- [x] Handle special files (symlinks, hidden files) appropriately
|
2025-10-28 10:38:12 +01:00
|
|
|
- **Validates**: All files from public/ are correctly uploaded to httpsdocs/
|
|
|
|
|
|
|
|
|
|
### 5. Add progress and status reporting
|
2025-10-28 10:53:45 +01:00
|
|
|
- [x] Display connection status messages
|
|
|
|
|
- [x] Show upload progress (file counts, current file being uploaded)
|
|
|
|
|
- [x] Report upload completion with summary statistics
|
|
|
|
|
- [x] Ensure password is never displayed in output
|
2025-10-28 10:38:12 +01:00
|
|
|
- **Validates**: User receives clear feedback during deployment process
|
|
|
|
|
|
|
|
|
|
### 6. Implement error handling
|
2025-10-28 10:53:45 +01:00
|
|
|
- [x] Catch connection failures with descriptive error messages
|
|
|
|
|
- [x] Handle partial upload failures gracefully
|
|
|
|
|
- [x] Provide actionable error messages for common failure scenarios
|
|
|
|
|
- [x] Set appropriate exit codes (0 for success, non-zero for failures)
|
2025-10-28 10:38:12 +01:00
|
|
|
- **Validates**: Script handles errors gracefully and provides useful feedback
|
|
|
|
|
|
|
|
|
|
### 7. Add script documentation
|
2025-10-28 10:53:45 +01:00
|
|
|
- [x] Add header comments explaining script purpose and usage
|
|
|
|
|
- [x] Document required environment variables
|
|
|
|
|
- [x] Include example usage in comments
|
|
|
|
|
- [x] Add inline comments for complex lftp commands
|
2025-10-28 10:38:12 +01:00
|
|
|
- **Validates**: Script is self-documenting for future maintenance
|
|
|
|
|
|
|
|
|
|
### 8. Update project documentation
|
2025-10-28 10:53:45 +01:00
|
|
|
- [x] Add deployment section to README.md or create DEPLOYMENT.md
|
|
|
|
|
- [x] Document environment variable setup process
|
|
|
|
|
- [x] Provide example deployment workflow (build → deploy)
|
|
|
|
|
- [x] Include troubleshooting tips for common issues
|
2025-10-28 10:38:12 +01:00
|
|
|
- **Validates**: User documentation exists and covers deployment process
|
|
|
|
|
|
|
|
|
|
### 9. Test deployment script
|
2025-10-28 10:53:45 +01:00
|
|
|
- [x] Test with missing prerequisites (no public/, no lftp, no password)
|
|
|
|
|
- [x] Test with incorrect credentials
|
|
|
|
|
- [x] Test successful deployment with valid credentials
|
|
|
|
|
- [x] Verify uploaded files match local public/ directory
|
2025-10-28 10:38:12 +01:00
|
|
|
- **Validates**: Script behaves correctly in success and failure scenarios
|
|
|
|
|
|
|
|
|
|
### 10. Create .gitignore entry for environment files
|
2025-10-28 10:53:45 +01:00
|
|
|
- [x] Ensure .env files are ignored if user creates them locally
|
|
|
|
|
- [x] Verify credentials cannot be accidentally committed
|
2025-10-28 10:38:12 +01:00
|
|
|
- **Validates**: Git ignores any credential-containing files
|
|
|
|
|
|
|
|
|
|
## Dependency Notes
|
|
|
|
|
- Tasks 1-2 must complete before task 3
|
|
|
|
|
- Tasks 3-4 must complete before task 5
|
|
|
|
|
- Task 6 can be implemented in parallel with tasks 3-5
|
|
|
|
|
- Tasks 7-8 can be done after core implementation (tasks 1-6)
|
|
|
|
|
- Task 9 requires all implementation tasks (1-6) to be complete
|
|
|
|
|
- Task 10 can be done at any time
|
|
|
|
|
|
|
|
|
|
## Testing Strategy
|
|
|
|
|
Manual testing is sufficient for this change:
|
|
|
|
|
1. Test prerequisite checks by intentionally removing prerequisites
|
|
|
|
|
2. Test with invalid credentials to verify error handling
|
|
|
|
|
3. Test successful deployment to production server
|
|
|
|
|
4. Verify all files are present and correct on server after deployment
|
|
|
|
|
5. Test script output for clarity and absence of credential exposure
|