Skip to content

Docker image from scratch, customizable, simple and small, for the opentracker project, an open and free BitTorrent tracker.

License

Notifications You must be signed in to change notification settings

wiltonsr/opentracker-docker

Repository files navigation

opentracker-docker

Docker image from scratch, customizable, simple and small, for the opentracker project, an open and free BitTorrent tracker.

Updates

  • The opentracker's updates can be found here.
  • The opentracker-docker's updates can be found here.

How to use this image

This image compile Opentracker following build instructions, but using GCC's -static link option. The -static option links a program statically, in other words it does not require a dependency on dynamic libraries at runtime in order to run.

This image is designed to be used in a micro-service environment. There are three versions of the image you can choose from.

The open tag contains a Opentracker builded with defaults options and run in open mode.

The blacklist and whitelist tags contains a Opentracker builded with -DWANT_ACCESSLIST_BLACK and -DWANT_ACCESSLIST_WHITE respectively and run in closed mode.

Using in open Mode

The image has /bin/opentracker binary as ENTRYPOINT and -f /etc/opentracker/opentracker.conf as default CMD.

So you can run:

docker run \
  --rm \
  -d \
  --name opentracker \
  -p 6969:6969/udp -p 6969:6969 \
  wiltonsr/opentracker:open

Or with docker-compose.yml file:

version: "3"

services:
  tracker:
    image: wiltonsr/opentracker:open
    container_name: opentracker
    restart: always
    ports:
      - 6969:6969/tcp
      - 6969:6969/udp
docker-compose up

Now you can access Opentracker Stats page at http://localhost:6969/stats from your host system.

Debug Mode

All tags also contains /bin/opentracker.debug binary. So you could run Opentracker in debug mode overriding default ENTRYPOINT.

docker run \
  --rm \
  -d \
  --name opentracker \
  -p 6969:6969/udp -p 6969:6969 \
  --entrypoint="/bin/opentracker.debug" \
  wiltonsr/opentracker:open \
  -f /etc/opentracker/opentracker.conf

It is also possible to override the default command with:

docker run \
  --rm \
  --name opentracker \
  -p 6969:6969/udp -p 6969:6969 \
  wiltonsr/opentracker:open \
  -h

You will get:

Usage: /bin/opentracker [-i ip] [-p port] [-P port] [-r redirect] [-d dir] [-u user] [-A ip] [-f config] [-s livesyncport]
        -f config include and execute the config file
        -i ip     specify ip to bind to (default: *, you may specify more than one)
        -p port   specify tcp port to bind to (default: 6969, you may specify more than one)
        -P port   specify udp port to bind to (default: 6969, you may specify more than one)
        -r redirecturlspecify url where / should be redirected to (default none)
        -d dir    specify directory to try to chroot to (default: ".")
        -u user   specify user under whose privileges opentracker should run (default: "nobody")
        -A ip     bless an ip address as admin address (e.g. to allow syncs from this address)

Example:   ./opentracker -i 127.0.0.1 -p 6969 -P 6969 -f ./opentracker.conf -i 10.1.1.23 -p 2710 -p 80

Configuration file

All tags use default configuration file from here.

Some adjusts are made:

  • tracker.user is setted to farmhand USER in all tags.
  • access.whitelist is setted to /etc/opentracker/whitelist in whitelist tag.
  • access.blacklist is setted to /etc/opentracker/blacklist in blacklist tag.

You could override the default configuration using a VOLUME:

docker run \
  --rm \
  --name opentracker \
  -v $PWD/local-opentracker.conf:/etc/opentracker/opentracker.conf \
  -p 6969:6969/udp -p 6969:6969 \
  wiltonsr/opentracker:open

Using in closed Mode

If you want to control what torrents to track – or not to track. You could use opentracker with one of the accesslist-options tags, you can control which torrents are tracked by providing a file that contains a list of human readable info_hashes. An example whitelist file would look like

0123456789abcdef0123456789abcdef01234567
890123456789abcdef0123456789abcdef012345

Compilation

Opentracker provides accesslist options, -DWANT_ACCESSLIST_BLACK and -DWANT_ACCESSLIST_WHITE, but this options are exclusive. Trying to compile it with both options will resulte in this error:

cc -c -o opentracker.o -I../libowfat -Wall -pipe -Wextra  -O3 -DWANT_ACCESSLIST_BLACK -DWANT_ACCESSLIST_WHITE -DWANT_FULLSCRAPE opentracker.c
In file included from opentracker.c:36:
ot_accesslist.h:10:4: error: #error WANT_ACCESSLIST_BLACK and WANT_ACCESSLIST_WHITE are exclusive.
   10 | #  error WANT_ACCESSLIST_BLACK and WANT_ACCESSLIST_WHITE are exclusive.
      |    ^~~~~
make: *** [Makefile:81: opentracker.o] Erro 1

Because of that there are two another tags, blacklist and whitelist, which were compiled with the respective options.

Whitelist Mode

touch local-whitelist
chmod -v 0666 local-whitelist

docker run \
  --rm \
  --name opentracker \
  -v $PWD/local-whitelist:/etc/opentracker/whitelist \
  -p 6969:6969/udp -p 6969:6969 \
  wiltonsr/opentracker:whitelist

Blacklist Mode

touch local-blacklist
chmod -v 0666 local-blacklist

docker run \
  --rm \
  --name opentracker \
  -v $PWD/local-blacklist:/etc/opentracker/blacklist \
  -p 6969:6969/udp -p 6969:6969 \
  wiltonsr/opentracker:blacklist

Reloading file changes

To make opentracker reload it's white/blacklist after changes, send a SIGHUP unix signal.

docker kill --signal="SIGHUP" opentracker

About

Docker image from scratch, customizable, simple and small, for the opentracker project, an open and free BitTorrent tracker.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published