Configuring the backend

Download the latest release from the releases tab, it will be in a tar.gz format.

Create a directory where goTorrent will run from

sudo mkdir /opt/goTorrent

Put the tar.gz release into the folder, and extract it.

tar -zxvf goTorrent_release_64-git.tar.gz

You can then remove the tar.gz if you wish. You should have something similar to the following files:

drwxr-xr-x 5 root root        9 Jan 21 14:56 .
drwxr-xr-x 5 root root        5 Jan 21 14:54 ..
-rw-rw-rw- 1 root root     1086 Dec  1 01:42 LICENSE
-rw-rw-rw- 1 root root       69 Dec  1 01:01 README.md
-rw-rw-rw- 1 root root     4466 Jan 21 03:48 config.toml
drwxr-xr-x 3 root root        3 Jan 21 14:55 dist-specific-files
-rw-rw-rw- 1 root root 12503552 Jan 21 03:53 goTorrent
drwxr-xr-x 3 root root        3 Jan 21 14:55 public
drwxr-xr-x 2 root root        3 Jan 21 14:55 templates

The config.toml file contains all of the settings for the server part of the application. Most of the important settings are at the top of the file, so open it with your prefered text editor.

[serverConfig]

ServerPort = ":8000" #leave format as is it expects a string with colon
ServerAddr = "" #blank will bind to default IP address, usually fine to leave be
LogLevel = "Warn" # Options = Debug, Info, Warn, Error, Fatal, Panic
LogOutput = "file" #Options = file, stdout #file will print it to logs/server.log

SeedRatioStop = 1.50 #automatically stops the torrent after it reaches this seeding ratio
#Relative or absolute path accepted, the server will convert any relative path to an absolute path.
DefaultMoveFolder = 'downloaded' #default path that a finished torrent is symlinked to after completion. Torrents added via RSS will default here
TorrentWatchFolder = 'torrentUpload' #folder path that is watched for .torrent files and adds them automatically every 5 minutes

#Limits your upload and download speed globally, all are averages and not burst protected (usually burst on start).
#Low = ~.05MB/s, Medium = ~.5MB/s, High = ~1.5MB/s
UploadRateLimit = "Unlimited"  #Options are "Low", "Medium", "High", "Unlimited" #Unlimited is default
DownloadRateLimit = "Unlimited"

[notifications]

PushBulletToken = "" #add your pushbullet api token here to notify of torrent completion to pushbullet

Usually you don't need to change anything in this file, goTorrent will use your default IP address and bind to it. You can change the port if you wish.

Next, we need to make sure that the executable runs, so run the following:

chmod +x goTorrent

This will make the program executable.

Connecting the Frontend to the Backend

If you are using a reverse proxy please see ReverseProxy

We need to connect our react frontend to our Golang backend, for this we only need to edit one JS file.

nano public/static/js/kickwebsocket-generated.js

var ws = new WebSocket("ws://192.168.1.141:8000/websocket"); //creating websocket

Just change the IP address after ws:// to your server IP address, and change the port if you changed the port in the config.toml file.

Then save that file and return to /opt/goTorrent.

Now we can test the server. For testing I recommend going into the config.toml file and changing the LogOutput to stdout, and the LogLevel to Info.

Then start the server:

./goTorrent

If you have LogLevel set to Info, you should see the confirmation that the client config has been generated.

You can then open your browser and connect to IP:Port (http) and you should see the main page. You will see an error for retrieving RSS feeds in stdout, but this is expected for first load.

You can press F12 if using Chrome to open the console and click around the UI to see the logging available for the frontend.

Running goTorrent as a Service

If you are on a linux system that uses systemd, in the dist-specific-files\Linux-systemd\ folder there is a goTorrent.service file that can be used to setup systemd for goTorrent. A quick overview of what is needed.

  1. Edit the systemd file to specify your specific implementation
  2. Copy the file to your systemd folder, i.e. /etc/systemd/system
  3. Enable the service systemctl enable goTorrent.service
  4. If using a new user, create that user and assign permissions:

    a. useradd goTorrent

    b. sudo chown -R goTorrent:goTorrent /opt/goTorrent

    c. If you want to test server: su goTorrent then run the executable

  5. Set your config.toml file to the values you want.

  6. Start your server: systemctl start goTorrent
  7. Check for errors: systemctl status goTorrent. You can also check logs\server.log.