jazkarta / edx-platform-for-isc

fork of the edx platform for development w/ isc
GNU Affero General Public License v3.0
1 stars 2 forks source link

ISC Customizations: Create XBlock for launching containers #9

Open cewing opened 9 years ago

cewing commented 9 years ago

A one-off solution for creating a component that would allow a student to launch a container was created in these two commits:

Create a new XBlock add-on that will encapsulate this functionality with the abilities requested in this comment from @natea:

we'd like to turn this into a configurable XBlock so that it can be used to launch any container.

The XBlock would allow the course author to specify other parameters such as the duration to run the container, what URL to send the student to, default username and password and other helpful information for the student.

This should be in a separate xblock repository that can be added to the system.

cewing commented 9 years ago

@natea: can you provide some examples of the types of customization that would be required to support arbitrary container launchers? What exactly does that mean?

natea commented 9 years ago

@cewing We have a small snippet of javascript code (provided upon request) that will talk to our container launcher API and spin up new containers, and return a URL to the student.

Currently, the only parameters that are required are: owner_email: "%%USER_EMAIL%%", project: "Healthshare"

The "Project" parameter can be any project that has been pre-defined in our container launcher service, which has instructions for how to launch a particular Docker image.

I can imagine that the course author might also want to specify things like:

But these two parameters are nice-to-haves for now. The minimum needed is the project name. The owner_email is automatically extracted from request.user.

natea commented 9 years ago

@cguardia i'll send you the javascript snippet by email instead of pasting it in here.

natea commented 9 years ago

@cguardia sent you the js snippet by email.

bryanlandia commented 9 years ago

@cguardia - Can you send me the js snippet from Nate?

bryanlandia commented 9 years ago

bryan@woollyandwise.com

bryanlandia commented 9 years ago

@natea - Some questions about the current xmodule implementation for launching containers. What I see is a template which uses HTML5 postMessage to post data to this url: https://isc.appsembler.com/isc/deploy/ included in a hidden iframe in the template. I get a 404 when browsing to that URL, but my understanding is that /isc/deploy is supposed to do all of the magic to instantiate the Docker image for the container and send back a postMessage to the containing window.
This postMessage triggers some JS in the containing window to create a success message with a link and instructions (username/pwd) to access the container.

cguardia commented 9 years ago

Better to have available here, I think.

bryanlandia commented 9 years ago

Thanks, @cguardia. @natea - I see now from this snippet that the URL for the iframe postMessage is https://isc.appsembler.com/isc/newdeploy/, which returns a web page with some related JS. So, that makes more sense now. So, now just wondering if that URL should be configurable. I'm guessing not...

natea commented 9 years ago

@bryanlandia eventually we'll want the URL to be configurable, but for purposes of ISC, the URL (https://isc.appsembler.com/isc/newdeploy/) doesn't need to change.

What we might want to have configurable is the URL of the container that gets returns, or rather the suffix of the URL to direct the student to different pages within the site to complete a particular exercise.

natea commented 9 years ago

@bryanlandia i can see that you pushed the xblock_launchcontainer repo, so i'll take a look as soon as I get my Birch environment setup.

bryanlandia commented 9 years ago

@natea - It's not complete yet. I'll let you know when it's ready for review

bryanlandia commented 9 years ago

@cewing - Please have a look at https://github.com/jazkarta/xblock-launchcontainer I've got coverage of the basics of the student view, studio edit view, and saving the xblock. I haven't added any Selenium tests, but the proper functioning is dependent on the isc.appsembler.com Django site anyhow.

bryanlandia commented 9 years ago

@skleinfeldt - Just recording here @natea's request "Also, can you make the URL isc.appsembler.com configurable in xblock_containerlauncher?

I'm thinking it's either something that could be configured sitewide or even coursewide.

Cale suggested a way to do this on the LTI github issue."

bryanlandia commented 9 years ago

About above request, see comment https://github.com/jazkarta/edx-platform-for-isc/issues/10#issuecomment-115304208 - Cale's suggestion isn't doable yet in Birch. It requires SettingsService which wasn't available until after that named release. So this request should be put on hold til Cypress.

natea commented 9 years ago

@bryanlandia this PR lets XBlocks use Django settings, so that's probably where we could define isc.appsembler.com as a configurable URL. https://openedx.atlassian.net/browse/OSPR-427