Commit Graph

142 Commits

Author SHA1 Message Date
Navin Karkera
5ed5cc5bc1 feat: put sending xblock events over bus behind feature flag (#31813) 2023-02-22 11:03:24 -05:00
0x29a
dd9f6936bc refactor: xmodule/video_module -> xmodule/video_block 2022-12-19 17:48:49 +01:00
Tim McCormack
279e4d0b67 feat: Use new configurable producer API for event bus (#31356)
This involves a breaking-change update to edx-event-bus-kafka 2.0.0.
2022-11-28 18:41:35 +00:00
Jeff Cohen
f03b141f05 fix: do not clear request cache when running eager Celery tasks (#31261)
Clearing the RequestCache was intended to address memory leaks in the
celery workers. Celery worker processes will process many tasks before
they are terminated. RequestCache cleanup typically happens in the
RequestCacheMiddleware class, and middleware never executes for celery.
To get around that issue, the CLEAR_REQUEST_CACHE_ON_TASK_COMPLETION
setting was created to clear the RequestCache after every task was
successfully completed.

This works fine when celery is running as a separate process, as it's
set up to do in production. But during development, the
CELERY_ALWAYS_EAGER setting variable is set to True, meaning that
celery tasks are run in the same thread as the Django Request. This is
meant to make debugging easier, as task failures run as part of the
request cycle and will raise exceptions that are visible to the
browser.

However, celery tasks are triggered from many different actions. That
means that the RequestCache was being cleared many times during the
course of processing a request. This led to behavior that was
potentially slower, but also incorrect–the RequestCache was getting
flushed in a way that wouldn't happen in any deployed environment
because celery would be running in separate processes there. This came
up when trying to fix an issue around extra history records being
created during problem submissions:

  https://discuss.openedx.org/t/extra-history-record-stored-on-each-problem-submission/8081

Furthermore, it's not necessary to prevent RequestCache memory leaks
when running in CELERY_AWLAYS_EAGER mode in development because the
middleware cleanup happens automatically–as everything is running as
part of the request/response cycle.

There are times in which we may want to run celery eagerly and still
clear the cache, such as testing. I have set
CLEAR_REQUEST_CACHE_ON_TASK_COMPLETION = False in all dev and test
environments that already have CELERY_ALWAYS_EAGER = True. The unit
test that specifically tests whether the request cache is getting
cleared upon completion of a celery task then overrides
CLEAR_REQUEST_CACHE_ON_TASK_COMPLETION = True even though
CELERY_ALWAYS_EAGER = True for the sake of that specific testing
purpose.
2022-11-07 11:48:39 -05:00
Tim McCormack
f6965b9555 chore: Unpin edx-event-bus-kafka and upgrade (#30966)
The producer API is stable enough now.

Make use of new topic prefixing feature for devstack (introduced in 0.6.2)
2022-09-19 19:43:34 +00:00
Rebecca Graber
c1009b56f6 feat: emit COURSE_CATALOG_INFO_CHANGED signal on publish (#30805)
Implements https://github.com/openedx/edx-platform/issues/30682

Produce signal only once transaction for a course publish is
committed, and only for actual courses (not libraries).

- Use newer openedx-events version that has a fix for None datetime
  and that has CourseCatalogData without org, number.
- Add edx-event-bus-kafka -- specify recent version that drops
  confluent-kafka from explicit deps, fixes common auth settings, and has
  a multi-producer caching tweak.
- New functionality is behind toggle

As per https://github.com/openedx/openedx-events/issues/88 we're going to
try explicit dependencies on implementations for now, rather than solve
all the problems we'd encounter by using private dependencies.

Co-authored-by: Tim McCormack <tmccormack@edx.org>
Co-authored-by: Rebecca Graber <rgraber@edx.org>
2022-08-24 16:39:24 +00:00
Justin Hynes
45d7182d12 fix: Override Credentials service URLs in Studio devstack.py files
In the `cms/envs/common.py` file the `CREDENTIALS_INTERNAL_SERVICE_URL` and `CREDENTIALS_PUBLIC_SERVICE_URL` settings are set to
`http://localhost:8005` which is incorrect for devstack. In devstack the Credentials IDA runs on port `18150`. This causes
issues with Studio being able to communicate with the Credentials IDA.

I've overriden the service URL settings in devstack.py to point to the correct port.
2022-08-12 14:18:07 +00:00
Justin Hynes
26ae8b4bcd feat: add management command to clean stale certificate availability dates
[MICROBA-1806]

We are aware of product issue where it is possible for a self-paced course-run to get have a `certificate_availability_date` created in the course settings. This can have an adverse effect on the Credentials IDA where a learner's Program Record does not correctly display the course certificates they have earned because of this data. This not only causes confusion for our learners, as it appears that a course certificate a learner can access and share in the LMS is displayed as unearned in the Credential's program record, but this can also cause issues when a learner attempts to share their program record through a credit pathway and the program record would not accurately reflect their program completion.

Unfortunately, the settings that manage the certificate availability date are hidden for self-paced courses in Studio (as they should only be used in instructor-paced courses).

For this reason, we are introducing a management command that will remove a certificate available date for a specified (self-paced) course-run. This will allow us to fix issues for individual learners while we work on a longer-term fix for the larger issue.

* Add new `clean_stale_certificate_available_dates` management command
* Add new `CleanStaleCertificateAvailabilityDates` Configuration Model
* Add tests for the new management command
* (Unrelated cleanup) Fix potential issue with private.py settings in the CMS being overwritten in devstack.py for developers using devstack.
2022-07-11 13:13:27 -04:00
Mohammad Ahtasham ul Hassan
8ef261fe07 Remove Old Pymongo pin (#30569)
* chore: unpin pymongo
2022-06-27 14:37:29 +05:00
Eugene Dyudyunov
f262d64ad4 FC-0001: enterprise dependencies for EdxRestAPIClient replacement (#30240)
* refactor: enterprise dependencies for EdxRestAPIClient replacement

This is a part of https://github.com/openedx/public-engineering/issues/42

- add settings for enterprise-backend-service DOT application
- update utils used by enterprise to get rid of EdxRestAPIClient
- original utils stays in the code (to keep edx-platform api
clients working) till the
https://github.com/openedx/public-engineering/issues/39 deprecation
work will be done

* fix: fix typo in the docstring
2022-04-21 15:28:22 -04:00
Tim McCormack
a251d18281 feat!: Use more-trusted IP in rate-limiting (#241)
Previously, our rate-limiting code trusted the entire `X-Forwarded-For`
header, allowing a malicious client to spoof that header and evade
rate-limiting. This commit introduces a new module and setting
allowing us to make a more conservative choice of IPs.

- Create new `openedx.core.djangoapps.util.ip` module for producing
  the IP "external chain" for requests based on the XFF header and the
  REMOTE_ADDR.
- Include a function that gives the safest choice of IPs.
- Add new setting `CLOSEST_CLIENT_IP_FROM_HEADERS` for configuring how
  the external chain is derived (i.e. setting the trust
  boundary). Currently has a default, but we may want to make it
  mandatory in the future.
- Change `django-ratelimit` code to use the proximate IP in the external
  chain -- the one just outside the trust boundary.

Also:

- Change `XForwardedForMiddleware` to use more conservative choice for
  its `REMOTE_ADDR` override
- Other adjustments to `XForwardedForMiddleware` as needed in order to
  initialize new module and support code that needs the real
  `REMOTE_ADDR` value
- Metrics for observability into the change (and XFF composition)
- Feature switch to restore legacy mode if needed

This also gives us a path forward to removing use of the django-ipware
package, which is no longer maintained and has a handful of bugs that make it
difficult to use safely.

Internal ticket: ARCHBOM-2056
2022-04-20 13:46:58 +00:00
Kyle McCormick
1bf8af5f72 feat: specify dump_to_neo4j defaults in COURSEGRAPH_CONNECTION
Introduce a new CMS settings COURSEGRAPH_CONNECTION,
which allows operators to specify default connection paramters
for a Neo4j instance.

This has three purposes:
* The `./manage.py cms dump_to_neo4j` management command will be
  much easier for developers and operators to type out because connection
  arguments can now be omitted. Note that connection arguments, if
  supplied, will override the arguments specified in CMS settings.
* The automatic push-to-coursegraph-on-publish-signal introduced in
  subsequent commits can use these connection settings.
* The CourseGraph Django admin actions introduced in subsequent
  commits can use these connection settings.
2022-03-29 11:21:20 -04:00
Awais Ansari
5a4cbc56ae feat: link discussions feedback URL with feedback button (#29919)
* feat: link discussions feedback URL with feedback button
2022-02-15 17:28:03 +05:00
Kshitij Sobti
c8bd924e23 feat: Add support for using the discussions MFE UI instead of existing UI [BD-38] [TNL-9228] (#29285)
* feat: Add support for using the discussions MFE UI instead of existing UI

Adds a new course waffle flag that when set along with the discussions MFE URL shows the discussions MFE UI instead of the regular UI.

* test: add tests

* squash!: more consistent url name
2021-11-23 14:56:25 +05:00
Tim McCormack
dbb473f490 refactor: Studio OAuth cleanup, part 1 (#28760)
- Update migration instructions
    - Changes regarding redirect URLs and cookie domain are to permit the
      site to run on multiple domains.
- Set LOGIN_URL in common so that it can be unset in environment overrides

This bypasses the "redirect to LMS" login/signup code, but does not yet
remove it; removal is covered by DEPR-166 so that this remains a
configuration-only change for now.

There should have no user-visible effect.

ref: ARCHBOM-1890
2021-09-16 16:16:45 +00:00
Tim McCormack
0c164ad4c2 fix: Fix Studio logout by pointing to correct logout view (#28714)
This changes the "Sign out" link on Studio to point to Studio's own logout
view, which clears the session and then redirects to LMS's logout page. The
LMS logout page then skips loading the Studio logout because it is seen in
the Referer header.

This change also brings Studio better into line with how other IDAs perform
their logouts.

Background:

After the rollout of Studio OAuth, logouts initiated on Studio failed to
actually log out Studio (but all other IDAs were logged out). This was
because the LMS logout view loads the logout pages of other IDAs but skips
any that is a *prefix* match on the Referer header, and browsers now often
send a truncated version of the Referer for privacy. Therefore, Studio was
always skipped when coming from Studio.

The fix is to make sure that Studio has already performed its logout by the
time the LMS logout page is loaded.

One wrinkle here is that the LMS logout view is activated by `/logout`, but
the correct logout view (provided by auth_backends) is activated by
`/logout/` -- with a trailing slash. This is fragile and unfortunate, but
can be cleaned up when we later remove other leftovers of Studio's previous
ability to handle logistration.

ref: ARCHBOM-1897
2021-09-10 18:45:58 +00:00
Tim McCormack
90b48d68b6 feat: Activate Studio SSO for devstack (#28534)
This also requires using different session cookie names in devstack for
LMS and Studio so that we can properly use the OAuth flow locally, rather
than just sharing a session cookie on the localhost domain. (Note that
ports are not used for cookie segmentation in browsers.)

This depends on the following provisioning PR:
https://github.com/edx/devstack/pull/825
2021-08-25 20:37:05 +00:00
Sofia Yoon
60493757e6 fix: webpack loader config to display error 2021-07-15 17:06:01 -04:00
Awais Jibran
5078f9cc63 Update devstack.py 2021-05-26 23:44:14 +05:00
Kyle McCormick
bcb48525ac refactor: clean up unused ERROR_ON_DEPRECATED_EDX_PLATFORM_IMPORTS (#26900)
The setting overrides should've been cleaned up in a previous
commit, but I missed them. This change is a no-op.
2021-03-08 15:01:12 -05:00
M. Zulqarnain
88471575ab refactor: pyupgrade in CMS (#26723) 2021-03-02 16:45:46 +05:00
Manjinder Singh
85242014b6 fix: changed setting to fix login through studio (#26636)
Login redirect was using wrong url, thus making it impossible to login from studio. This settings change should fix that.

Useful information to include:

Which edX user roles will this change impact? "Developer"
Supporting information
https://openedx.atlassian.net/browse/ARCHBOM-1687

Testing instructions
Bring up devstack studio and press sign in. If it redirects you correctly to lms login page, this works!
2021-02-19 14:33:43 -05:00
Tim McCormack
b8a6e30bd9 fix: Add new proctoring key to Studio devstack & tests envs (copy from LMS) (#26430)
Turns out it's needed for the Proctoring Settings view.

Also reorder slightly for better clustering.

MST-644
2021-02-08 15:43:51 +00:00
usamasadiq
8556d670a2 Applied pylint-amnesty 2021-02-02 15:29:41 +05:00
Kyle McCormick
44d5060c60 Add setting for error'ing on deprecated imports
Deprecated edx-platform import paths
(for example, `student` instead of
`common.djangoapps.student`) currently raise
warnings when used. We want to fully remove
support for those paths.

As an easily reversible way to initially remove
support, we add a new setting to LMS and Studio
called `ERROR_ON_DEPRECATED_EDX_PLATFORM_IMPORTS`,
defaulting to False. We set it to True for devstack
and will set it to True in Stage and Production
soon. If critical errors occur, we can easily
flip the setting back to False.
2021-01-21 10:49:47 -05:00
David Ormsbee
5a149f0fe3 Enable timed/special exams and pre-reqs in devstack.
These are common and useful enough features that it makes sense to
enable it for developers by default.
2021-01-12 11:30:58 -05:00
Feanil Patel
cdbbe077c2 Enable keeping some request history.
This makes it easire to debug things like POST requests that would
otherwise not be easily debugged during development.
2020-12-09 16:47:23 -05:00
Kyle McCormick
4dda73d797 [BD-14] Migrate all environments to use database-backed organizations (#25153)
* Install `organizations` app into LMS and Studio non-optionally.
* Add toggle `ORGANIZATIONS_AUTOCREATE` to Studio.
* Remove the `FEATURES["ORGANIZATIONS_APP"]` toggle.
* Use the new `organizations.api.ensure_organization` function to
  either validate or get-or-create organizations, depending
  on the value of `ORGANIZATIONS_AUTOCREATE`,
  when creating course runs and V2 content libraries.
  We'll soon use it for V1 content libraries as well.
* Remove the `util.organizations_helpers` wrapper layer
  that had to exist because `organizations` was an optional app.
* Add `.get_library_keys()` method to the Split modulestore.
* Add Studio management command for backfilling organizations tables
  (`backfill_orgs_and_org_courses`).

For full details, see
https://github.com/edx/edx-organizations/blob/master/docs/decisions/0001-phase-in-db-backed-organizations-to-all.rst

TNL-7646
2020-12-02 13:58:40 -05:00
Kyle McCormick
151bd13666 Use full names for common.djangoapps imports; warn when using old style (#25477)
* Generate common/djangoapps import shims for LMS
* Generate common/djangoapps import shims for Studio
* Stop appending project root to sys.path
* Stop appending common/djangoapps to sys.path
* Import from common.djangoapps.course_action_state instead of course_action_state
* Import from common.djangoapps.course_modes instead of course_modes
* Import from common.djangoapps.database_fixups instead of database_fixups
* Import from common.djangoapps.edxmako instead of edxmako
* Import from common.djangoapps.entitlements instead of entitlements
* Import from common.djangoapps.pipline_mako instead of pipeline_mako
* Import from common.djangoapps.static_replace instead of static_replace
* Import from common.djangoapps.student instead of student
* Import from common.djangoapps.terrain instead of terrain
* Import from common.djangoapps.third_party_auth instead of third_party_auth
* Import from common.djangoapps.track instead of track
* Import from common.djangoapps.util instead of util
* Import from common.djangoapps.xblock_django instead of xblock_django
* Add empty common/djangoapps/__init__.py to fix pytest collection
* Fix pylint formatting violations
* Exclude import_shims/ directory tree from linting
2020-11-10 07:02:01 -05:00
Kyle McCormick
ad1a167432 Devstack: Revert back to not validating orgs of new courses (#25301)
This change was originally made in preparation for a BD-14
change that would enable database-backed organizations
across Open edX. Since then, we've figured out a way
of rolling out database-backed organizations without
mandating that organization slugs in new courses are
validated. So, this puts devstack back to where it was before,
with ORGANIZATIONS_APP==True for LMS on devstack and
ORGANIZATIONS_APP==False for Studio on devstack.

From a developer perspective, this means that course
runs can again be created in Studio with any org slug.

TNL-7425
2020-10-08 13:15:38 -04:00
Sid Verma
8d33a5a3e1 Add indexing support for blockstore content libraries 2020-08-24 10:45:01 -04:00
Kyle McCormick
926a40def0 Enable ORGANIZATIONS_APP for devstack Studio (#24820)
It is already enabled in devstack LMS, stage LMS/Studio,
and prod LMS/Studio.

However, it is currently disabled in edge LMS/Studio,
and as far as I know, sandbox LMS/Studio as well as the
default Open edX LMS/Studio.

We would like to move towards enabling it globally by
default, and enabling it in devstack Studio would be
a first step towards that.
2020-08-20 12:19:39 -04:00
Manjinder Singh
c76ed6ae45 Extracting plugin app from edx-platform (#24678)
* Moving plugins infrastructure to edx-django-utils
This PR extracts the code that enables plugins in edx-platform and puts it in edx-django-utils. This is done to allow other IDAS to add plugin functionality.
2020-08-12 07:48:53 -04:00
Zia Fazal
601dc79ded Merge pull request #24743 from edx/ziafazal/e2e-tests-devstack
[BD-18] Disable django debug toolbar when running e2e tests
2020-08-12 09:51:47 +05:00
Adolfo R. Brandes
455dd9db4c New library authoring MFE toggle 2020-08-07 09:22:01 -04:00
zia.fazal@arbisoft.com
03d788e1c3 Changes to run e2e test on devstack 2020-08-07 09:55:47 +05:00
Simon Chen
198c4ad9a0 MST-331 Add cors header configs to CMS so it can be turned on (#24571)
* MST-331 Add cors header configs to CMS so it can be turned on

* feedback
2020-07-24 08:09:41 -04:00
Albert (AJ) St. Aubin
aeef139843 Config changes to get the JWT token working with MFEs again 2020-04-21 20:20:36 -04:00
danialmalik
164c165e1a Merge all configs of devstack_docker.py into devstack.py 2020-04-10 11:36:17 +05:00
Danial Malik
8d951ae8ae Import private.py in devstack_docker.py files instead of devstack.py (#23512)
Background: I use private.py a lot in my devstack for my private configurations. But issues are raised when I need to change/override a setting that is defined in devstack_docker.py file. Since that file's contents are loaded after private.py, my private.py is useless against the settings in devstack_docker.py.

Description: Now that the devstack is dockerized, I think it makes more sense to import the private.py in the devstack_docker.py files i.e. at the end of configuration files hierarchy.
2020-03-30 09:38:25 -04:00
Manjinder Singh
7d2ff9cd3f Removing all settings that have OIDC in name (#23251)
* Removing all settings that have OIDC in name

* Removing ENABLE_DOP_ADAPTER

* changes JWT_ISSUER value in devstack
2020-03-04 09:06:29 -05:00
jinder1s
295da79fe5 Remove DOP dispatching from oauth_dispatch.
https://openedx.atlassian.net/browse/BOM-1330
2020-02-27 10:47:06 -05:00
Manjinder Singh
e9e584b28b Removing DOP from auth_exchange (#23187)
-  This PR removes all imports from provider by either bringing them into edx-platform or finding dot replacement. Removing tests that tested dop parts of code. 

-  Skipping some tests and removing dop

The tests are difficult to fix due to its entanglement with dop use in third_party_auth.
These tests should be restarted once dop has been removed from third_party_auth and its tests.

-  set ENABLE_DOP_ADAPTER = False for devstack
2020-02-26 10:21:26 -05:00
Ayub-khan
d3a02bc3e5 BOM-1121
-Updated middleware setting to use use middleware insted of
middleware_classes
-github install of django-method-override fork to support
new style middleware in django1.11
2020-02-11 14:35:26 +05:00
Feanil Patel
6e3fe00fff Fix all E303 pep8 errors. 2019-12-30 12:25:38 -05:00
Feanil Patel
9cf2f9f298 Run 2to3 -f future . -w
This will remove imports from __future__ that are no longer needed.

https://docs.python.org/3.5/library/2to3.html#2to3fixer-future
2019-12-30 10:35:30 -05:00
Nicholas D'Alfonso
545d5eddc8 DISCO-188 publisher link
Add publisher link to settings dropdown if the features setting
is set.
2019-10-11 09:29:24 -04:00
Ned Batchelder
d585a8f71d URLs and settings for OpenAPI generation
API docs are now always available, no more toggle to enable them.
2019-09-17 16:54:27 -04:00
Feanil Patel
dfe77a968e Remove the mongo plugin for the djnago-debug-toolbar.
We are currently running this plugin from a has directly off of master
to get support for a newer version of DJDT.  However even on master
there is not yet support for python 3.  We're running into this when
running runserver and when collecting static assets.

A quick survey of the development team at edX shows that people are no
longer actively using this debug panel.(14 responders all saying no to
the question "In the last year have you used the mongo portion of the
django-debug-toolbar in edx-platform?")

This makes sense since the module store and courseware related
developement is not very active right now.  Given all this, I'm removing
this toolbar for now and if we need it again we can survey what's
available at that time to choose the best tool.
2019-09-12 10:18:46 -04:00
Braden MacDonald
d3f6ed09d8 Learning Contexts, New XBlock Runtime, Blockstore API Client + Content Libraries
https://github.com/edx/edx-platform/pull/20645

This introduces:
* A new XBlock runtime that can read and write XBlocks that are persisted using
  Blockstore instead of Modulestore. The new runtime is currently isolated so
  that it can be tested without risk to the current courseware/runtime.
* Content Libraries v2, which store XBlocks in Blockstore not modulestore
* An API Client for Blockstore
* "Learning Context" plugin API. A learning context is a more abstract concept
  than a course; it's a collection of XBlocks that serves some learning purpose.
2019-08-30 10:31:15 -07:00