Sep 24, 2024 3 min read

CouchPotato: The Ultimate Self-Hosting Setup

CouchPotato: The Ultimate Self-Hosting Setup
Table of Contents

CouchPotato is a powerful, self-hosted application designed for automating the download of movies, allowing users to manage their media libraries effortlessly. Its flexibility, customization options, and ability to integrate seamlessly with other tools make it an excellent choice for tech-savvy users. In this guide, we’ll walk through deploying, configuring, managing, and leveraging CouchPotato, covering everything from installation to advanced features.

Installing CouchPotato

πŸ“¦ Docker/Docker Compose Setup

Using Docker is the most efficient way to deploy CouchPotato, ensuring a clean installation with minimal dependencies. Below is a docker-compose.yml configuration tailored for CouchPotato:


version: '3.8'

services:

couchpotato:

image: couchpotato/couchpotato:latest

container_name: couchpotato

ports:

- "5050:5050" # Maps CouchPotato's default port to the host

volumes:

- /path/to/config:/config # Persistent app configuration

- /path/to/movies:/movies # Directory for downloaded movies

- /path/to/downloads:/downloads # Directory for temporary downloads

restart: unless-stopped

To deploy the container:


nano docker-compose.yml

## Start CouchPotato

docker-compose up -d

## Check if the container is running

docker ps

πŸš€ Manual Installation

For direct installation on a Linux server, follow these steps:

  1. Install dependencies:

sudo apt update

sudo apt install -y git python python-pip

  1. Clone the CouchPotato repository:

git clone https://github.com/CouchPotato/CouchPotatoServer.git /opt/couchpotato

  1. Start CouchPotato:

python /opt/couchpotato/CouchPotato.py --daemon

  1. Enable autostart on reboot (create a systemd service file):

sudo nano /etc/systemd/system/couchpotato.service

Add the following content:


[Unit]

Description=CouchPotato Service

After=network.target

[Service]

ExecStart=/usr/bin/python /opt/couchpotato/CouchPotato.py

Restart=always

User=root

[Install]

WantedBy=multi-user.target

Then enable and start the service:


sudo systemctl enable couchpotato

sudo systemctl start couchpotato

Configuring Nginx as a Reverse Proxy

🌐 Nginx Configuration

To make CouchPotato accessible via a custom domain or subdomain, configure Nginx as a reverse proxy:

  1. Create a new Nginx server block:

sudo nano /etc/nginx/sites-available/couchpotato

Add this content:


server {

listen 80;

server_name couchpotato.mydomain.com;

location / {

proxy_pass http://localhost:5050;

proxy_set_header Host $host;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

}

}

  1. Enable the configuration and reload Nginx:

sudo ln -s /etc/nginx/sites-available/couchpotato /etc/nginx/sites-enabled/

sudo nginx -t

sudo systemctl reload nginx

πŸ”’ SSL/TLS Setup

Secure the app with Let's Encrypt:


sudo apt install certbot python3-certbot-nginx

sudo certbot --nginx -d couchpotato.mydomain.com

Set up automatic SSL renewal:


sudo crontab -e

## Add the following line:

0 3 * * * certbot renew --quiet

Logging and Debugging CouchPotato

πŸ—ƒοΈ Enabling Debug Logs

Activate debug logging by editing the settings.conf file:


nano /path/to/config/settings.conf

Set the debug option to true:


debug = true

Restart the CouchPotato service to apply changes:


docker restart couchpotato

## or

sudo systemctl restart couchpotato

πŸ“„ Viewing Logs

For Docker deployments:


docker logs -f couchpotato

For manual installations:


tail -f /path/to/config/logs/CouchPotato.log

πŸ› οΈ Troubleshooting Common Issues

If CouchPotato fails to start:

  1. Verify port conflicts:

sudo netstat -tuln | grep 5050

  1. Check for missing dependencies:

python --version

pip list

Backup and Restore

πŸ—‚οΈ File-Based Backups

Backup your configuration and database:


tar -czvf couchpotato-backup.tar.gz /path/to/config /path/to/movies

πŸ”„ Database Backups

If CouchPotato uses a database (e.g., SQLite), manually copy the database file:


cp /path/to/config/database.db /path/to/backup/

πŸ“… Automated Backup Scripts

Set up a cron job to automate backups:


crontab -e

## Add the following:

0 2 * * * tar -czvf /path/to/backups/couchpotato-$(date +\%F).tar.gz /path/to/config /path/to/movies

Updating and Upgrading CouchPotato

⬆️ Updating Docker Images

Pull the latest Docker image and redeploy:


docker-compose pull

docker-compose up -d

πŸ› οΈ Manual Updates

Update the repository and restart:


cd /opt/couchpotato

git pull

python CouchPotato.py --daemon

Leveraging CouchPotato’s Unique Features

πŸ”§ Enabling APIs

Activate CouchPotato’s API in the settings:

  1. Open the CouchPotato web interface.

  2. Go to Settings > Advanced > API.

  3. Enable the API and note the API key.

Test the API with curl:


curl -X GET "http://localhost:5050/api/<API_KEY>/app.available"

🌟 Advanced Configurations

Integrate CouchPotato with a download client (e.g., Transmission):

  1. Go to Settings > Downloaders.

  2. Enable Transmission and provide the necessary credentials.

Test the integration:


curl -X GET "http://localhost:5050/api/<API_KEY>/downloaders.test"

Wrapping Up

By following this guide, you’ve successfully deployed, configured, and managed CouchPotato on your server. Self-hosting CouchPotato offers unparalleled control and flexibility, allowing you to tailor it to your exact needs. Start leveraging its powerful features today to automate your media library and enjoy seamless movie management!

Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to Selfhosted Ninja.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.