Bazarr is a powerful self-hosted application designed to manage subtitle downloads automatically for your media collection. It works seamlessly with Plex, Sonarr, Radarr, and other media managers to ensure your movies and TV shows always have the right subtitles. Self-hosting Bazarr gives you complete control over your subtitles, customization options, and privacy. In this guide, youβll learn how to install, configure, and manage Bazarr, including setup with Docker, configuring Nginx as a reverse proxy, enabling logs, setting up backups, updating the app, and leveraging its unique features.
Installing Bazarr
π¦ Docker/Docker Compose Setup
For a quick and isolated installation, Docker is the recommended method. Below is an example docker-compose.yml
file for deploying Bazarr:
version: '3.7'
services:
bazarr:
image: lscr.io/linuxserver/bazarr:latest
container_name: bazarr
environment:
- PUID=1000 # Replace with your user ID
- PGID=1000 # Replace with your group ID
- TZ=Etc/UTC # Adjust timezone
volumes:
- /path/to/config:/config # Configuration directory
- /path/to/media:/media # Media directory
ports:
- 6767:6767 # Port for accessing Bazarr
restart: unless-stopped
To deploy with Docker, save the file as docker-compose.yml
and run the following commands:
cd /path/to/docker-compose
## Start Bazarr
docker-compose up -d
π Manual Installation
For a direct server installation, follow these steps (Linux example):
## Install dependencies
sudo apt update && sudo apt install -y git python3 python3-pip
## Clone the Bazarr repository
git clone https://github.com/morpheus65535/bazarr.git /opt/bazarr
## Navigate to the Bazarr directory
cd /opt/bazarr
## Install Python dependencies
pip3 install -r requirements.txt
## Launch Bazarr
python3 bazarr.py
To make Bazarr run as a service, create a systemd unit file:
sudo nano /etc/systemd/system/bazarr.service
Add the following content:
[Unit]
Description=Bazarr Service
After=network.target
[Service]
User=your-username
Group=your-group
WorkingDirectory=/opt/bazarr
ExecStart=/usr/bin/python3 /opt/bazarr/bazarr.py
Restart=always
[Install]
WantedBy=multi-user.target
Enable and start the service:
sudo systemctl enable bazarr
sudo systemctl start bazarr
Configuring Nginx as a Reverse Proxy
π Nginx Configuration
Set up Nginx to route traffic to Bazarr. Create an Nginx server block:
sudo nano /etc/nginx/sites-available/bazarr
Add the following configuration:
server {
listen 80;
server_name bazarr.example.com;
location / {
proxy_pass http://127.0.0.1:6767;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
Enable the configuration and reload Nginx:
sudo ln -s /etc/nginx/sites-available/bazarr /etc/nginx/sites-enabled
sudo nginx -t
sudo systemctl reload nginx
π SSL/TLS Setup
Secure your Bazarr instance with Let's Encrypt:
sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d bazarr.example.com
Automate certificate renewal with a cron job:
crontab -e
## Add the following line:
0 0 * * * certbot renew --quiet && systemctl reload nginx
π οΈ Testing and Reloading Nginx
Test your Nginx configuration and reload it if no syntax errors are found:
sudo nginx -t
sudo systemctl reload nginx
Logging and Debugging Bazarr
ποΈ Enabling Debug Logs
Increase Bazarrβs log verbosity by editing its configuration. Open Bazarrβs settings in the web UI, navigate to the logging section, and set the log level to DEBUG
.
π Viewing Logs
For Docker installations, view logs using:
docker logs -f bazarr
For manual installations, access logs in /opt/bazarr/logs
:
tail -f /opt/bazarr/logs/bazarr.log
π οΈ Troubleshooting Common Issues
For common errors, check for permission issues or missing dependencies in the logs. For example, ensure Bazarr has access to your /media
directory by verifying permissions:
ls -ld /path/to/media
π€ Exporting Logs
To send logs to an external system like ELK Stack, configure a filebeat or syslog output to forward Bazarr logs.
Backup and Restore
ποΈ File-Based Backups
Backup Bazarrβs configuration directory:
tar -czvf bazarr-backup.tar.gz /path/to/config
π Database Backups
If using an external database, export it with:
mysqldump -u username -p bazarr > bazarr-db-backup.sql
π Automated Backup Scripts
Automate configuration backups with a cron job:
crontab -e
## Add the following line:
0 2 * * * tar -czvf /backup/bazarr-$(date +\%F).tar.gz /path/to/config
Updating and Upgrading Bazarr
β¬οΈ Updating Docker Images
Update Bazarrβs Docker image with:
docker-compose pull
docker-compose up -d
π οΈ Manual Updates
For manual installations, pull the latest code and restart:
cd /opt/bazarr
git pull
pip3 install -r requirements.txt
systemctl restart bazarr
π Checking for Updates
Check for updates in the Bazarr web interface under the settings panel or via the GitHub repository.
Leveraging Bazarrβs Unique Features
π§ Enabling APIs
To use Bazarrβs API, navigate to the API section in the web UI, enable the API, and generate an API key. Use the API with tools like curl
:
curl -X GET "http://localhost:6767/api/v1/subtitles" -H "X-Api-Key: YOUR_API_KEY"
π Advanced Configurations
Integrate Bazarr with third-party tools by configuring webhooks in the settings. For example, you can trigger notifications to a webhook URL every time subtitles are downloaded:
{
"url": "http://your-webhook-url",
"method": "POST",
"body": "{\"event\":\"subtitle_downloaded\",\"content\":\"$content\"}"
}
Wrapping Up
By following this guide, youβve successfully installed, configured, and optimized Bazarr for self-hosting. Bazarrβs flexibility and integration capabilities make it an indispensable tool for managing subtitles in your media collection. Start experimenting with its features, from API integrations to advanced logging, and enjoy a seamless subtitle management experience.