-
Notifications
You must be signed in to change notification settings - Fork 3
add mitxonline networking directions #2594
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
extra_hosts: | ||
# This allows containers to access services running on a host linux machine | ||
# Unnecessary but harmless for mac/windows users | ||
- "host.docker.internal:host-gateway" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lacking a linux machine, i have not actually tested that this enables it, but Copilot and SO https://stackoverflow.com/questions/70725881/what-is-the-equivalent-of-add-host-host-docker-internalhost-gateway-in-a-comp suggest it should
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may want to hold off for another, more experienced review, but these instructions are pretty much bang on what I ended up figuring out when I set it up on my own. Thanks for the writeup!
The goal of this is to allow MITx Online and Learn to be set up so that MITx Online can have some data in it, and Learn can pull that data out for its needs, right? This seems OK for that purpose. |
|
||
### Connecting with MITxOnline | ||
|
||
Set up the [mitxonline](https://github.com/mitodl/mitxonline) as indicated there. _Note: A working OpenEdx installation is not necessary for integration with Learn._ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe place this sentence after setting the env variables below in MIT-Learn and MITx Online, and starting up both.
Also, OPENEDX_API_CLIENT_ID
and OPENEDX_API_CLIENT_SECRET
require values for the mitxonline app to start successfully, but they are not mentioned in that repo's README or included in the example .env file. They are mentioned in the "Using Tutor" instructions but I skipped that step.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this PR should also enable mitxonline users to log in via mit-learn's apisix/keycloak instance, but if so I could not validate that because something seems off with my local setup and I was unable to log in that way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this PR should also enable mitxonline users to log in via mit-learn's apisix/keycloak instance, but if so I could not validate that because something seems off with my local setup and I was unable to log in that way.
Do you mean click login via MITxOnline login button? I had forgotten that does a surprising infinite loop. I'm not sure what causes that, but logging in via MIT Learn works.
@jkachel Do you have any idea? IMO not critical though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I was getting that endless loop initially, then started adjusting other env values with best guesses and got apisix or keycloak errors instead.
KEYCLOAK_CLIENT_ID=apisix | ||
KEYCLOAK_CLIENT_SECRET=HckCZXToXfaetbBx0Fo3xbjnC468oMi4 # pragma: allowlist-secret | ||
KEYCLOAK_DISCOVERY_URL=http://kc.ol.local:8066/realms/ol-local/.well-known/openid-configuration | ||
KEYCLOAK_REALM_NAME=ol-local |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could not log in with these settings. But the backpopulate command works regardless.
If the goal of this PR is just to backpopulate from a local mitxonline instance, then these keycloak settings can be omitted.
If the goal is also to allow login via MIT-Learn's apisix/keycloak instance, then something is off, maybe I have a bad or missing environment value somewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been testing this on Ubuntu Linux 24.04. I was able to eventually get the dashboard connected and see my programs / enrollments on the frontend, after changing some of the settings I noted below. However, I was unable to get the program page in Learn working. When I try and load the page for my test program, I get "Error fetching course page metadata for programv1%3Aprogam-v1-test-program" (Yes, that is the readable ID of my test program). The message says "connect ECONNREFUSED 127.0.0.1:8065." This indicates that the API in the watch
server (since the metadata seems to be queried by the server and not the client) has mitxonline.odl.local as the MITx Online base url, which is going to evaluate to 127.0.0.1. I think in the docker configuration, if we somehow get the watch
container itself to use host.docker.internal:8013
for that, then it should work?
```env | ||
# MIT Learn, frontend.local.env | ||
## This is the default; it should not be overridden | ||
NEXT_PUBLIC_MITX_ONLINE_BASE_URL=${MITX_ONLINE_BASE_URL} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's worth noting that this is the default in frontend.env
anyway, probably don't need to set it in frontend.local.env
as well
# MITxOnline, .env | ||
CSRF_COOKIE_DOMAIN=.odl.local | ||
CORS_ALLOWED_ORIGINS=http://mitxonline.odl.local:8065, http://learn.odl.local:8062 | ||
CSRF_TRUSTED_ORIGINS=http://mitxonline.odl.local:8065, http://learn.odl.local:8062 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In other places, we are still referencing open.odl.local
. We should either say that here, or change it everywhere else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. We should change it everywhere, but IMO not in this PR. I use learn.odl.local and had forgotten.
- MITX_ONLINE_UPSTREAM=${MITX_ONLINE_UPSTREAM:-mitxonline.odl.local:8013} | ||
- MITX_ONLINE_DOMAIN=${MITX_ONLINE_DOMAIN:-mitxonline.odl.local} | ||
- MITX_ONLINE_UPSTREAM=${MITX_ONLINE_UPSTREAM:-host.docker.internal:8013} | ||
- MITX_ONLINE_DOMAIN=${MITX_ONLINE_DOMAIN:-host.docker.internal} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to set MITX_ONLINE_DOMAIN
to mitxonline.odl.local
. This allows you to access http://mitxonline.odl.local:8065/ in a browser and then, using your already logged in session in APISIX, you are automatically authenticated to use Django admin in MITx Online.
What are the relevant tickets?
All the PRs we make where we copy-and-paste the setup directions for mitxonline <> Learn.
Description (What does it do?)
This PR adds directions for running MITxOnline and MIT Learn locally in a way that they can communicate.
How can this be tested?
./manage.py create_courseware
,./manage.py create_courseware_page
; see--help
for details. Note: program readable ids should start withprogram-v1:
../manage.py backpopulate_mitxonline_data --delete
, and./manage.py backpopulate_mitxonline_data
product-page-course
feature flag is on in your personal posthog./manage.py backpopulate_mitxonline_data