High-performance backend BitTorrent tracker compatible with UNIT3D tracker software.
| UNIT3D Version | UNIT3D-Announce Version |
|---|---|
| v8.3.4 - v9.0.4 | v0.1 |
| v9.0.5+ | v0.2 |
| v9.1.7+ | v0.3 |
# Go to where UNIT3D is already installed
$ cd /var/www/html
# Clone this repository
$ git clone -b v0.3 https://github.com/HDInnovations/UNIT3D-Announce unit3d-announce
# Go into the repository
$ cd unit3d-announce
# Copy .env.example to .env
$ cp .env.example .env
# Adjust configuration as necessary
$ sudo nano .env
# Build the tracker
$ cargo build --release
# Go into UNIT3D's base directory
$ cd /var/www/html
# Add the required environment variables to UNIT3D'S .env file:
# (`TRACKER_HOST`, `TRACKER_PORT`, `TRACKER_UNIX_SOCKET` and `TRACKER_KEY`)
# These values should match their respective values in UNIT3D-Announce's .env file:
# (`LISTENING_IP_ADDRESS`, `LISTENING_PORT`, `LISTENING_UNIX_SOCKET` and `APIKEY`)
# Note: Choose to listen on either TCP sockets or Unix sockets, not both.
$ sudo nano .env
# Enable the external tracker in UNIT3D's config
$ sudo nano config/announce.php# Go to where UNIT3D-Announce is already installed
$ cd /var/www/html/unit3d-announce
# Pull the new updates
$ git pull origin v0.3
# Review changes to the configuration
$ diff -u .env .env.example
# Add/update any new configuration values
$ sudo nano .env
# Build the tracker
$ cargo build --releaseRemember to restart the tracker.
If you serve both UNIT3D and UNIT3D-Announce on the same domain, add the following location block to your nginx configuration already used for UNIT3D.
# Edit nginx config
$ sudo nano /etc/nginx/sites-enabled/defaultPaste the following location block into the first server block immediately after the last existing location block.
location /announce/ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
# Uncomment one of the following:
# proxy_pass http://aaa.bbb.ccc.ddd:eee$request_uri;
# proxy_pass http://unix:/run/unit3d-announce/unit3d-announce.sock;
real_ip_header X-Forwarded-For;
real_ip_recursive on;
set_real_ip_from fff.ggg.hhh.iii;
}aaa.bbb.ccc.ddd:eeeeis the local listening IP address and port of UNIT3D-Announce if listening on TCP sockets. Set this to theLISTENING_IP_ADDRESSandLISTENING_PORTconfigured in the .env file.http://unix:/run/unit3d-announce/unit3d-announce.sockis the local listening unix socket if listening on unix sockets. Set the path of this (/run/unit3d-announce/unit3d-announce.sock) toLISTENING_UNIX_SOCKETconfigured in the .env file.fff.ggg.hhh.iiiis the public listening IP address of the nginx proxy used for accessing the frontend website. You can add additionalset_real_ip_from jjj.kkk.lll.mmm/nn;lines for each additional proxy used so long as the proxy appends the proper values to theX-Forwarded-Forheader. Replace this with your proxy IP address.
Uncomment and set REVERSE_PROXY_CLIENT_IP_HEADER_NAME in the .env file to X-Real-IP.
# Reload nginx once finished
$ service nginx reloadAdd a supervisor config to run UNIT3D-Announce in the background.
# Edit supervisor config
sudo nano /etc/supervisor/conf.d/unit3d.confPaste the following block at the end of the file:
[program:unit3d-announce]
process_name=%(program_name)s_%(process_num)02d
command=/var/www/html/unit3d-announce/target/release/unit3d-announce
directory=/var/www/html/unit3d-announce
autostart=true
autorestart=false
user=ubuntu
numprocs=1
redirect_stderr=true
stdout_logfile=/var/www/html/storage/logs/announce.log
Set Up Runtime Directory (if using Unix sockets):
If using Unix sockets, create a /run directory for ubuntu user:
sudo nano /etc/tmpfiles.d/unit3d-announce.conf- Add:
d /run/unit3d-announce 0755 ubuntu www-data - - Run:
sudo systemd-tmpfiles --create
Reload supervisor
$ sudo supervisorctl reread && sudo supervisorctl update && sudo supervisorctl reloadTo gracefully exit the tracker:
sudo supervisorctl stop unit3d-announce:unit3d-announce_00Important
When using the Rust-based UNIT3D-Announce tracker, the global freeleech and double upload events are handled by the external tracker itself. This means you must activate the events in the config/other.php file within UNIT3D as normal to show the timer and then also within the .env file of the UNIT3D-Announce tracker to update user stats correctly.
To enable/disable global freeleech or double upload events, you need to adjust the following environment variables in the .env file and then either reload the configuration or restart the tracker.
# The upload_factor is multiplied by 0.01 before being multiplied with
# the announced uploaded parameter and saved in the "credited" upload
# column. An upload_factor of 200 means global double upload.
#
# Default: 100
UPLOAD_FACTOR=200
# The download factor is multiplied by 0.01 before being multiplied
# with the announced downloaded parameter and saved in the "credited"
# download column. A download_factor of 0 means global freeleech.
#
# Default: 100
DOWNLOAD_FACTOR=0To reload the configuration without restarting the tracker, send the following curl:
curl -X POST "http://<LISTENING_IP_ADDRESS>:<LISTENING_PORT>/announce/<APIKEY>/config/reload"To uninstall UNIT3D-announce, you need to exit the tracker and then:
# Disable the external tracker in UNIT3D's config
$ sudo nano /var/www/html/config/announce.php
# Remove any potential `location /announce/` block from the nginx configuration
$ sudo nano /etc/nginx/sites-enabled/default
# Remove any potential `[program:unit3d-announce]` block from the supervisor configuration
$ sudo nano /etc/supervisor/conf.d/unit3d.conf
# Remove tracker files
$ sudo rm -rf /var/www/html/unit3d-announce
# Remove .env values from UNIT3D (`TRACKER_HOST`, `TRACKER_PORT`, and `TRACKER_KEY`)
$ sudo nano /var/www/html/.envUNIT3D's PHP announce can handle ~250 HTTP requests per second per core on modern hardware.
Using the same hardware, UNIT3D-Announce handles ~50k HTTP requests per second per core (using wrk). Adding it behind an nginx proxy with TLS will reduce it to ~10k HTTP requests per second per core.