livestream-archiver/package/DEPLOY.md
RTSDA 2c3c86e07d Add LICENSE, improve README, and update project documentation
- Add MIT LICENSE file
- Make README more generic and comprehensive
- Add installation and troubleshooting sections
- Include systemd service integration docs
- Update with build and deployment instructions
2025-08-16 18:57:27 -04:00

2.8 KiB

Deployment Instructions

Prerequisites

Before deploying, ensure:

  1. SSH Key Setup: You have passwordless SSH access to the server:

    ssh -p 8443 rockvilleav@remote.rockvilletollandsda.church
    
  2. Mac SSH Setup: The server can SSH to your Mac on port 8443:

    # Test from the server:
    ssh -p 8443 benjaminslingo@macbook-pro.slingoapps.dev
    
  3. Directory on Mac: Create the destination directory:

    mkdir -p ~/rtsda/livestreams
    

Deployment

Simply run the deployment script:

./deploy.sh

This will:

  • Build the release binary
  • Package all necessary files
  • Copy to the server
  • Install as a systemd service
  • Start the service
  • Show service status

Manual Deployment (if script fails)

  1. Build locally:

    cargo build --release
    
  2. Copy files to server:

    scp -P 8443 target/release/livestream_archiver rockvilleav@remote.rockvilletollandsda.church:/tmp/
    scp -P 8443 livestream-archiver.service rockvilleav@remote.rockvilletollandsda.church:/tmp/
    
  3. Install on server:

    ssh -p 8443 rockvilleav@remote.rockvilletollandsda.church
    
    # Create directories
    sudo mkdir -p /home/rockvilleav/livestream-archiver
    sudo mkdir -p /home/rockvilleav/Sync/Livestreams
    sudo mkdir -p /media/archive/jellyfin/livestreams
    
    # Move binary
    sudo mv /tmp/livestream_archiver /home/rockvilleav/livestream-archiver/
    sudo chmod +x /home/rockvilleav/livestream-archiver/livestream_archiver
    
    # Install service
    sudo mv /tmp/livestream-archiver.service /etc/systemd/system/
    sudo systemctl daemon-reload
    sudo systemctl enable livestream-archiver
    sudo systemctl start livestream-archiver
    
    # Set permissions
    sudo chown -R rockvilleav:rockvilleav /home/rockvilleav/livestream-archiver
    sudo chown -R rockvilleav:rockvilleav /home/rockvilleav/Sync/Livestreams
    

Management Commands

# Check status
sudo systemctl status livestream-archiver

# View logs
sudo journalctl -u livestream-archiver -f

# Restart service
sudo systemctl restart livestream-archiver

# Stop service
sudo systemctl stop livestream-archiver

Testing

  1. Place a test file in /home/rockvilleav/Sync/Livestreams/ (name it like 2024-07-21_10-30-00.mp4)
  2. Check logs to see if it detects and processes the file
  3. Verify sync to your Mac at ~/rtsda/livestreams/
  4. Check Jellyfin output at /media/archive/jellyfin/livestreams/

Troubleshooting

  • SSH connection issues: Verify port 8443 is open and SSH keys are set up
  • Permission errors: Ensure directories have correct ownership (rockvilleav:rockvilleav)
  • rsync failures: Check network connectivity and SSH key authentication
  • Service won't start: Check logs with journalctl -u livestream-archiver