Sep 29, 2024 β€’ 3 min read

Mylar3: Essential Tips for Successful Self-Hosting

Mylar3: Essential Tips for Successful Self-Hosting

Mylar3 is an open-source, self-hosted application designed specifically for comic book enthusiasts who want to manage their digital collections with precision and control. With features like automated downloads, metadata fetching, and full customization, Mylar3 gives users complete autonomy over their libraries. This guide provides a hands-on walkthrough for deploying, configuring, and managing Mylar3, covering everything from installation to leveraging its advanced features.

Installing Mylar3

πŸ“¦ Docker/Docker Compose Setup

Docker is the easiest way to deploy Mylar3, offering portability and simple updates. Below is a docker-compose.yml file tailored for Mylar3.


version: "3.9"

services:

mylar3:

image: linuxserver/mylar3:latest

container_name: mylar3

ports:

- "8090:8090" # Map Mylar3's default port

environment:

- PUID=1000   # Replace with your system's user ID

- PGID=1000   # Replace with your system's group ID

- TZ=America/New_York # Set your timezone

volumes:

- /path/to/config:/config # Config directory

- /path/to/comics:/comics # Comic book library directory

- /path/to/downloads:/downloads # Directory for downloaded files

restart: unless-stopped

Save this file as docker-compose.yml and run the following commands to deploy Mylar3:


cd /path/to/docker-compose

## Start the Mylar3 container

docker-compose up -d

## Verify the container is running

docker ps

πŸš€ Manual Installation

If you prefer a manual setup, follow these steps to install Mylar3 on a Linux server:


## Update and install dependencies

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

## Clone the Mylar3 repository

git clone https://github.com/mylar3/mylar3.git /opt/mylar3

## Navigate to the Mylar3 directory

cd /opt/mylar3

## Install Python dependencies

pip3 install -r requirements.txt

## Start Mylar3 (use a process manager like systemd for persistence)

python3 Mylar.py

Access Mylar3 via http://<your-server-ip>:8090.

Configuring Nginx as a Reverse Proxy

🌐 Nginx Configuration

A reverse proxy improves accessibility by routing traffic to Mylar3. Create an Nginx server block as follows:


server {

listen 80;

server_name mylar3.example.com;

location / {

proxy_pass http://127.0.0.1:8090;

proxy_set_header Host $host;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

}

}

Place this configuration in /etc/nginx/sites-available/mylar3 and enable it with:


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

sudo nginx -t # Test the configuration

sudo systemctl reload nginx

πŸ”’ SSL/TLS Setup

Secure your Mylar3 instance with Let's Encrypt:


sudo apt install certbot python3-certbot-nginx

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

Automate SSL renewals by verifying certbot's cron job:


sudo systemctl list-timers | grep certbot

Logging and Debugging Mylar3

πŸ—ƒοΈ Enabling Debug Logs

Enable debug logging by editing Mylar3’s configuration file (config.ini):


[General]

log_level = DEBUG

Restart Mylar3 after saving changes:


## Docker

docker restart mylar3

## Manual

python3 Mylar.py

πŸ“„ Viewing Logs

Access Mylar3 logs depending on your setup:

  • Docker: docker logs mylar3

  • Manual: tail -f /opt/mylar3/logs/mylar.log

πŸ› οΈ Troubleshooting Common Issues

Look for common issues like permission errors (PermissionError) or connectivity issues (ConnectionError) in the logs. Adjust file permissions or network settings as needed:


sudo chown -R youruser:yourgroup /path/to/config /path/to/comics /path/to/downloads

Backup and Restore

πŸ—‚οΈ File-Based Backups

Backup configuration and data directories:


tar -czvf mylar3_backup.tar.gz /path/to/config /path/to/comics

πŸ”„ Database Backups

If Mylar3 uses an internal database, export it for backups:


sqlite3 /path/to/config/mylar3.db .dump > mylar3_backup.sql

Restore the database with:


sqlite3 /path/to/config/mylar3.db < mylar3_backup.sql

πŸ“… Automated Backup Scripts

Automate backups with a cron job. Create a script backup_mylar3.sh:


#!/bin/bash

tar -czvf /path/to/backup/mylar3_$(date +%F).tar.gz /path/to/config /path/to/comics

Schedule it with crontab -e:


0 2 * * * /path/to/backup_mylar3.sh

Updating and Upgrading Mylar3

⬆️ Updating Docker Images

To update Mylar3 via Docker, use the following commands:


docker-compose pull

docker-compose down

docker-compose up -d

πŸ› οΈ Manual Updates

Pull the latest changes if using a manual setup:


cd /opt/mylar3

git pull

pip3 install -r requirements.txt

python3 Mylar.py

πŸ” Checking for Updates

Mylar3’s web interface often provides update notifications. Navigate to the settings page to check for updates.

Leveraging Mylar3’s Unique Features

πŸ”§ Enabling APIs

Enable the API in config.ini:


[General]

api_enabled = True

api_key = your_unique_api_key

Test the API with curl:


curl -X GET "http://<your-server-ip>:8090/api?apikey=your_unique_api_key&cmd=getVersion"

🌟 Advanced Configurations

Integrate Mylar3 with third-party downloaders like SABnzbd by configuring downloader settings under the web interface's "Downloaders" section.

Wrapping Up

This guide provided a step-by-step approach to deploying, securing, and managing Mylar3. From installation to advanced configurations, users can now fully utilize Mylar3’s flexible and powerful features for managing their comic book collections. Begin implementing these steps today to take full control of your library!

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.