Skip to content
This repository has been archived by the owner on Oct 19, 2021. It is now read-only.

Installation

PhlexPlexico edited this page Oct 31, 2019 · 5 revisions

Ubuntu 16.04+

1: Ubuntu

If you are new to using Ubuntu, there is a guide on Digital Ocean's community tutorial site that will provide information on how to setup and configure the operating system.

2: Dependencies

You will be required to setup a DNS record from a sub domain in order to use get5-web. For more information on how to do that, view here

Get5-Web requires other software installed on your Ubuntu machine. Run these commands in your terminal window.

sudo apt-get update && apt-get upgrade -y
sudo apt-get install build-essential software-properties-common -y
sudo apt-get install python-dev python-pip apache2 libapache2-mod-wsgi -y
sudo apt-get install virtualenv libmysqlclient-dev -y

Installing MySQL

sudo apt-get install mysql-server

You will be presented with a menu to select a root password, please use a secure password here and remember this password. You will need it later.

3: Creating the MySQL Database

In order to use get5 correctly, we will need to setup a database if you have not already done so.

mysql -u root -p

You will be prompted to enter a password, enter the password you used when you installed MySQL. Once logged in, follow the next step, replacing password with a password for the new user.

GRANT ALL PRIVILEGES ON get5.* TO 'get5'@'localhost' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
CREATE DATABASE get5;
quit

4: Clone

Run the following commands to download Get5-Web. This will place it in a new folder called get5-web, which we will immediately enter.

cd /var/www
git clone https://github.com/phlexplexico/get5-web
cd get5-web

5: Creating the Virtual Environment

We must now configure the python environment for which the process will run.

virtualenv venv
source venv/bin/activate
pip install -r requirements.txt

6: Configuration

We will now setup the config for your application.

cd instance
cp prod_config.py.default prod_config.py

Next, open up prod_config.py and change the values as follows:

  • SQLALCHEMY_DATABASE_URI: 'mysql://get5:<password>@localhost/get5'
  • STEAM_API_KEY : <YOUR API KEY>
  • SECRET_KEY:
    • Random key. Generate some random text into here.
  • DATABASE_KEY:
    • A 16 character key for encrypting passwords in the database.

With the core configuration completed, there are now more advanced options available. These are documented inside the configuration file. Should you wish to whitelist the panel to specific users, look into the WHITELISTED_IDS and ADMIN_IDS section.

7: Database Migrations

With the configuration now completed, we can now import the tables into the database.

cd ../
./manager.py db upgrade

8: Logo Support

If you want logos to be available to use from your panel, these should be uploaded into get5/static/resource/csgo/resource/flash/econ/tournaments/team. A good source is http://csgo-data.com/. They can also be uploaded through the UI when creating a team. Please make sure your images are < 16kB in size, PNG/SVG, and 64x64px in size.

9: WSGI Configuration

To ensure that logging can occur properly, we need to set correct permissions for the web user.

cd /var/www/get5-web
chown -R www-data logs

Next, we need to create a WSGI file, which will send our python application to the webserver. Create /var/www/get5-web/get5.wsgi, and insert the following code block into the file before saving.

#!/usr/bin/python

activate_this = '/var/www/get5-web/venv/bin/activate_this.py'
execfile(activate_this, dict(__file__=activate_this))

import sys
import logging
logging.basicConfig(stream=sys.stderr)

folder = "/var/www/get5-web"
if not folder in sys.path:
    sys.path.insert(0, folder)
sys.path.insert(0,"")

from get5 import app as application
import get5
get5.register_blueprints()

10: Webserver Configuration

We now need to setup Apache to process the content, do this by creating /etc/apache2/sites-enabled/get5.conf, with the following content. Be sure to change <hostname> to be your chosen sub domain, and <email> with your email if required. A SERVER IP WILL NOT WORK.

<VirtualHost *:80>
	ServerName <hostname>
	ServerAdmin <email>
	WSGIScriptAlias / /var/www/get5-web/get5.wsgi

	<Directory /var/www/get5>
		Order deny,allow
		Allow from all
	</Directory>

	Alias /static /var/www/get5-web/get5/static
	<Directory /var/www/get5-web/get5/static>
		Order allow,deny
		Allow from all
	</Directory>

	ErrorLog ${APACHE_LOG_DIR}/error.log
	LogLevel warn
	CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

After this, we just need to restart the webserver

service apache2 restart

11: Optional - Move to SSL

In order to move to SSL, you will need to generate your own cert, which can be done on your machine, or you can use something like certbot in order to get certificates assigned to your server. Lookup certbot for apache, and you will find plenty of resources. Once this is done, update your VirtualHost header to be

<VirtualHost *:443>

Instead of 80. Once this is done, restart your server

service apache2 restart

PLEASE NOTE YOU STILL NEED HTTP IN ORDER FOR THE PLUGIN TO COMMUNICATE (SteamExtensions)

12: Finished

Navigate to your sub domain in the browser and view the finished results.

13: Building get5_apistats

In order to get the veto module fully functional on the site, you will have to compile the API plugin from this repository. In order to do this, you will need to go download sourcemod, and extract it to a directory of your choice. System2 is required. Please download, and extract into addons/sourcemod/.

Note you need the Steamworks extension for this plugin.

13b: Gathering requirements

System2

Steamworks

Lastly, sm-json will be required to build this plugin. Clone the repository, and then copy everything into the includes directory. For example:

git clone https://github.com/clugg/sm-json
cp -r sm-json/addons/sourcemod/scripting/include/json sm-json/addons/sourcemod/scripting/include/json.inc .
rm -rf sm-json

13c: Building and deploying

Now build the project. Move to the scripting directory and build the plugin:

chmod +x spcomp
./spcomp get5_apistats.sp

The plugin should be compiled to a *.smx file in that directory. Copy and paste to your server inside the plugins directory.