Unverified Commit 26f344cb by Cory Lee Committed by GitHub

Merge pull request #4182 from open-craft/jill/edxapp-mongo-replica-set

Adds mongo read preferences for use when a replica set is provided
parents 9aca429e c3fa8d5e
......@@ -37,14 +37,21 @@
your configuration to set `EDXAPP_CELERY_BROKER_TRANSPORT` explicitly.
- Role: edxapp
- Added `EDXAPP_LMS_SPLIT_DOC_STORE_READ_PREFERENCE` with a default value of
SECONDARY_PREFERED to distribute read workload across the replica set.
- Changed `EDXAPP_MONGO_HOSTS` to be a comma seperated string, which is
required by pymongo.MongoReplicaSetClient for multiple hosts instead of an
array.
- Added `EDXAPP_MONGO_REPLICA_SET`, which is required to use
pymongo.MongoReplicaSetClient in PyMongo 2.9.1, whis is required to use the
read_preference setting. This should be set to the name of your replica set.
pymongo.MongoReplicaSetClient in PyMongo 2.9.1. This should be set to the
name of your replica set.
This setting causes the `EDXAPP_*_READ_PREFERENCE` settings below to be used.
- Added `EDXAPP_MONGO_CMS_READ_PREFERENCE` with a default value of `PRIMARY`.
- Added `EDXAPP_MONGO_LMS_READ_PREFERENCE` with a default value of
`SECONDARY_PREFERED` to distribute the read workload across the replica set
for replicated docstores and contentstores.
- Added `EDXAPP_LMS_SPLIT_DOC_STORE_READ_PREFERENCE` with a default value of
`EDXAPP_MONGO_LMS_READ_PREFERENCE`.
- Added `EDXAPP_LMS_DRAFT_DOC_STORE_CONFIG` with a default value of
`EDXAPP_MONGO_CMS_READ_PREFERENCE`, to enforce consistency between
Studio and the LMS Preview modes.
- Removed `EDXAPP_CONTENTSTORE_ADDITIONAL_OPTS`, since there is no notion of
common options to the content store anymore.
- Role: nginx
- Modified `lms.j2` , `cms.j2` , `credentials.j2` , `edx_notes_api.j2` and `insights.j2` to enable HTTP Strict Transport Security
......
......@@ -65,8 +65,7 @@ EDXAPP_XQUEUE_DJANGO_AUTH:
password: 'password'
EDXAPP_XQUEUE_URL: 'http://localhost:18040'
# EDXAPP_MONGO_HOSTS must be a comma seperated list of hosts/ips for
# compatibility with pymongo.MongoReplicaSetClient in PyMongo 2.9.1
# Comma-separated list of hosts/ips
EDXAPP_MONGO_HOSTS: 'localhost'
EDXAPP_MONGO_PASSWORD: 'password'
EDXAPP_MONGO_PORT: 27017
......@@ -74,7 +73,14 @@ EDXAPP_MONGO_USER: 'edxapp'
EDXAPP_MONGO_DB_NAME: 'edxapp'
EDXAPP_MONGO_USE_SSL: False
EDXAPP_MONGO_REPLICA_SET: ''
EDXAPP_LMS_SPLIT_DOC_STORE_READ_PREFERENCE: 'SECONDARY_PREFERRED'
# Used only if EDXAPP_MONGO_REPLICA_SET is provided.
EDXAPP_MONGO_CMS_READ_PREFERENCE: 'PRIMARY'
EDXAPP_MONGO_LMS_READ_PREFERENCE: 'SECONDARY_PREFERRED'
# We use the CMS read_preference here because the draft docstore's view of
# the modulestore should mirror Studio's, so that instructors can check their
# changes in Preview mode.
EDXAPP_LMS_DRAFT_DOC_STORE_READ_PREFERENCE: '{{ EDXAPP_MONGO_CMS_READ_PREFERENCE }}'
EDXAPP_LMS_SPLIT_DOC_STORE_READ_PREFERENCE: '{{ EDXAPP_MONGO_LMS_READ_PREFERENCE }}'
EDXAPP_MYSQL_DB_NAME: 'edxapp'
EDXAPP_MYSQL_USER: 'edxapp001'
......@@ -855,9 +861,24 @@ edxapp_environment_extra: {}
edxapp_environment: "{{ edxapp_environment_default | combine(edxapp_environment_extra) }}"
edxapp_generic_contentstore_config: &edxapp_generic_default_contentstore
ENGINE: 'xmodule.contentstore.mongo.MongoContentStore'
#
# connection strings are duplicated temporarily for
# backward compatibility
#
OPTIONS:
db: "{{ EDXAPP_MONGO_DB_NAME }}"
host: "{{ EDXAPP_MONGO_HOSTS }}"
password: "{{ EDXAPP_MONGO_PASSWORD }}"
port: "{{ EDXAPP_MONGO_PORT }}"
user: "{{ EDXAPP_MONGO_USER }}"
ssl: "{{ EDXAPP_MONGO_USE_SSL }}"
edxapp_generic_doc_store_config: &edxapp_generic_default_docstore
db: "{{ EDXAPP_MONGO_DB_NAME }}"
host: "{{ EDXAPP_MONGO_HOSTS }}"
replicaSet: "{{ EDXAPP_MONGO_REPLICA_SET }}"
password: "{{ EDXAPP_MONGO_PASSWORD }}"
port: "{{ EDXAPP_MONGO_PORT }}"
user: "{{ EDXAPP_MONGO_USER }}"
......@@ -868,17 +889,17 @@ edxapp_generic_doc_store_config: &edxapp_generic_default_docstore
connectTimeoutMS: 2000 # default is 20000, I believe raises pymongo.errors.ConnectionFailure
# Not setting waitQueueTimeoutMS and waitQueueMultiple since pymongo defaults to nobody being allowed to wait
EDXAPP_LMS_DRAFT_DOC_STORE_CONFIG:
<<: *edxapp_generic_default_docstore
read_preference: "{{ EDXAPP_LMS_DRAFT_DOC_STORE_READ_PREFERENCE }}"
EDXAPP_LMS_SPLIT_DOC_STORE_CONFIG:
<<: *edxapp_generic_default_docstore
replicaSet: "{{ EDXAPP_MONGO_REPLICA_SET }}"
read_preference: "{{ EDXAPP_LMS_SPLIT_DOC_STORE_READ_PREFERENCE }}"
EDXAPP_CMS_DOC_STORE_CONFIG:
<<: *edxapp_generic_default_docstore
read_preference: "{{ EDXAPP_MONGO_CMS_READ_PREFERENCE }}"
edxapp_databases:
# edxapp's edxapp-migrate scripts and the edxapp_migrate play
......@@ -933,26 +954,10 @@ edxapp_generic_auth_config: &edxapp_generic_auth
SWIFT_TEMP_URL_KEY: "{{ EDXAPP_SWIFT_TEMP_URL_KEY }}"
SWIFT_TEMP_URL_DURATION: "{{ EDXAPP_SWIFT_TEMP_URL_DURATION }}"
SECRET_KEY: "{{ EDXAPP_EDXAPP_SECRET_KEY }}"
DOC_STORE_CONFIG: "{{ edxapp_generic_doc_store_config }}"
XQUEUE_INTERFACE:
basic_auth: "{{ EDXAPP_XQUEUE_BASIC_AUTH }}"
django_auth: "{{ EDXAPP_XQUEUE_DJANGO_AUTH }}"
url: "{{ EDXAPP_XQUEUE_URL }}"
CONTENTSTORE:
ENGINE: 'xmodule.contentstore.mongo.MongoContentStore'
#
# connection strings are duplicated temporarily for
# backward compatibility
#
OPTIONS:
db: "{{ EDXAPP_MONGO_DB_NAME }}"
host: "{{ EDXAPP_MONGO_HOSTS }}"
password: "{{ EDXAPP_MONGO_PASSWORD }}"
port: "{{ EDXAPP_MONGO_PORT }}"
user: "{{ EDXAPP_MONGO_USER }}"
ssl: "{{ EDXAPP_MONGO_USE_SSL }}"
ADDITIONAL_OPTIONS: "{{ EDXAPP_CONTENTSTORE_ADDITIONAL_OPTS }}"
DOC_STORE_CONFIG: *edxapp_generic_default_docstore
DATABASES: "{{ edxapp_databases }}"
EMAIL_HOST_USER: "{{ EDXAPP_EMAIL_HOST_USER }}"
EMAIL_HOST_PASSWORD: "{{ EDXAPP_EMAIL_HOST_PASSWORD }}"
......@@ -1172,6 +1177,11 @@ generic_env_config: &edxapp_generic_env
lms_auth_config:
<<: *edxapp_generic_auth
CONTENTSTORE:
<<: *edxapp_generic_default_contentstore
ADDITIONAL_OPTIONS: "{{ EDXAPP_CONTENTSTORE_ADDITIONAL_OPTS }}"
DOC_STORE_CONFIG: "{{ EDXAPP_LMS_SPLIT_DOC_STORE_CONFIG }}"
DOC_STORE_CONFIG: "{{ EDXAPP_LMS_SPLIT_DOC_STORE_CONFIG }}"
SEGMENT_KEY: "{{ EDXAPP_LMS_SEGMENT_KEY }}"
OPTIMIZELY_PROJECT_ID: "{{ EDXAPP_OPTIMIZELY_PROJECT_ID }}"
EDX_API_KEY: "{{ EDXAPP_EDX_API_KEY }}"
......@@ -1264,7 +1274,11 @@ lms_env_config:
cms_auth_config:
<<: *edxapp_generic_auth
SEGMENT_KEY: "{{ EDXAPP_CMS_SEGMENT_KEY }}"
CONTENTSTORE:
<<: *edxapp_generic_default_contentstore
ADDITIONAL_OPTIONS: "{{ EDXAPP_CONTENTSTORE_ADDITIONAL_OPTS }}"
DOC_STORE_CONFIG: "{{ EDXAPP_CMS_DOC_STORE_CONFIG }}"
DOC_STORE_CONFIG: "{{ EDXAPP_CMS_DOC_STORE_CONFIG }}"
MODULESTORE:
default:
ENGINE: 'xmodule.modulestore.mixed.MixedModuleStore'
......@@ -1285,6 +1299,7 @@ cms_auth_config:
default_class: 'xmodule.hidden_module.HiddenDescriptor'
fs_root: "{{ edxapp_course_data_dir }}"
render_template: 'edxmako.shortcuts.render_to_string'
SEGMENT_KEY: "{{ EDXAPP_CMS_SEGMENT_KEY }}"
PARSE_KEYS: "{{ EDXAPP_PARSE_KEYS }}"
cms_env_config:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment