Skip to content
OdinGitDat edited this page Nov 14, 2019 · 54 revisions

This page will help you get started with WM core. What it will do after you complete these steps is:

  • Display information about free disk space, torrents, etc.
  • Synchronize its database with the torrent client instances. It will display torrent download progress, torrents with tracker or other errors and recently downloaded torrents.
  • Add torrents to best torrent client instance from the homepage. You can paste What permalinks and click Add.
  • Monitor your user profile on What and display graphs based on that.
  • Keep a log of the events that happen on the torrents.
  • Play and download files straight from the WM interface.

The required steps are:

  1. Clone the GitHub repo in a directory of your choice. I use /mnt/tank/lamp/django/, so if you ever see that you know what it is. Choose your install directory, go there cd /mnt/tank/lamp/django, then git clone https://github.com/MADindustries/WhatManager2.git. cd WhatManager2 inside.

  2. If you have transmission installed, skip this step. Run ./setup_transmission-2.92.sh. This will download and install a recent version of libevent needed by Transmission and Transmission 2.92. If you are asked something and you don't know what to answer, just press Enter.

  3. You have to create the SQL database. You can name it whatever you want, I use what_manager2. Make sure the collation is utf8_unicode_ci. A command that does that is mysql -u root -p -e 'CREATE DATABASE what_manager2 COLLATE utf8_unicode_ci;'

  4. Run ./setup.sh. This will make sure the required system packages are installed, the required python packages are installed and the media directory has the correct rights. It will also copy the settings.example.py files to their correct location and rename them settings.py. You will need to edit these as described below. Note that during python module installation, the package "mod_wsgi-httpd" is downloaded and built. This can take several minutes so if this seems like it's hanging (after An error occurred while installing mod-wsgi), just let it go a for a bit.

  5. Edit ./WhatManager2/settings.py and set up some main variables (if you are able, you may do this while the venv installs from the previous step):

    1. WHAT_USER_ID should be set to the id of your user on What.
    2. WHAT_USERNAME should be your username on What.
    3. WHAT_PASSWORD should be your password on What.
    4. TRANSMISSION_PASSWORD should be the password that you want your Transmission instances to have. Pick anything you want. The configuration files for Transmission will be generated with that and you will use that if you want to manage your instances with a remote control app.
    5. TRANSMISSION_FILES_ROOT is the directory where Transmission's data files will go (settings, resume files, DHT cache, etc). Set this to something sensible.
    6. TRANSMISSION_USE_SYSTEMD tells the new transmission instance script to create a systemd file rather than an upstart file. (you will likely want to set this to 'False' if you are using a version of ubuntu 14.04 or older)
    7. In the DB configuration, which is where it says DATABASES = { enter the name of the database (what_manager2 by default), the user and the password for MySQL.
    8. TIME_ZONE is your local time zone. Look at Django docs if you don't know how to spell yours. A list of common timezones and their names can be obtained by running python -c "from pytz import common_timezones; print common_timezones;"
    9. Change SECRET_KEY to a random string.
    10. ALLOWED_HOSTS must be populated with any IPs or domains that you'll be hosting WhatManager under. For instance, if you're hosting it on a server with the IP address 1.2.3.4 and the domain whatmanager.com enter: ['whatmanager.com', '1.2.3.4']. Later versions of Django verify this even when Debug=True is set.
  6. If you will be using Bibliotik, open ./bibliotik/settings.py and fill it. If not, you can leave it as it is.

  7. If you will be using MyAnonaMouse, open ./myanonamouse/settings.py and fill it. If not, you can leave it as it is.

  8. If you will be using qobuz2, open ./qobuz2/settings.py and fill it. If not, you can leave it as it is.

  9. Create the required tables and initialize the admin user account by running pipenv run ./manage.py migrate. If you are asked to create a superuser, enter your desired credentials. If not, run pipenv run ./manage.py createsuperuser and then enter your credentials.

  10. Start the web server by running sudo service whatmanager start

  11. If you want WM to start at boot, run sudo systemctl enable whatmanager.service

  12. Fire up your browser and navigate to /admin on your Apache server. This is the admin panel. Go to Home -> Download locations. Create a download location. That's where your torrents will be downloaded. For zone enter redacted.ch, this is mandatory. For path enter anything you like, just make sure the Apache/WSGI process can write there AND Transmission can write there. You can just chmod it to 777 if you are unsure. Check the "preferred" option. If you have more than one download location, your downloads will go to the preferred one. Now go ahead and mkdir the directory then chmod it properly.

  13. Create your first Transmission instance. Actually, this is very easy. Just go to your git repo and run sudo pipenv run ./manage.py transmission_provision --new redacted.ch. You can accept all the defaults, they are standard for Transmission. The RPC port will be 9091 and the incoming peer port will be 51413. Any further instances will just increment these numbers. After you run this, you should have a running instance. You can connect to it with the above settings and any Transmission remote. Make sure to authenticate with username transmission and whatever password you entered in settings.py. By default Transmission won't auto start with the system. Configuring Transmission autostart

  14. Create a cron jobs to enable WM to sync with the Transmission instances periodically and update your user profile data from What. Make a standard cron file, I name mine /etc/cron.d/what_manager2. The basic sync is as follows (modify the URL if you installed WM in a subfolder):

    MAILTO=""
    */2 * * * * root curl --user <<your admin user username>>:<<password>> --connect-timeout 60 --max-time 120 
    http://localhost/json/sync
    

    The username and password here should be whatever you use to login to WM and admin (the user created by ./manage.py migrate). This basically imitates a browser opening a special WM page, which does the syncing. After you add this, if you go to WM and click Log then turn on "Info", you should see the sync running every 2 minutes. If you want, you can use edit your user's crontab with crontab -e, in which case the syntax is slightly different, like this:

    */2 * * * * curl --user <<your admin user username>>:<<password>> --connect-timeout 60 --max-time 120 
    http://localhost/json/sync
    
  15. Enjoy your WM 👍