From 2eb73cb5bd5babcaf7f86c1c0438e8bdb6d4433c Mon Sep 17 00:00:00 2001 From: Paul Van Eck Date: Mon, 12 Oct 2015 12:47:45 -0700 Subject: [PATCH] Change beaker session backend to database A memory backend isn't as suitable for production. Switching the backend to database to see if we can resolve from session issues we are having on refstack.openstack.org. This will also allow sessions to persist across apache restarts. Change-Id: Iaf98d1f50adc5667a8e3a878b9c91fc9d65eb419 --- refstack/api/app.py | 3 ++- refstack/tests/unit/test_app.py | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/refstack/api/app.py b/refstack/api/app.py index a0a3c111..62d25e6c 100644 --- a/refstack/api/app.py +++ b/refstack/api/app.py @@ -213,7 +213,8 @@ def setup_app(config): beaker_conf = { 'session.key': 'refstack', - 'session.type': 'memory', + 'session.type': 'ext:database', + 'session.url': CONF.database.connection, 'session.timeout': 604800, 'session.validate_key': api_utils.get_token(), } diff --git a/refstack/tests/unit/test_app.py b/refstack/tests/unit/test_app.py index a0953f29..fee3bcdd 100644 --- a/refstack/tests/unit/test_app.py +++ b/refstack/tests/unit/test_app.py @@ -196,6 +196,9 @@ class SetupAppTestCase(base.BaseTestCase): self.CONF.set_override('static_root', 'fake_static_root', 'api') + self.CONF.set_override('connection', + 'fake_connection', + 'database') os_join.return_value = 'fake_project_root' @@ -222,7 +225,8 @@ class SetupAppTestCase(base.BaseTestCase): session_middleware.assert_called_once_with( 'fake_app', {'session.key': 'refstack', - 'session.type': 'memory', + 'session.type': 'ext:database', + 'session.url': 'fake_connection', 'session.timeout': 604800, 'session.validate_key': get_token.return_value} )