From: Ant Zucaro Date: Sun, 8 Nov 2015 19:22:01 +0000 (-0500) Subject: Clean up the production configuration file. X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=290fc85042b52b27f1c255ee8e96d4a41401591c;p=xonotic%2Fxonstat.git Clean up the production configuration file. This includes a little better organization of the production.ini file for administrators. It includes comments on the different directives, better indentation, and rotating log files of limited size using Python's logging.handlers.RotatingFileHandler facility. --- diff --git a/production.ini b/production.ini index 1acf5c8..c683216 100644 --- a/production.ini +++ b/production.ini @@ -1,52 +1,49 @@ [app:XonStat] -use = egg:XonStat -reload_templates = false -debug_authorization = false -debug_notfound = false -debug_routematch = false -debug_templates = false -default_locale_name = en -sqlalchemy.url = sqlite:///%(here)s/XonStat.db -mako.directories = xonstat:templates +use = egg:XonStat +reload_templates = false +debug_authorization = false +debug_notfound = false +debug_routematch = false +debug_templates = false +default_locale_name = en +sqlalchemy.url = postgresql+psycopg2://xonstat:PASSWORD@localhost:5432/xonstatdb +mako.directories = xonstat:templates # Beaker cache settings # Default is to use one region with hourly cache invalidation -cache.regions = hourly_term -cache.type = memory -cache.hourly_term.expire = 3600 +cache.regions = hourly_term +cache.type = memory +cache.hourly_term.expire = 3600 +# XonStat-specific settings xonstat.minimum_required_players = 2 -xonstat.leaderboard_lifetime = 7 -xonstat.verify_requests = true +xonstat.leaderboard_lifetime = 7 +xonstat.verify_requests = true [filter:weberror] -use = egg:WebError#error_catcher +use = egg:WebError#error_catcher debug = false -;error_log = -;show_exceptions_in_wsgi_errors = true -;smtp_server = localhost -;error_email = janitor@example.com -;smtp_username = janitor -;smtp_password = "janitor's password" -;from_address = paste@localhost -;error_subject_prefix = "Pyramid Error" -;smtp_use_tls = -;error_message = - -[filter:tm] -use = egg:repoze.tm2#tm -commit_veto = repoze.tm:default_commit_veto [pipeline:main] pipeline = - weberror - tm XonStat [server:main] -use = egg:Paste#http -host = 0.0.0.0 -port = 6543 +# Gunicorn settings. See http://docs.gunicorn.org/en/19.3/configure.html. +use = egg:gunicorn#main +user = xonstat +group = xonstat +proc_name = xonstat +daemon = True +bind = 0.0.0.0:6543 +workers = 4 +max_requests = 5000 +timeout = 30 +graceful_timeout = 30 +pidfile = /tmp/xonstat.pid +loglevel = INFO +accesslog = ~/xonstat/xonstat_access.log +errorlog = ~/xonstat/xonstat.log # Begin logging configuration @@ -60,27 +57,30 @@ keys = console keys = generic [logger_root] -level = WARN -handlers = console +level = WARN +handlers = console, error_file [logger_xonstat] -level = WARN +level = WARN handlers = qualname = xonstat [logger_sqlalchemy] +# INFO logs SQL queries, DEBUG logs queries and results, and WARN logs neither level = WARN handlers = qualname = sqlalchemy.engine -# "level = INFO" logs SQL queries. -# "level = DEBUG" logs SQL queries and results. -# "level = WARN" logs neither. (Recommended for production systems.) [handler_console] -class = StreamHandler -args = (sys.stderr,) -level = NOTSET +class = StreamHandler +args = (sys.stderr,) +level = NOTSET +formatter = generic + +[handler_error_file] +class = logging.handlers.RotatingFileHandler formatter = generic +args = ('~/xonstat/xonstat.log', 'a', 50000000, 5) [formatter_generic] format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s