From 43540edd9369d19c0a4cec62bbaae9f6c94b2cfe Mon Sep 17 00:00:00 2001 From: Branson Stephens <branson.stephens@ligo.org> Date: Thu, 3 Sep 2015 10:19:24 -0500 Subject: [PATCH] Changes for new test instance and cleanup fo some old settigs files. --- .gitignore | 1 + settings/__init__.py | 15 +-- settings/development.py | 45 -------- settings/development_er2.py | 46 -------- settings/stage.py | 15 --- settings/test.py | 217 ++++++++++++++++++++++++++++++++++++ wsgi/test.wsgi | 17 +++ 7 files changed, 237 insertions(+), 119 deletions(-) delete mode 100644 settings/development.py delete mode 100644 settings/development_er2.py delete mode 100644 settings/stage.py create mode 100644 settings/test.py create mode 100644 wsgi/test.wsgi diff --git a/.gitignore b/.gitignore index c27b0959e..99b980705 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,6 @@ django-*.wsgi static-collected static/admin/ static/rest_framework/ +static/debug_toolbar/ doc/build/* doc/build/.buildinfo diff --git a/settings/__init__.py b/settings/__init__.py index 327421861..c13702754 100644 --- a/settings/__init__.py +++ b/settings/__init__.py @@ -15,28 +15,17 @@ import os ROOT_PATH = os.path.abspath( os.path.join( os.path.dirname(__file__), os.pardir ) ) configs = { - '/home/bmoe/ER2': 'development_er2', - '/home/bmoe/er2box/lib/python2.6/site-packages/gracedb' : 'development_er2', - - '/home/bmoe/er2box/lib/python2.6/site-packages/ER2' : 'development_er2', - - '/home/bmoe/gracedb': 'development', - '/home/bmoe/gracedb/gracedb': 'development', - '/home/gracedb/gracedb': 'production', '/home/gracedb/graceproj': 'production', '/home/branson/gracedbdev': 'branson', '/home/branson/gracedbdev/gracedb': 'branson', - '/home/fzhang/gracedb/gracedb': 'fan', - '/home/fzhang/gracedb/gracedb/gracedb': 'fan', + '/home/branson.stephens/gracedb': 'test', + '/home/branson.stephens/gracedb/gracedb': 'test', '/home/roywilliams/gracedbdev': 'roy', '/home/roywilliams/gracedbdev/gracedb': 'roy', - - "/home/gracedb/gracestage" : "stage", - } diff --git a/settings/development.py b/settings/development.py deleted file mode 100644 index dbd0163ce..000000000 --- a/settings/development.py +++ /dev/null @@ -1,45 +0,0 @@ - -CONFIG_NAME = "DEVELOPMENT" - -DEBUG = True -TEMPLATE_DEBUG = DEBUG - - -ALERT_EMAIL_FROM = "Dev Alert <root@moe.phys.uwm.edu>" -ALERT_EMAIL_TO = [ - "Brian Moe <bmoe@gravity.phys.uwm.edu>", - ] -ALERT_EMAIL_BCC = ["bmoe@uwm.edu"] - -ALERT_TEST_EMAIL_FROM = "Dev Test Alert <root@moe.phys.uwm.edu>" -ALERT_TEST_EMAIL_TO = [ - "Brian Moe <bmoe@gravity.phys.uwm.edu>", - ] - -# Don't sent out non-test XMPP alerts on dev box! -XMPP_ALERT_CHANNELS = [ - 'test_omega', - 'test_mbtaonline', - 'test_cwb', - 'test_lowmass', - ] - -# SkyAlert -SKYALERT_IVORN_PATTERN = "ivo://ligo.org/gracedb#%s-dev" - -# Latency histograms. Where they go and max latency to bin. -LATENCY_REPORT_DEST_DIR = "/home/bmoe/data/latency" -LATENCY_REPORT_WEB_PAGE_FILE_PATH = LATENCY_REPORT_DEST_DIR + "/latency.inc" - -# Uptime reporting -UPTIME_REPORT_DIR = "/home/bmoe/data/uptime" - - -SITE_ID = 1 - -TEMPLATE_DIRS = ( - # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". - # Always use forward slashes, even on Windows. - # Don't forget to use absolute paths, not relative paths. - "/home/bmoe/gracedb/templates", -) diff --git a/settings/development_er2.py b/settings/development_er2.py deleted file mode 100644 index 22260173c..000000000 --- a/settings/development_er2.py +++ /dev/null @@ -1,46 +0,0 @@ - - -CONFIG_NAME = "ER2" - -DEBUG = True -TEMPLATE_DEBUG = DEBUG - -DATABASES = { - 'default' : { - 'NAME' : 'er2', - 'ENGINE' : 'django.db.backends.mysql', - 'USER' : 'er2', - 'PASSWORD' : 'weasel', - } -} - -ALERT_EMAIL_FROM = "Dev Alert <root@moe.phys.uwm.edu>" -ALERT_EMAIL_TO = [ - "Brian Moe <bmoe@gravity.phys.uwm.edu>", - ] -ALERT_EMAIL_BCC = ["bmoe@uwm.edu"] - -ALERT_TEST_EMAIL_FROM = "Dev Test Alert <root@moe.phys.uwm.edu>" -ALERT_TEST_EMAIL_TO = [ - "Brian Moe <bmoe@gravity.phys.uwm.edu>", - ] - -XMPP_ALERT_CHANNELS = [ - ] - -# SkyAlert -SKYALERT_IVORN_PATTERN = "ivo://ligo.org/gracedb#%s-dev-er2" - -# Latency histograms. Where they go and max latency to bin. -LATENCY_REPORT_DEST_DIR = "/home/bmoe/data/latency" - -SITE_ID = 4 - -TEMPLATE_DIRS = ( - # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". - # Always use forward slashes, even on Windows. - # Don't forget to use absolute paths, not relative paths. - "/home/bmoe/ER2/templates", -) - - diff --git a/settings/stage.py b/settings/stage.py deleted file mode 100644 index d3e022891..000000000 --- a/settings/stage.py +++ /dev/null @@ -1,15 +0,0 @@ - -DEBUG = True -TEMPLATE_DEBUG = DEBUG - -CONFIG_NAME = "STAGE" - -SITE_ID = 3 - -EMAIL_HOST = 'localhost' - -MEDIA_ROOT = '/home/gracedb/gracestage/static/' - -TEMPLATE_DIRS = ( - "/home/gracedb/gracestage/templates", -) diff --git a/settings/test.py b/settings/test.py new file mode 100644 index 000000000..f7f7682c3 --- /dev/null +++ b/settings/test.py @@ -0,0 +1,217 @@ +CONFIG_NAME = "Test" + +DEBUG = True +TEMPLATE_DEBUG = DEBUG +DEBUG_TOOLBAR_PATCH_SETTINGS = False + +DATABASES = { + 'default' : { + 'NAME' : 'gracedb', + 'ENGINE' : 'django.db.backends.mysql', + 'USER' : 'gracedb', + 'PASSWORD' : 'thinglet', + 'OPTIONS' : { + 'init_command' : 'SET storage_engine=MYISAM', + }, + } +} + +CACHES = { + 'default': { + 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', + 'LOCATION': '127.0.0.1:11211', + + }, + # this cache backend will be used by django-debug-panel + 'debug-panel': { + 'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache', + 'LOCATION': '/tmp/debug-panel-cache', + 'OPTIONS': { + 'MAX_ENTRIES': 200 + } + }, +} + +STATIC_URL = "/gracedb-static/" +STATIC_ROOT = "/home/branson.stephens/gracedb/static/" + +BOWER_URL = "/bower-static/" +BOWER_ROOT = "/home/branson.stephens/bower_components/" + +GRACEDB_DATA_DIR = "/exports/gracedb/data" + +EMAIL_HOST = 'localhost' + +ALERT_EMAIL_FROM = "Dev Alert <root@gracedb-test.cgca.uwm.edu>" +#ALERT_EMAIL_TO = [ +# "Branson Stephens <branson@gravity.phys.uwm.edu>", +# ] +#ALERT_EMAIL_BCC = ["branson@gravity.phys.uwm.edu"] +# +#ALERT_TEST_EMAIL_FROM = "Dev Test Alert <root@gracedb-test.cgca.uwm.edu>" +#ALERT_TEST_EMAIL_TO = [ +# "Branson Stephens <branson@gravity.phys.uwm.edu>", +# ] +ALERT_EMAIL_TO = [] +ALERT_EMAIL_BCC = [] +ALERT_TEST_EMAIL_FROM = "Dev Test Alert <root@gracedb-test.cgca.uwm.edu>" +ALERT_TEST_EMAIL_TO = [] +ALERT_XMPP_SERVERS = ["lvalert-test.cgca.uwm.edu",] + +LVALERT_SEND_EXECUTABLE = '/home/branson.stephens/djangoenv/bin/lvalert_send' + +USE_LVALERT_OVERSEER = True + +# For each lvalert server, a separate instance of the lvalert_overseer +# must be running and listening on a distinct port. +LVALERT_OVERSEER_PORTS = { + 'lvalert-test.cgca.uwm.edu': 8001, +} + +EMBB_MAIL_ADDRESS = 'branson.stephens@gracedb-test.cgca.uwm.edu' +EMBB_SMTP_SERVER = 'localhost' +EMBB_MAIL_ADMINS = ['branson@gravity.phys.uwm.edu',] +EMBB_IGNORE_ADDRESSES = ['Mailer-Daemon@gracedb-test.cgca.uwm.edu',] + +# Don't sent out non-test XMPP alerts on dev box! +XMPP_ALERT_CHANNELS = [ + 'test_omega', + 'test_mbtaonline', + 'test_cwb', + 'test_lowmass', + ] + +# Latency histograms. Where they go and max latency to bin. +LATENCY_REPORT_DEST_DIR = "/exports/gracedb/latency" +LATENCY_REPORT_WEB_PAGE_FILE_PATH = LATENCY_REPORT_DEST_DIR + "/latency.inc" + +# Uptime reporting +UPTIME_REPORT_DIR = "/exports/gracedb/uptime" + +# Rate file location +RATE_INFO_FILE = "/exports/gracedb/rate_info.json" + +TEMPLATE_DIRS = ( + # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". + # Always use forward slashes, even on Windows. + # Don't forget to use absolute paths, not relative paths. + "/home/branson.stephens/gracedb/templates", +) + +MIDDLEWARE_CLASSES = [ + 'middleware.accept.AcceptMiddleware', + 'middleware.cli.CliExceptionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'ligoauth.middleware.auth.LigoAuthMiddleware', + 'middleware.performance.PerformanceMiddleware', + #'debug_toolbar.middleware.DebugToolbarMiddleware', + #'debug_panel.middleware.DebugPanelMiddleware', + #'middleware.profiling.ProfileMiddleware', +] + +INSTALLED_APPS = ( + 'django.contrib.auth', + 'django.contrib.admin', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.staticfiles', + 'gracedb', + 'userprofile', + 'ligoauth', + 'rest_framework', + 'guardian', + #'debug_toolbar', + #'debug_panel', +) + +INTERNAL_IPS = ( + '129.89.57.83', +) + +CONTROL_ROOM_IPS = { + 'H1': '108.45.69.217', + 'L1': '129.2.92.124', +# 'L1': '129.89.57.83', +} + +# Settings for Logging. +import logging + +LOG_ROOT = '/home/branson.stephens/logs' +LOG_FILE_SIZE = 1024*1024 # 1 MB +LOG_FILE_BAK_CT = 3 +LOG_FORMAT = 'verbose' +LOG_LEVEL = 'DEBUG' + +# Note that mode for log files is 'a' (append) by default +# The 'level' specifier on the handle is optional, and we +# don't need it since we're using custom filters. +LOGGING = { + 'version': 1, + 'disable_existing_loggers' : True, + 'formatters': { + 'simple': { + 'format': '%(levelname)s %(message)s', + }, + 'verbose': { + 'format': '%(asctime)s: %(name)s: %(message)s', + 'datefmt': '%Y-%m-%d %H:%M:%S', + }, + }, + 'handlers': { + 'null': { + 'level':'DEBUG', + 'class':'django.utils.log.NullHandler', + }, + 'debug_file': { + 'class': 'logging.handlers.RotatingFileHandler', + 'formatter': LOG_FORMAT, + 'filename': '%s/gracedb_debug.log' % LOG_ROOT, + 'maxBytes': LOG_FILE_SIZE, + 'backupCount': LOG_FILE_BAK_CT, + }, + 'performance_file': { + 'class': 'logging.FileHandler', + 'formatter': 'simple', + 'filename': '%s/gracedb_performance.log' % LOG_ROOT, + }, + 'mail_admins': { + 'level': 'ERROR', + 'class': 'django.utils.log.AdminEmailHandler' + } + }, + 'loggers': { + 'django': { + 'handlers': ['null'], + 'propagate': True, + 'level': 'INFO', + }, + 'gracedb': { + 'handlers': ['debug_file'], + 'propagate': True, + 'level': LOG_LEVEL, + }, + 'ligoauth': { + 'handlers': ['debug_file'], + 'propagate': True, + 'level': LOG_LEVEL, + }, + 'middleware': { + 'handlers': ['performance_file'], + 'propagate': True, + 'level': 'INFO', + }, + 'userprofile': { + 'handlers': ['debug_file'], + 'propagate': True, + 'level': LOG_LEVEL, + }, + 'django.request': { + 'handlers': ['mail_admins'], + 'level': 'ERROR', + 'propagate': False, + }, + }, +} diff --git a/wsgi/test.wsgi b/wsgi/test.wsgi new file mode 100644 index 000000000..c56e08185 --- /dev/null +++ b/wsgi/test.wsgi @@ -0,0 +1,17 @@ +import os +import sys + +os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' + +# Add the source code directory +sys.path.insert(1,'/home/branson.stephens/gracedb') + +# Activate the virtual environment +VIRTUALENV_ACTIVATOR = "/home/branson.stephens/djangoenv/bin/activate_this.py" +execfile(VIRTUALENV_ACTIVATOR, dict(__file__=VIRTUALENV_ACTIVATOR)) + +os.environ['MPLCONFIGDIR']='/home/branson.stephens/logs/' + +from django.core.wsgi import get_wsgi_application +application = get_wsgi_application() + -- GitLab