Nov 4, 2024 3 min read

Unmanic: A Beginner-Friendly Guide to Self-Hosting

Unmanic: A Beginner-Friendly Guide to Self-Hosting
Table of Contents

Unmanic is a self-hosted, open-source application designed to optimize your media library by converting and normalizing video and audio files. With its focus on automation and customization, Unmanic empowers users to tailor their media workflows while maintaining full data control. In this guide, we’ll cover everything from installing and configuring Unmanic to managing its unique features, so you can seamlessly deploy and integrate it into your self-hosted environment.

Installing Unmanic

πŸ“¦ Docker/Docker Compose Setup

The recommended way to install Unmanic is via Docker for simplicity and ease of updates. Below is an example docker-compose.yml tailored for Unmanic:


version: "3.8"

services:

unmanic:

image: josh5/unmanic:latest

container_name: unmanic

ports:

- 8888:8888  # Map Unmanic's web interface to localhost:8888

volumes:

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

- /path/to/media:/library  # Media library to process

environment:

- TZ=Etc/UTC  # Set the timezone

restart: unless-stopped

To deploy Unmanic using the above file:


mkdir unmanic && cd unmanic

nano docker-compose.yml  # Copy and paste the above YAML

docker-compose up -d

This will launch Unmanic on http://<your-server-ip>:8888. Adjust the volumes paths to match your directory structure.

πŸš€ Manual Installation (Linux)

For those who prefer a manual setup, use the following commands to install Unmanic:

  1. Install required dependencies:

sudo apt update && sudo apt install -y python3 python3-pip ffmpeg

  1. Clone the Unmanic repository:

git clone https://github.com/Unmanic/unmanic.git

cd unmanic

  1. Install Python dependencies:

pip3 install -r requirements.txt

  1. Run the application:

python3 unmanic.py

Unmanic will now be accessible at http://<your-server-ip>:8888.

Configuring Nginx as a Reverse Proxy

🌐 Nginx Configuration

To serve Unmanic behind Nginx, create a server block configuration file:


server {

listen 80;

server_name unmanic.example.com;

location / {

proxy_pass http://127.0.0.1:8888/;  # Forward traffic to Unmanic

proxy_set_header Host $host;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_set_header X-Forwarded-Proto $scheme;

}

}

Save this file to /etc/nginx/sites-available/unmanic and enable it:


ln -s /etc/nginx/sites-available/unmanic /etc/nginx/sites-enabled/

nginx -t  # Test configuration

sudo systemctl reload nginx

πŸ”’ SSL/TLS Setup

Add SSL/TLS encryption with Let’s Encrypt:


sudo apt install certbot python3-certbot-nginx

sudo certbot --nginx -d unmanic.example.com

Set up automatic certificate renewal:


sudo systemctl enable certbot.timer

πŸ› οΈ Testing and Reloading Nginx

Ensure your Nginx configuration works:


nginx -t

sudo systemctl reload nginx

Now you can access Unmanic securely at https://unmanic.example.com.

Logging and Debugging Unmanic

πŸ—ƒοΈ Enabling Debug Logs

To enable debug-level logging, modify the Unmanic configuration by editing its config.json file:


{

"log_level": "DEBUG"

}

Restart Unmanic after making changes.

πŸ“„ Viewing Logs

For Docker installations:


docker logs -f unmanic

For manual installations:


tail -f /path/to/unmanic/logs/unmanic.log

πŸ› οΈ Troubleshooting Common Issues

Check logs for errors such as missing dependencies or incorrect file permissions. For example:


grep "ERROR" /path/to/unmanic/logs/unmanic.log

πŸ“€ Exporting Logs

Integrate logs with the ELK Stack by forwarding logs via Filebeat:


filebeat.inputs:

- type: log

paths:

- /path/to/unmanic/logs/unmanic.log

Configure Filebeat to ship logs to your Elasticsearch instance.

Backup and Restore

πŸ—‚οΈ File-Based Backups

Backup Unmanic configuration and database:


tar -cvzf unmanic_backup_$(date +%Y%m%d).tar.gz /path/to/config

πŸ”„ Database Backups

If Unmanic uses SQLite, back up the database:


cp /path/to/config/unmanic.db /path/to/backups/unmanic.db.bak

πŸ“… Automated Backup Scripts

Automate backups with a cron job:


crontab -e

0 2 * * * tar -cvzf /path/to/backups/unmanic_backup_$(date +\%Y\%m\%d).tar.gz /path/to/config

Updating and Upgrading Unmanic

⬆️ Updating Docker Images

To update Unmanic when using Docker:


docker-compose pull

docker-compose up -d

πŸ› οΈ Manual Updates

For manual installations:


cd /path/to/unmanic

git pull

pip3 install --upgrade -r requirements.txt

πŸ” Checking for Updates

Visit the Unmanic GitHub repository to monitor releases.

Leveraging Unmanic’s Unique Features

πŸ”§ Enabling APIs

Unmanic exposes APIs for integration. Enable the API in config.json:


{

"api_enabled": true,

"api_bind_address": "0.0.0.0",

"api_port": 8889

}

Access the API with curl:


curl http://<your-server-ip>:8889/api/status

🌟 Advanced Configurations

Unmanic supports custom plugins. To enable a plugin:

  1. Navigate to Settings > Plugins in the web UI.

  2. Select and configure the desired plugin for your workflow.

Alternatively, configure plugins in config.json:


{

"plugin_enabled": true,

"plugin_settings": {

"plugin_name": "CustomPlugin",

"plugin_option": "value"

}

}

Wrapping Up

In this guide, we’ve walked through deploying, configuring, and managing Unmanic for a self-hosted media optimization workflow. By following these steps, you can take full advantage of Unmanic’s flexibility and automation capabilities. Start implementing these code-driven workflows today to organize and enhance your media library like never before!

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.