Votefinder

From SA Mafia Wiki
Revision as of 12:41, 17 July 2020 by Soaring Kestrel (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

For Users

Votefinder is our tallying system for mafia games and it has a whole bunch of very cool features!

How to make a game

  1. Make a thread in The Game Room with Mafia in the title.
  2. Make an account or Log in to Votefinder.
  3. Go to Add a Game
  4. Votefinder should list all current Mafia games on the first two pages of the game room subforum. Choose yours and click the link to assign you as the moderator.
  5. Once you have a page that looks like this, you're all done:

1 tq7Y6QW.png

Important features

Most of votefinder is pretty self-explanatory, but there are a few features to note for first time moderators

How to change your playerlist

When you first ask votefinder to find your thread it's going to list everyone who has posted in that thread as part of the player list. You'll want to take out people who aren't playing by dragging them to the spectator column.

Also remember to move players from living to dead before opening the next day.

Posting the Votecount

On the votecount tab you will see the current votecount for that day. All players can see this tab and the box to manually copy and paste the current votecount, but only the moderator can use the "Post Votecount" button to make votefinder post. After this button has been pressed it will be unavailable for an hour. The post votecount button makes votefinder post what the current votecount is, but you can also have an automatically updating picture of the votecount by clicking this button at the top of the page. Put this in your OP (usually right at the top) so that your players can automatically check the votecount at any time without having to go to votefinder. Finally, always make sure to post the votecount at the end of the day after someone has been hammered (they have reached the threshold to be hanged) since votefinder resets the votecount at the beginning of a new day. Knowing how everyone was voting at the end of the day is very important to town.

Making a playerlist

Under "Tools" votefinder will automatically create a playerlist that links each name to that player's post history in the thread. This is an absolutely essential tool for your players as they will frequently be checking people's post histories. Replace your handmade player list during signups with this as soon as the game starts.

Closing your game

Always close your game!!! This will remove it from the active games list, so that list doesn't become cluttered and give you a wiki code for the victory. You'll need to register an account at the wiki to post it there. If for whatever reason you can't register, post the information in the thread and someone will add it for you. Just be sure to change (something) to whichever team won.

Making a Template

By default, votefinder posts look like this.

If you want votefinder to say something different or give different information you can change how votefinder will post by making a template. To do so click on your name and go to "My Templates" From there you can go in and change text, how votes are displayed, what information is displayed, and so on. Click Show Instructions if you want to be sure you're not going to break it.


For Developers

Architecture

The current hosting is done using nginx + Passenger.

The application is written in Python.

Installation

Installing the app

Current install instructions can be found in the repository Modify settings.py to reflect your local configuration. ALLOWED_HOSTS is particularly important.

Database/MySQL

Import the db-skel.sql from the cloned Git repository.

apt-get install mariadb-server
mysql_secure_installation # Set up your root password here.
mysql -uroot -p
grant all privileges on votefinder.* to 'votefinder'@'localhost' identified by 'votefinder'; # Obviously, replace these with the username/password/database name you use - don't use these.
flush privileges;

If you're cloning directly from existing files instead of using a database dump, try the following:

systemctl stop mysql
cd /home/ubuntu/votefinder
cp votefinder /var/lib/mysql/votefinder -r
cd /var/lib/mysql/
chown mysql:mysql votefinder -R
systemctl start mysql


Debugging/Dev Server

cd ~/votefinder-web
python manage.py runserver 0.0.0.0:8090

The server is now running on port 8090 and will show you debug output in the terminal.

Production server using nginx

Move your Votefinder files into /var/www/html.

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 561F9B9CAC40B2F7
sudo apt-get install -y apt-transport-https ca-certificates

# Add our APT repository
sudo sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger xenial main > /etc/apt/sources.list.d/passenger.list'
sudo apt-get update

Install Passenger + Nginx:

sudo apt-get install -y nginx-extras passenger

Edit /etc/nginx/nginx.conf and uncomment include /etc/nginx/passenger.conf;

systemctl restart nginx

sudo /usr/bin/passenger-config validate-install

# /etc/nginx/sites-enabled/votefinder.conf (linked from /etc/nginx/sites-available):
server {
    listen 80;
    listen 443 ssl;
    server_name domain.com www.domain.com;
    root /path/to/your/votefinder/repository;

    passenger_enabled on;
    passenger_user www-data;
    ssl_certificate /etc/letsencrypt/live/domain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/domain.com/privkey.pem;
    ssl_prefer_server_ciphers On;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS;
    add_header X-Frame-Options DENY;
}

systemctl restart nginx

Change your site URL in the Django backend (/admin). You may need to run python manage.py createsuperuser and create your own administrative user to change this.

Production server using Apache

Move your Votefinder installation into /var/www/html.

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 561F9B9CAC40B2F7
sudo apt-get install -y apt-transport-https ca-certificates

# Add our APT repository
sudo sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger xenial main > /etc/apt/sources.list.d/passenger.list'
sudo apt-get update

Install Passenger + Apache module:

sudo apt-get install -y libapache2-mod-passenger passenger

Move settings.py into the votefinder subdirectory.

<VirtualHost *:80>
    ServerName domain.com
    ModPagespeed Off
    PassengerEnabled on
    PassengerUser websiteuser
    DocumentRoot /var/www/html/domain.com/votefinder
    <Directory /var/www/html/domain.com/votefinder>
        Allow from all
        Options -MultiViews
        Require all granted
    </Directory>
</VirtualHost>

Create websiteuser and grant permission on directory.

Adding an SSL Certificate

Certbot on Ubuntu Xenial

If you're having trouble doing this, try commenting the "listen 443 ssl;", "ssl_certificate_key", and "ssl_certificate" lines in /etc/nginx/sites-enabled/votefinder.conf.

Troubleshooting

nginx / production

  • If you're getting a 503 error, make sure the Passenger service is running (sudo systemctl status passenger). This logs to the nginx error log, so check there to see if there are any issues as well.
  • If you can't pull up the site at all, check your firewall (ufw on Ubuntu, iptables on RHEL/CentOS), AWS security groups, and make sure nginx is running (sudo systemctl status nginx).
  • 404 errors may indicate that there's a problem with the site configuration. Make sure your path is set correctly in /etc/nginx/sites-enabled/votefinder.conf.
  • If SSL is not working, make sure you have openssl installed (sudo yum install openssl on RHEL/CentOS or sudo apt-get install openssl on Ubuntu).
  • If SSL is still not working (expired certificate errors), try running "sudo certbot renew" (RHEL/CentOS) or "sudo letsencrypt renew" (Ubuntu) and then reloading nginx (sudo systemctl reload nginx)