Skip to content

Installation Guide

Oliver Bryant edited this page May 10, 2020 · 9 revisions

This installation guide aims in helping you setup VirtQueue for production. Flask should never be run on it's default dev web server in production. For WSGI Gunicorn will be used and to proxy the connection and to provide tls/https Caddy v2. will be used.

It is expected that you have setup a VPS/Server and configured the domain dns to include an A record pointing to your VPS. In this example the sub-domain is used however you may modify the Caddyfile domain to use the root domain without queue.

Install Git

Ubuntu/Debian sudo apt-get install git

CentOS 8/RHEL 8 dnf install git

CentOS 7/RHEL 7/ yum install git

Install Python

RHEL 8/CentOS 8/Fedora dnf install python

RHEL 7/CentOS 7 yum install python

Create The Folder

mkdir /var/www

Change Into Working Directory.

cd /var/www

Git Clone The Repo

git clone the repository: https://github.com/kittymagician/VirtQueue.git

Install Dependencies on your server.

pip3 install -r requirements.txt

Sign Up For A Twilio Account (optional)

Visit https://www.twilio.com/try-twilio, Register an account. Top up the balance and purchase an sms compatible number. You will want to set the mobile phone's sms webhook to your server's hostname. for example domain.com/sms.

Configure app.py with Twilio and user settings.

Edit the app.py with the Twilio API, Twilio number (optional)

sms_support = False # Change this to activate SMS support. 
account_sid = 'twilio account sid here' #Twilio Account SID
auth_token = 'twilio auth token here' #Twilio Auth Token
twilio_number = 'twilio number here' #Twilio Number
domain = 'domain.com' # Change this for SMS/Email messages to include your domain.

Setup the database

Setup the database by running python3 firstrun.py

You will be prompted to enter a username and password.

Username: must more than 4 charactors and less than 15. Password: more than 8 charactors less than 80.

Install Caddy

Using Ubuntu/Debian Download a binary from https://github.com/caddyserver/caddy/releases

Once downloaded untar the file and then move the Caddy binary to /usr/bin using the following command: sudo mv caddy /usr/bin/

Using RHEL/CentOS/Fedora

RHEL 8/CentOS 8/Fedora

dnf install 'dnf-command(copr)'
dnf copr enable @caddy/caddy
dnf install caddy

RHEL 7/CentOS 7

yum install yum-plugin-copr
yum copr enable @caddy/caddy
yum install caddy

Modify Caddyfile provided and change the parts that say "yourdomain.com and youremail@domain.com" to your details..

queue.yourdomain.com {
    root * /var/www/VirtQueue
    tls youremail@domain.com
    reverse_proxy localhost:5000 {
        flush_interval -1
    }
    header {
        X-Content-Type-Options nosnif
        X-Frame-Options DENY
        Referrer-Policy no-referrer-when-downgrade
   }
}

Adapt Caddyfile

As Caddy now requires JSON configuration we will use the adapt command to take the Caddyfile in and process it with JSON for Caddy to read. caddy adapt

Run gunicorn

We will now kick off gunicorn. In the working directory run the following command. gunicorn --bind 0.0.0.0:5000 --workers=5 --threads=2 wsgi:app --preload --daemon

Run caddy

Finally! we will run caddy as a transparent proxy and have tls enabled. Run this command inside the working directory. caddy run

If you need to delete the Database

run droptables.py

Congratulations you have successfully configured and installed the software!

Customizing the queue page

The queue page can be customized in your favorite editor or even notepad. The page is located at /templates/queue.html

The map is embedded from umap which is part of the open street maps project. It is an open source alternative to Google Maps.

Please do not edit the script on the page as it will break the queue page.

Support

If you have any questions feel free to reach out. If your reporting a bug please raise an issue in the github repository so that it is visable to others.