# Deployment Instructions ## Prerequisites Before deploying, ensure: 1. **SSH Key Setup**: You have passwordless SSH access to the server: ```bash ssh -p 8443 rockvilleav@remote.rockvilletollandsda.church ``` 2. **Mac SSH Setup**: The server can SSH to your Mac on port 8443: ```bash # Test from the server: ssh -p 8443 benjaminslingo@macbook-pro.slingoapps.dev ``` 3. **Directory on Mac**: Create the destination directory: ```bash mkdir -p ~/rtsda/livestreams ``` ## Deployment Simply run the deployment script: ```bash ./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**: ```bash cargo build --release ``` 2. **Copy files to server**: ```bash 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**: ```bash 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 ```bash # 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`