Skip to content

Configuration Guide

Alfred Gutierrez edited this page Nov 27, 2016 · 5 revisions

Work in progress

Use this guide as a reference for configuring settings.py. See comments for description of each configuration option.

settings.py - Default settings.

Application Settings

# -*- coding: utf-8 -*-
import os

APP_HOST = '0.0.0.0'  # Application bind address.
APP_PORT = 5000  # Application port.
APP_DEBUG = True  # Output debug stacktrace. Disable this for production.

# Secret key for storing sessions. The secret key should be randomly generated.
# See: http://flask.pocoo.org/docs/0.11/quickstart/#sessions for best practice.
APP_SESSION_KEY = 'super-secret'

CSRF_ENABLED = True  # Enable Cross-Site Request Forgery tokens for form submission.
ASSETS_DEBUG = True  # Enable debug-mode for Flask-Assets. See: https://flask-assets.readthedocs.io/en/latest/

# Base directory for project root used in other settings. This should be left as default.
BASE_DIR = os.path.abspath(os.path.dirname(__file__))

Database/Storage/Cache/Message Queue Settings

REDIS_HOST = os.environ.get('REDIS_HOST', 'localhost:6379')  ## Redis host/port from environment variable. Defaults to localhost.

# Database Engine URI. This should be in the form of the dialect and driver URI supported by SQLAlchemy.
# See: http://docs.sqlalchemy.org/en/latest/core/engines.html#database-urls
DATABASE_URI = 'sqlite:////tmp/test.db'

# Celery Settings using the redis host as the broker and celery result backend.
# See: http://docs.celeryproject.org/en/latest/getting-started/first-steps-with-celery.html#configuration
BROKER_URL = 'redis://%s/0' % REDIS_HOST
CELERY_RESULT_BACKEND = 'redis://%s/0' % REDIS_HOST
CACHE_BACKEND = 'simple'  ## Simple for in-memory cache. You can also use 'redis' here for redis-based caching.

Mumble virtual server defaults.

# Murmur default settings
DEFAULT_MAX_USERS = 15
DEFAULT_CHANNEL_NAME = 'GuildBit.com Mumble Server'

# Murmur server default port. All virtual servers created will be a next available port over 50000.
DEFAULT_MURMUR_PORT = 50000 

Email Settings.

Any SMTP email server settings should be configured here.

MAIL_SERVER = 'email-smtp.us-east-1.amazonaws.com'
MAIL_PORT = 587
MAIL_USE_TLS = True
MAIL_USE_SSL = True
MAIL_USERNAME = ''
MAIL_PASSWORD = ''
DEFAULT_MAIL_SENDER = 'admin@email.com'
EMAIL_RECIPIENTS = ['admin@email.com']

OpenID Authentication

Guildbit has OpenID authentication built-in, but it is only used for administrative access. Currently, only the Steam OpenID auth is configured.

See:

OPENID_PROVIDERS = [
    {'name': 'Steam', 'url': 'http://steamcommunity.com/openid'}
]

STEAM_API_KEY = 'XXXXXX'

Internationalization

Guildbit uses Flask-Babel for translations. Languages are loaded by browser's locale settings.

See:

LANGUAGES = {
    'en': 'English',
    'es': 'Español'
}

Murmur-REST Hosts

Murmur-REST hosts are to be configured here. Add multiple servers/regions. See: https://github.com/alfg/murmur-rest

MURMUR_HOSTS = [
    {
        'name': 'localhost',  # Name of server.
        'address': 'localhost:5000',  # Host + Port of server.
        'uri': 'http://localhost:5000',  # Full URI of server.
        'hostname': 'localhost',  # Hostname.
        'http_uri': 'http://localhost:4000/static/img',  # Static WWW. Used for serving statistics via vnstati. See: https://github.com/alfg/guildbit/blob/master/etc/cron.sh.
        'monitor_uri': 'http://localhost:5555',  # Link to live monitoring UI. https://github.com/scoutapp/scout_realtime
        'contact': 'name@email.com',  # General contact for host.
        'location': 'local',  # Location of server. Should be all lowercase and underscore only. (us_west, us_east, eu)
        'location_name': 'Local',  # Friendly name of server. Used in the dropdown on the server selection form.
        'status': 'active',  # Status if active or inactive.
        'capacity': 100,  # Max recommended capacity for host.
        'username': '',  # Username if authentication is enabled on murmur-rest host.
        'password': ''  # Password if authentication is enabled on murmur-rest host.
    }
]

Docker Config.

This configuration is only used if the DOCKER_TEST environment variable is set to 1 or True. This is used for the provided Dockerfile and docker-compose.yml for development and testing only. Otherwise this configuration is ignored.

# Use only if in test docker environment.
DOCKER_TEST = os.environ.get('DOCKER_TEST', False)
if DOCKER_TEST:
    MURMUR_HOSTS = [{
        'name': 'Test Server',
        'address': 'murmur-rest:5000',
        'uri': 'http://murmur-rest:5000',
        'hostname': 'murmur-rest',
        'http_uri': 'http://localhost:4000/static/img',
        'monitor_uri': 'http://localhost:5555',
        'location': 'local',
        'location_name': 'Local',
        'status': 'active',
        'capacity': 100,
        'username': '',
        'password': ''
    }]

Admin Hosting Packages

Hosting packages are configured here. Just list the name, slots and duration of each package.

You will then be able to see the options listed under: https://guildbit.com/admin/tokens/

This configuration is ONLY for when creating premium servers from the Admin panel. To configure purchasable upgrade packages for end users, you will still need to manually edit: https://github.com/alfg/guildbit/blob/master/app/templates/upgrade.html

PACKAGES = [
    {
        'name': 'PACKAGE-Test',
        'slots': 10,
        'duration': 48  # Days in hours
    },
    {
        'name': 'PACKAGE-A',
        'slots': 25,
        'duration': 168  # Days in hours
    },
    {
        'name': 'PACKAGE-B',
        'slots': 25,
        'duration': 336  # Days in hours
    },
    {
        'name': 'PACKAGE-C',
        'slots': 25,
        'duration': 720 # Days in hours
    }
]