[BD-14] Install the blockstore app into edx-platform, behind a waffle switch#29779
[BD-14] Install the blockstore app into edx-platform, behind a waffle switch#29779bszabo merged 6 commits intoopenedx:masterfrom
Conversation
|
Thanks for the pull request, @pomegranited! I've created BLENDED-1067 to keep track of it in Jira. More details are on the BD-14 project page. When this pull request is ready, tag your edX technical lead. |
189158e to
845be8c
Compare
744179f to
e1339d4
Compare
b6b6a59 to
f975e93
Compare
e378239 to
a7e0f10
Compare
af9eaad to
b100781
Compare
|
Hi @pomegranited thanks for working on this. @blarghmatey and I would really like to use this for our (first) deployment of Libraries v2 at MIT, so we're trying out your branch. Is there a way to verify that app is running successfully? Do we need the Library MFE just to test it? |
|
Hi @pdpinch ! That would be fantastic if you and @blarghmatey could help test this change.
If the app is installed and running, you'll see Blockstore in your Django Admin, with Collections and Bundles (though they'll be empty).
You'll need the Library Authoring MFE to add collections and bundles (aka Libraries), and so yes, you'll need that MFE running to fully test this branch. You'll also need to make sure you have the blockstore app configured, see:
|
|
Thanks for that input. For the MFE it's unclear beyond the feature flag how we can configure the expected domain or path to load for pointing at the deployed assets. Is that something that is managed via a Django setting or is it a value in a waffle flag or... ? We are deploying this greenfield with no prior usage of the Blockstore IDA so it seems that we can just leave the storage and database settings to the default to have it use the S3 and database connection details from edx-platform. Is that correct? |
I'm also working out the MFE deployment requirements for library-authoring. Most of the other MFEs will run successfully under a single subdomain (or docker container/port), but this MFE seems to need its own, so I'm trying this on my sandbox deployment now. See the "Ansible settings to deploy the blockstore service + MFEs" yaml underneath "MFE" for what I'm attempting with the full list of MFEs. You'll also need to set a waffle flag:
You can skip the database settings noted above, and everything under Here's the settings I think you'll need: ## MFEs
# Deploy MFEs to own subdomain
MFE_DEPLOY_STANDALONE_NGINX: true
MFES:
- name: library-authoring
repo: frontend-app-library-authoring
MFE_ENVIRONMENT_EXTRA:
LMS_BASE_URL: "https://{{ EDXAPP_LMS_BASE }}"
STUDIO_BASE_URL: "https://{{ EDXAPP_CMS_BASE }}"
BLOCKSTORE_COLLECTION_UUID: "11111111-2111-4111-8111-111111111111"
BASE_URL: "https://library-authoring.{{ EDXAPP_LMS_BASE }}"
# I have no idea why this is necessary for this MFE.
SECURE_ORIGIN_XBLOCK_BOOTSTRAP_HTML_URL: "//d26i2lpnkzmddn.cloudfront.net/xblock-bootstrap-v8.html"
# edxapp MFE Configurations
EDXAPP_SESSION_COOKIE_DOMAIN: ".{{ EDXAPP_LMS_BASE }}"
EDXAPP_CSRF_COOKIE_SECURE: true
EDXAPP_SESSION_COOKIE_SECURE: true
EDXAPP_ENABLE_CORS_HEADERS: true
EDXAPP_ENABLE_CROSS_DOMAIN_CSRF_COOKIE: true
EDXAPP_CROSS_DOMAIN_CSRF_COOKIE_DOMAIN: ".{{ EDXAPP_LMS_BASE }}"
EDXAPP_CROSS_DOMAIN_CSRF_COOKIE_NAME: "cross-domain-cookie-mfe"
EDXAPP_CORS_ORIGIN_WHITELIST:
- "https://{{ EDXAPP_CMS_BASE }}"
- "https://library-authoring.{{ EDXAPP_LMS_BASE }}" # you have to use this subdomain. I don't know why.
EDXAPP_CSRF_TRUSTED_ORIGINS:
- "{{ EDXAPP_CMS_BASE }}"
- "library-authoring.{{ EDXAPP_LMS_BASE }}"
EDXAPP_LOGIN_REDIRECT_WHITELIST:
- "{{ EDXAPP_CMS_BASE }}"
- "library-authoring.{{ EDXAPP_LMS_BASE }}"
EDXAPP_FEATURES_EXTRA:
ENABLE_CONTENT_LIBRARIES: true
ENABLE_LIBRARY_AUTHORING_MICROFRONTEND: true
## Blockstore and library authoring
EDXAPP_ENV_EXTRA:
LIBRARY_AUTHORING_MICROFRONTEND_URL : 'https://library-authoring.{{ EDXAPP_LMS_BASE }}/'
# Only need to set these if you're using different access keys for generating signed URLs
# See https://github.com/openedx/blockstore/pull/101
#BUNDLE_ASSET_URL_STORAGE_KEY: "{{ EDXAPP_AWS_ACCESS_KEY_ID }}"
#BUNDLE_ASSET_URL_STORAGE_SECRET: "{{ EDXAPP_AWS_SECRET_ACCESS_KEY }}"
BUNDLE_ASSET_STORAGE_SETTINGS:
STORAGE_KWARGS:
location: "blockstore/"
bucket_name: "{{ EDXAPP_AWS_STORAGE_BUCKET_NAME }}"
access_key: "{{ EDXAPP_AWS_ACCESS_KEY_ID }}"
secret_key: "{{ EDXAPP_AWS_SECRET_ACCESS_KEY }}"
BLOCKSTORE_API_AUTH_TOKEN: SET-ME-PLEASE
BLOCKSTORE_BUNDLE_CACHE_TIMEOUT: 60And you'll need to run the steps in this PR description, described under Settings > Manual steps run to provision the sandbox. |
|
I'm trying to test this on a Maple build of edx-platform. Do you know if that release has code in place to process the waffle flag for the library-authoring MFE? It doesn't seem to be trying to load the route that is specified in the edX configuration for |
|
Sorry @blarghmatey , I've only ever run Library Authoring on |
|
FYI @blarghmatey -- I'm still wrestling with my sandbox, but I've made a bunch of updates to the config in my previous post, see the diff for details. |
symbolist
left a comment
There was a problem hiding this comment.
@pomegranited I did some more testing with creating, editing, and viewing XBlocks and everything seems to be working. I have also tested the waffle flag. There are a few tests that are failing (noted in a comment below).
The only thing that I is left for me to test is switching back and forth between the Python API and the REST API and testing that everything continues to work. Do you have the changes required for it handy? I think we will at least need to:
- Configure edxapp to use the blockstore devstack db.
- Create a shared volume for the media files
openedx/core/djangoapps/content_libraries/tests/test_content_libraries.py
Outdated
Show resolved
Hide resolved
Yep! Those changes can be made to the |
…ring MFE When the XBlock runtime is used in Studio/authoring mode, it needs to use the template path prefix "lms." in order to locate the block templates. (In LMS view, no prefix is required.) Fixes bug introduced by openedx#29354 and removes template workaround added by openedx#29517 (see Author Notes & Concerns)
Rendering asset URLs requires HTML blocks to be associated with a course key. This change allows HTML blocks to be associated with libraries and still render without error.
0fcbfdd to
d0935d4
Compare
|
@pomegranited 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future. |
|
EdX Release Notice: This PR has been deployed to the staging environment in preparation for a release to production. |
|
EdX Release Notice: This PR has been deployed to the production environment. |
1 similar comment
|
EdX Release Notice: This PR has been deployed to the production environment. |
[BD-14] Install the blockstore app into edx-platform, behind a waffle switch (cherry picked from commit d2e82b7)
[BD-14] Install the blockstore app into edx-platform, behind a waffle switch (cherry picked from commit d2e82b7)
[BD-14] Install the blockstore app into edx-platform, behind a waffle switch (cherry picked from commit d2e82b7)
[BD-14] Install the blockstore app into edx-platform, behind a waffle switch (cherry picked from commit d2e82b7)
[BD-14] Install the blockstore app into edx-platform, behind a waffle switch (cherry picked from commit d2e82b7)
[BD-14] Install the blockstore app into edx-platform, behind a waffle switch (cherry picked from commit d2e82b7)
[BD-14] Install the blockstore app into edx-platform, behind a waffle switch (cherry picked from commit d2e82b7)
[BD-14] Install the blockstore app into edx-platform, behind a waffle switch (cherry picked from commit d2e82b7)
[BD-14] Install the blockstore app into edx-platform, behind a waffle switch (cherry picked from commit d2e82b7)
[BD-14] Install the blockstore app into edx-platform, behind a waffle switch (cherry picked from commit d2e82b7)
[BD-14] Install the blockstore app into edx-platform, behind a waffle switch (cherry picked from commit d2e82b7)
[BD-14] Install the blockstore app into edx-platform, behind a waffle switch (cherry picked from commit d2e82b7)
[BD-14] Install the blockstore app into edx-platform, behind a waffle switch (cherry picked from commit d2e82b7)
[BD-14] Install the blockstore app into edx-platform, behind a waffle switch (cherry picked from commit d2e82b7)
[BD-14] Install the blockstore app into edx-platform, behind a waffle switch (cherry picked from commit d2e82b7)
[BD-14] Install the blockstore app into edx-platform, behind a waffle switch (cherry picked from commit d2e82b7)
[BD-14] Install the blockstore app into edx-platform, behind a waffle switch (cherry picked from commit d2e82b7)
Description
Installs blockstore as an app inside of edx-platform.
blockstore.use_blockstore_app_api) to toggle between using the installed blockstore app's Python API directly, instead of the external blockstore IDA service's REST API (default), so that the app can be tested and its usage rolled back without having to deploy any code changes.This change should not impact the edX user experience.
Supporting information
ADR: Blockstore Deployment as an App, Not Service
TNL-8746, subtask of TNL-8351
OpenCraft internal ticket: FAL-2800
Depends on openedx-unsupported/blockstore#149 <-- this has been merged and tagged for use here
Testing instructions
Sandbox
Sandbox was provisioned with the Settings and Manual steps noted below.
Devstack setup
Run blockstore IDA service (see README).
Add user/password to the blockstore DB from the
mysql57-shell:Checkout the branch from [BD-14] Updates Blockstore Python API [TNL-8746] [FAL-2702] openedx-unsupported/blockstore#149 into
${DEVSTACK_WORKSPACE}/src/blockstore, and install in the LMS and Studio shells:# make lms-shell and studio-shell pip install -e /edx/src/blockstoreTo share to the Blockstore database and file storage between edxapp and the IDA, add the following to
lms/envs/private.pyandcms/envs/private.py:Run content-library-authoring MFE (see README), OR provision the LabXchange devstack.
Testing instructions
These tests should work on either the sandbox or your devstack.
Test blockstore as service (default, no switch created):
If you're using content libraries, create a new library with some blocks in it.
(If you're using LabXchange, the devstack provisioning did this for you.)
Test blockstore as app (enable switch):
blockstore.use_blockstore_app_apiIn devstack, you can restart LMS+Studio; in the sandbox, you can run
blockstore_cache.cache.clear().Test blockstore as service (disable switch):
Integration tests
Integration tests for the blockstore service aren't run as part of the CI, but can be run manually in the devstack, (see blockstore README):
blockstore-shellrunmake testserver.studio-shell, run:Deadline
None
Other information
Author Notes
This should not be an issue in production, as these URLs are absolute S3 URLs, not routed through the app or service.
Deployment configuration changes
Anyone who is running blockstore as a service and wants to preserve the service's content when switching to the blockstore app will need to:
blockstorestanza toedxapp_databasesansible configuration.Alternatively, these caches can be cleared when the service URLs are no longer desired.
Settings
Ansible settings to deploy the blockstore service + MFEs
Manual steps run to provision the sandbox
Create auth token in Blockstore, with value matching ansible
BLOCKSTORE_API_AUTH_TOKEN(ref blockstore/README):Create a "Collection" that new content libraries / xblocks can be created within. The collection UUID must match the
BLOCKSTORE_COLLECTION_UUIDconfigured on the MFE:Create an an Organization in the LMS:
In Studio Django Admin, create an enable a waffle flag named
studio.library_authoring_mfe.