refactor: switch from FTPS/lftp to rsync for deployment
Replace the FTPS-based deployment approach with rsync over SSH for more reliable and efficient mirroring of the Hugo site. This change addresses issues with the previous approach and provides true mirror behavior. Key changes: - Replace lftp with rsync for file synchronization - Add --delete flag for true mirror behavior (removes stale remote files) - Simplify authentication to use SSH keys only (no password needed) - Update all documentation and OpenSpec artifacts - Add .envrc to gitignore for direnv users Environment variables: - SSH_USER: SSH username (required) - SSH_HOST: server hostname (required) - SSH_PORT: SSH port (optional, defaults to 22) - REMOTE_ROOT: remote directory path (optional, defaults to /httpsdocs) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -10,30 +10,31 @@
|
||||
|
||||
### 2. Implement prerequisite checks
|
||||
- [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] Verify `rsync` is installed and available in PATH
|
||||
- [x] Check that `SSH_USER` and `SSH_HOST` environment variables are set
|
||||
- [x] Display clear error messages for any missing prerequisites
|
||||
- **Validates**: Script exits early with helpful errors when prerequisites are missing
|
||||
|
||||
### 3. Implement FTPS connection logic
|
||||
- [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
|
||||
- **Validates**: Script can establish FTPS connection with correct credentials
|
||||
### 3. Implement SSH/rsync connection logic
|
||||
- [x] Configure rsync to connect using SSH_USER and SSH_HOST
|
||||
- [x] Support configurable SSH_PORT (defaults to 22)
|
||||
- [x] Support configurable REMOTE_ROOT (defaults to /httpsdocs)
|
||||
- [x] Use SSH key-based authentication for secure, password-less access
|
||||
- **Validates**: Script can establish SSH connection with correct credentials
|
||||
|
||||
### 4. Implement file upload functionality
|
||||
- [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
|
||||
- **Validates**: All files from public/ are correctly uploaded to httpsdocs/
|
||||
### 4. Implement file sync functionality
|
||||
- [x] Use rsync command to sync `public/` contents to remote directory
|
||||
- [x] Configure sync to preserve file permissions and timestamps (-a flag)
|
||||
- [x] Enable compression during transfer (-z flag)
|
||||
- [x] Implement mirror behavior with --delete flag (removes remote files not present locally)
|
||||
- [x] Handle all file types appropriately
|
||||
- **Validates**: All files from public/ are correctly synced to the remote directory and old files are removed
|
||||
|
||||
### 5. Add progress and status reporting
|
||||
- [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
|
||||
- [x] Show sync progress through rsync verbose output
|
||||
- [x] Report sync completion with summary
|
||||
- [x] Ensure SSH keys or passwords are never displayed in output
|
||||
- **Validates**: User receives clear feedback during deployment process
|
||||
|
||||
### 6. Implement error handling
|
||||
@@ -45,9 +46,9 @@
|
||||
|
||||
### 7. Add script documentation
|
||||
- [x] Add header comments explaining script purpose and usage
|
||||
- [x] Document required environment variables
|
||||
- [x] Document required environment variables (SSH_USER, SSH_HOST, SSH_PORT, REMOTE_ROOT)
|
||||
- [x] Include example usage in comments
|
||||
- [x] Add inline comments for complex lftp commands
|
||||
- [x] Add inline comments for rsync command options
|
||||
- **Validates**: Script is self-documenting for future maintenance
|
||||
|
||||
### 8. Update project documentation
|
||||
@@ -58,10 +59,11 @@
|
||||
- **Validates**: User documentation exists and covers deployment process
|
||||
|
||||
### 9. Test deployment script
|
||||
- [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
|
||||
- [x] Test with missing prerequisites (no public/, no rsync, no SSH_USER/SSH_HOST)
|
||||
- [x] Test with SSH authentication issues
|
||||
- [x] Test successful deployment with valid credentials and SSH keys
|
||||
- [x] Verify synced files match local public/ directory
|
||||
- [x] Verify remote files are deleted when removed locally (mirror behavior)
|
||||
- **Validates**: Script behaves correctly in success and failure scenarios
|
||||
|
||||
### 10. Create .gitignore entry for environment files
|
||||
|
||||
Reference in New Issue
Block a user