When running the init script for tutor-discovery I’ve noticed refresh_course_metadata is hard set to use the production partner (openedx) which is far as I can tell will always fail if running a development environment. It’s easy enough to manually change this to partner=dev to get things working, but wondering if I’m missing something, or is this a bug?
Hm, seems like a bug to me!
I’m not totally sure what the right solutions is. In broad strokes I could imagine two different ways to fix this:
- Add some templating logic to the refresh_course_metadata line, so that
tutor dev initwould use the
tutor [local|k8s] initwould use the
- Use the same
openedxparnter for both dev and prod (dropping the
--organizations-api-url, use the docker-internal URLs (eg,
http://lms:8000/api/courses/v1/) instead of the external URLs, since the internal URLs should be identical across dev, local, and k8s mode.
so I uncovered another example of this in site-configuration while playing around with tutor-discovery. It basically boils down to the same problem. It seems to me the internal URLs are intentionally not being used for these but I don’t have context on why that is.
Is putting conditionals based on local environment something we want to start doing?
Happy to throw together a fix just want to get some better context first.
site-configuration creation: tutor-discovery/init at master · overhangio/tutor-discovery · GitHub
(in this case site configuration doesn’t really break anything until you run cache_programs for example)
I can’t remember the exact reasons, but I’m pretty sure that it’s not possible to share a single site in development and production. I believe it has to do with the fact that Discovery also makes use of the internal URL to access the LMS externally, e.g: from the browser.
Also, the reason why we use the production site even in dev is probably that it’s the only one that works correctly in both cases – but I’m sure, to be honest.
If you can find a (tested) solution that is guaranteed to work in dev and prod I’m all ears. Discovery sites have always been a huge PITA for me.