Skip to content

Docker newbie4 instructions

Michael Gage edited this page Apr 16, 2022 · 1 revision

daemon_course, sendXMLRPC

incomplete instruction fragments

These are instructions for installing a "daemon_course" in the WeBWorK container described in "Docker instructions for newbies" and using it to allow editing and rendering of PG problems from a standard command line editor. The same daemon_course will also run exercises in PreTeXt documents.

The easiest and most familiar part is setting up daemon_course in the docker container. The second part involves configuring the script /webwork2/clients/senderXMLRPC.pl so that it sends .pg file to the local host (running in the container) for rendering. This second part hasn't been automated yet so there is some assembly required.

Setting up the daemon_course

1. cd webwork-docker/webwork2
2. docker-compose up -d
# 3. in web browser type in `http://localhost:8080/webwork2
# 4. select "Course administration"
# 5. add the course daemon_course  using the modelCourse as a model.
#    (the name and spelling are important for the conventional configuration)
# 6. add a "student" (user) to the daemon_course course using the 
#    Classlist Editor. Set the user login name to "daemon" 
#    and the student ID to "daemon".  This (daemon) also becomes the password for the student. 
#    Click the "Add students" button to add the student.
# 7. Return to the Classlist Editor and give the student "daemon" the privileges of login_proctor by 
#        clicking on the pencil icon next to "daemon" and then choosing login_proctor from the pop-down menu 
#       at the right hand side of the editing window. Remember to click "take action". 
#     You don't need to assign any homework to the student "daemon". 

# 8. Check that everything is correct by logging out of the daemon_course and logging back using 
#     the daemon login name and daemon password
#
# That's it -- the daemon course is up and running on the localhost.

Configuring webwork-docker/webwork2/clients/sendXMLRPC.pl to render .pg files running from outside the container.

  • Set up a local ww_credentials file in a suitable location.
    • The best place is probably as .ww_credentials or ww_session_credentials in your home directory.
  • Edit it to refer to the server you want to use, and to use the correct display/edit commands.

Once everything is ready, you just need to (fix the path to get into the correct place):

cd webwork-docker/webwork2/clients
perl sendXMLRPC.pl -a input.pg

There is a dependence on Crypt::SSLeay which I need to correct before we can go further with this. Unless you already have Crypt/SSLeay installed. (It's complicated to install -- there must be an alternative.) It is used for reaching https sites -- which is nearly everywhere these days.

Note: You may be able to get this to work from outside the container by installing relevant Perl modules (first using your OS tools, and as necessary using local modules for your user) and setting certain environment variables.

  • Try to install package versions of Perl modules when they are available for your system using OS tools (or those of your Perl distribution).
  • Install cpanm aka cpanminus on your system.
  • Use cpanm to install missing modules into private locations for use in your account (only). Examples:
  • cpanm UUID/Tiny.pm
  • cpanm Locale/Maketext/Lexicon.pm
  • export PERL5LIB=/home/username/perl5/lib/perl5/ (fix to use your proper home directory, etc.)
  • export WEBWORK_ROOT=/your_path_to_ww/webwork2 (fix path)
  • export WEBWORK_URL=https://demo.webwork.rochester.edu (fix URL)
  • And try
cd webwork2/clients
./sendXMLRPC.pl -b t/input.pg

Configuring how to run sendXMLRPC.pl from inside the container.

This is easier since all the dependencies have been filled in the container. It's less convenient however since probably the .pg files you want to test are on the desktop and not in the container. Anyway let's try it.

cd webwork-docker/webwork2/clients
docker container exec -it webwork2_app_1 bash   # open a bash terminal window on the container
cd webwork2/clients
./sendXMLRPC.pl -a input.pg     # this renders the file, unfortunately we don't have a GUI web browser inside this terminal to display the results graphically. 
./sendXMLRPC.pl --help  # will display the other things sendXMLRPC can do once it is set up

Still digging...... Maybe this can be set up in a separate container that includes an ubuntu browser???
It will be a few weeks at least before I can get to this.

Downloading a pg pull request of unit test problems (PR# ) and rendering them using sendXMLRPC.pl

Clone this wiki locally