/
plugin.py
172 lines (157 loc) · 4.7 KB
/
plugin.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
import os
from tutor import hooks
from tutormfe.hooks import MFE_APPS
# default mounts -- janky experiment w/ binding at build time
# hooks.Filters.IMAGES_BUILD_MOUNTS.add_item(
# ("openedx-dev", "test"),
# # ("openedx-dev", "test=/Users/zhancock/workspace/src/xblock-lti-consumer"),
# # "/Users/zhancock/workspace/src/xblock-lti-consumer"
# )
@hooks.Filters.IMAGES_BUILD_MOUNTS.add()
def _mount_libs(mounts, host_path):
path_basename = os.path.basename(host_path)
if path_basename == "src":
mounts.append(("openedx-dev", "mounted-packages"))
return mounts
@hooks.Filters.COMPOSE_MOUNTS.add()
def _mount_libs(mounts, path_basename):
if path_basename == "src":
mounts.append(("openedx-dev", "/openedx/mounted-packages"))
return mounts
# Expose redis and mysql port
hooks.Filters.ENV_PATCHES.add_item(
(
"local-docker-compose-dev-services",
"""
mysql:
ports:
- "3306:3306"
redis:
ports:
- "6379:6379"
""",
)
)
hooks.Filters.ENV_PATCHES.add_item(
(
"openedx-development-settings",
"""
EVENT_BUS_CONSUMER="edx_event_bus_kafka.KafkaEventConsumer"
EVENT_BUS_PRODUCER="edx_event_bus_kafka.create_producer"
EVENT_BUS_KAFKA_BOOTSTRAP_SERVERS="kafka.local.edly.io:29092"
EVENT_BUS_KAFKA_SCHEMA_REGISTRY_URL="http://schema-registry.local.edly.io:8081"
LEARNING_MICROFRONTEND_URL="http://apps.local.edly.io:2000"
COURSE_AUTHORING_MICROFRONTEND_URL="http://apps.local.edly.io:2001"
EXAMS_DASHBOARD_MICROFRONTEND_URL="https://apps.local.edly.io:2020"
CORS_ORIGIN_ALLOW_ALL=True
LTI_NRPS_DISALLOW_PII=True
LTI_BASE="http://{{ LMS_HOST }}"
LTI_API_BASE="http://xxxxx.ngrok-free.app"
JS_ENV_EXTRA_CONFIG={
"TEST_THE_THANG": "test",
}
course_access_role_added_event_setting = EVENT_BUS_PRODUCER_CONFIG[
'org.openedx.learning.user.course_access_role.added.v1'
]
course_access_role_added_event_setting['learning-course-access-role-lifecycle']['enabled'] = True
course_access_role_removed_event_setting = EVENT_BUS_PRODUCER_CONFIG[
'org.openedx.learning.user.course_access_role.removed.v1'
]
course_access_role_removed_event_setting['learning-course-access-role-lifecycle']['enabled'] = True
""",
)
)
hooks.Filters.ENV_PATCHES.add_item(
(
"exams-development-settings",
"""
EVENT_BUS_CONSUMER="edx_event_bus_kafka.KafkaEventConsumer"
EVENT_BUS_KAFKA_BOOTSTRAP_SERVERS="kafka.local.edly.io:29092"
EVENT_BUS_KAFKA_SCHEMA_REGISTRY_URL="http://schema-registry.local.edly.io:8081"
LTI_BASE="http://{{ EXAMS_HOST }}"
LTI_API_BASE="http://xxxxx.ngrok-free.app"
CORS_ORIGIN_ALLOW_ALL=True
CACHES = {
"default": {
"KEY_PREFIX": "default",
"VERSION": "1",
"BACKEND": "django_redis.cache.RedisCache",
"LOCATION": "redis://{% if REDIS_USERNAME and REDIS_PASSWORD %}{{ REDIS_USERNAME }}:{{ REDIS_PASSWORD }}{% endif %}@{{ REDIS_HOST }}:{{ REDIS_PORT }}/{{ OPENEDX_CACHE_REDIS_DB }}",
},
}
"""
)
)
hooks.Filters.ENV_PATCHES.add_item(
(
"openedx-common-settings",
"""
FEATURES['ENABLE_SPECIAL_EXAMS'] = True
FEATURES['ENABLE_PROCTORED_EXAMS'] = True
PROCTORING_SETTINGS = {
'MUST_BE_VERIFIED_TRACK': False
}
PROCTORING_BACKENDS = {
'DEFAULT': 'mockprock',
'null': {},
'proctortrack': {},
'mockprock': {
'client_id': 'abcd',
'client_secret': 'abcdsecret',
},
'blockprock': {
'client_id': 'abcd',
'client_secret': 'abcdsecret',
},
}
""",
)
)
hooks.Filters.ENV_PATCHES.add_item(
(
"mfe-lms-common-settings",
"""
MFE_CONFIG["EXAMS_BASE_URL"] = "http://exams.local.edly.io:8740"
"""
),
)
# Adds new MFEs I care about, removes the ones I don't
@MFE_APPS.add()
def _add_my_mfe(mfes):
mfes["exams-dashboard"] = {
"repository": "https://github.com/edx/frontend-app-exams-dashboard",
"port": 2020,
"version": "main",
}
mfes["course-authoring"] = {
"repository": "https://github.com/openedx/frontend-app-course-authoring",
"port": 2001,
"version": "master",
}
return mfes
@MFE_APPS.add()
def _remove_some_my_mfe(mfes):
mfes.pop("account")
mfes.pop("communications")
mfes.pop("discussions")
mfes.pop("gradebook")
mfes.pop("ora-grading")
mfes.pop("profile")
return mfes
# custom webpack for learner dash
# jank just to get this working for now
# hooks.Filters.ENV_PATCHES.add_item(
# (
# "mfe-webpack-dev-config",
# """
# const path = require('path');
# const config = module.exports
# config.resolve.modules = [
# path.resolve(__dirname, './src'),
# 'node_modules',
# ];
# config.module.rules[0].exclude = /node_modules\/(?!(query-string|split-on-first|strict-uri-encode|@edx))/;
# module.exports = config;
# """
# )
# )