Hydra2 is a powerful and feature-rich self-hosted application that excels in providing a customizable and controlled environment for managing and aggregating search-based content. Its open-source nature and modularity make it a great choice for tech-focused users who value privacy, scalability, and flexibility. This guide will walk you through installing Hydra2, configuring a reverse proxy, enabling logging and debugging, setting up backup routines, updating the app, and leveraging its most unique features.
Installing Hydra2
📦 Docker/Docker Compose Setup
Hydra2 is commonly deployed using Docker for simplicity and portability. Below is a docker-compose.yml
file tailored for Hydra2:
version: '3.8'
services:
hydra2:
image: theotherp/nzbhydra2:latest
container_name: hydra2
ports:
- "5076:5076" # Default Hydra2 port
volumes:
- ./hydra2/config:/config # Configuration files
- ./hydra2/data:/data # Application data
restart: unless-stopped
environment:
- TZ=America/New_York # Set your timezone
Save this file in a directory, then run the following commands to deploy Hydra2:
docker-compose up -d
This will start the Hydra2 container, exposing it on port 5076
. You can access the UI by visiting http://<your_server_ip>:5076
.
🚀 Manual Installation
For those who prefer not to use Docker, you can install Hydra2 directly on a Linux server:
- Install Java (Hydra2 requires Java 8 or higher):
sudo apt update && sudo apt install openjdk-11-jre -y
- Download the latest Hydra2 release:
wget https://github.com/theotherp/nzbhydra2/releases/latest/download/nzbhydra2-linux.zip
- Extract the downloaded file and navigate to the directory:
unzip nzbhydra2-linux.zip -d hydra2
cd hydra2
- Start Hydra2:
java -jar nzbhydra2.jar
Hydra2 will now run and be accessible on port 5076 by default.
Configuring Nginx as a Reverse Proxy
🌐 Nginx Configuration
To serve Hydra2 behind Nginx, create an Nginx server block with the following settings:
server {
listen 80;
server_name hydra2.example.com;
location / {
proxy_pass http://127.0.0.1:5076;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
Save this configuration in /etc/nginx/sites-available/hydra2
and create a symlink:
sudo ln -s /etc/nginx/sites-available/hydra2 /etc/nginx/sites-enabled/
🔒 SSL/TLS Setup
To secure Hydra2 with SSL/TLS, use Let's Encrypt and Certbot:
sudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx -d hydra2.example.com
This will generate and apply SSL certificates to your Nginx configuration.
🛠️ Testing and Reloading Nginx
After configuring Nginx, test the configuration and reload the service:
sudo nginx -t
sudo systemctl reload nginx
Visit https://hydra2.example.com
to verify the setup.
Logging and Debugging Hydra2
🗃️ Enabling Debug Logs
To enable debug-level logging in Hydra2, modify the logging
settings in the configuration interface or config.yaml
file:
logging:
level: DEBUG
📄 Viewing Logs
For Docker deployments:
docker logs hydra2
For manual setups, logs are stored in the logs
directory:
tail -f /path/to/hydra2/logs/nzbhydra2.log
🛠️ Troubleshooting Common Issues
Check for typical errors such as misconfigured ports or permissions in the logs. If you encounter Java exceptions, ensure your Java version meets the requirements.
📤 Exporting Logs
Send logs to an external ELK stack for advanced analysis using Filebeat or other log shippers. For example:
filebeat setup --path.logs=/path/to/hydra2/logs
Backup and Restore
🗂️ File-Based Backups
To back up Hydra2 configuration and data:
tar -czvf hydra2_backup.tar.gz /path/to/hydra2/config /path/to/hydra2/data
🔄 Database Backups
If Hydra2 uses an embedded database, copy the database file:
cp /path/to/hydra2/data/database.mv.db /path/to/backup/
📅 Automated Backup Scripts
Set up a cron job for automated backups:
crontab -e
Add the following line to schedule daily backups:
0 2 * * * tar -czvf /backup/hydra2_$(date +\%F).tar.gz /path/to/hydra2/config /path/to/hydra2/data
Updating and Upgrading Hydra2
⬆️ Updating Docker Images
To update Hydra2 when using Docker:
docker-compose pull
docker-compose up -d
🛠️ Manual Updates
For manual installations, download and replace the latest nzbhydra2.jar
:
wget https://github.com/theotherp/nzbhydra2/releases/latest/download/nzbhydra2-linux.zip
unzip -o nzbhydra2-linux.zip -d /path/to/hydra2
🔍 Checking for Updates
Hydra2 may notify you of updates via its UI or logs. You can also check the GitHub releases page for the latest version.
Leveraging Hydra2’s Unique Features
🔧 Enabling APIs
Hydra2 supports APIs for programmatic control. Enable APIs in the configuration interface under API
. Use the following example to query the API using curl
:
curl -X GET "http://<your_server_ip>:5076/api/stats" -H "Authorization: Bearer <your_api_key>"
🌟 Advanced Configurations
Hydra2 allows integrations with third-party indexers. Add indexers via the web interface or by editing the indexers.yaml
file:
indexers:
- name: Usenet-Crawler
type: Newznab
host: https://usenet-crawler.com
api_key: YOUR_API_KEY
Save your changes and restart Hydra2.
Wrapping Up
Hydra2 provides immense flexibility and control when self-hosting, from its modular installation process to its rich configuration options and logging capabilities. By following this guide, you can deploy, secure, and optimize Hydra2 for your specific needs, ensuring a robust and customized solution for managing search-based content. Start experimenting with its features today to unlock its full potential!