moodle-docker icon indicating copy to clipboard operation
moodle-docker copied to clipboard

Add support for moosh

Open abias opened this issue 7 years ago • 3 comments

Based on a discussion with my colleague @kathrin84, I was wondering if it would make sense to add official support for moosh (https://moosh-online.com / https://github.com/tmuras/moosh) by @tmuras to this project.

The main goal would be to be able to bootstrap a Moodle docker instance via CLI with some courses, test users and sample data / activities for manual testing, directly after the Moodle instance is initialized via CLI (https://github.com/moodlehq/moodle-docker/blob/master/README.md#use-containers-for-manual-testing).

I can imagine at least 4 approaches to realize this goal:

  1. Add a set of commands to https://github.com/moodlehq/moodle-docker/blob/master/README.md as instruction how to install moosh on your local system, how to wire it to a certain Moodle docker instance and how to use it on this Moodle docker instance.
  2. Add a set of commands to https://github.com/moodlehq/moodle-docker/blob/master/README.md as instruction how to install moosh on the moodle-php-apache container, how to wire it to the Moodle instance on this container and how to use it on this Moodle docker instance.
  3. Add the installation of moosh to https://github.com/moodlehq/moodle-php-apache and add instructions to https://github.com/moodlehq/moodle-docker/blob/master/README.md how to use moosh on a Moodle docker instance. I am aware that this will mess with the existing container architecture, but I just wanted to note the approach anyway.
  4. Leverage the existing docker-moosh project https://github.com/hcpss-banderson/docker-moosh by @hcpss-banderson, add it to https://github.com/moodlehq/moodle-docker and have moosh setup controlled by a new environment variable. Add instructions to https://github.com/moodlehq/moodle-docker/blob/master/README.md how to install and use moosh on a Moodle docker instance.

Any opinions?

abias avatar Sep 21 '17 06:09 abias

This sounds like a good idea. I need to investigate/think about it a bit more...

But I am not in favour of idea 3), I think my comments on https://github.com/moodlehq/moodle-php-apache/issues/2 will explain about that.

danpoltawski avatar Sep 21 '17 10:09 danpoltawski

Hi Dan, I'm posting on behalf of Alex to give you a short update. He worked on option 4. Unfortunately, the implementation would require greater code changes... Then we tried the moodle-datagenrator from Andrew Nicols (https://github.com/andrewnicols/moodle-datagenerator). This script is sufficient for our personal needs to quickly create courses, users and enrolments. Best, Kathrin

Kathrin84 avatar Nov 13 '17 07:11 Kathrin84

# Initialize Moodle database for manual testing
./bin/moodle-docker-compose.ps1 exec webserver php admin/cli/install_database.php --agree-license --fullname="Docker moodle" --shortname="docker_moodle" --adminuser=admin --adminpass="test" --adminemail="[email protected]"

# Install moosh, setup MooshCourse1, add mooshteacher and mooshstudent, and enrol them.
docker cp moosh-setup.sh moodle-docker_webserver_1:/var/www/html/;
docker exec -it moodle-docker_webserver_1 bash /var/www/html/moosh-setup.sh

moosh-setup.sh

#!/bin/bash
set -x

apt-get update; apt-get install -y nano less

sed -i 's#\$CFG->debugdisplay = 1;#\$CFG->debugdisplay = 0;#g' config.php
sed -i '#\$CFG = new stdClass();#a $CFG->noreplyaddress="[email protected]";' config.php

curl https://moodle.org/plugins/download.php/20823/moosh_moodle.zip --output moosh.zip; unzip -o -q moosh.zip; rm -f moosh.zip;
cd moosh; php ../composer.phar install; ln -f -s $PWD/moosh.php /usr/local/bin/moosh; cd ..;

mooshteacher=$(moosh -n user-create --password pass --email [email protected] --firstname MooshTeacher --lastname Mooshuser mooshteacher)
mooshstudent=$(moosh -n user-create --password pass --email [email protected] --firstname MooshStudent --lastname Mooshuser mooshstudent)
courseid=$(moosh -n course-create --category 1 --fullname "MooshCourse1" --description "Moosh Course 1" --idnumber "Moosh1" --visible=y shortname)
moosh -n course-enrol -r editingteacher "$courseid" mooshteacher
moosh -n course-enrol "$courseid" mooshstudent

mwithheld avatar Feb 04 '20 03:02 mwithheld