GithubHelp home page GithubHelp logo

geoffreyvanwyk / learningsandbox.online Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 9.25 MB

Sandboxes for all supported Moodle versions that are reset every hour on the hour.

Home Page: https://learningsandbox.online

License: GNU General Public License v3.0

HTML 14.78% Blade 19.13% PHP 57.40% CSS 1.33% JavaScript 7.36%
demo learning-management-system lms moodle online-learning-platforms sandbox ansible learning-environment virtual-learning-environment vle

learningsandbox.online's People

Contributors

geoffreyvanwyk avatar

Watchers

 avatar

learningsandbox.online's Issues

Remove the ability to install plugins

This is necessary to:

  • Prevent malicious users from using plugins to take over the server.
  • Prevent the server's storage space being used up.

This can be done by setting $CFG->disableupdateautodeploy = true; in config.php.

The Ansible role for Moodle must be updated before this can be done.

Cannot copy fresh database for Moodle 3.9

This issue occurred when first installing Moodle 3.9 during deployment from GitHub Actions.

TASK [Copy fresh database 3.9] *************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: DETAIL:  There is 1 other session using the database.
fatal: [***]: FAILED! => {"changed": false, "msg": "Database query failed: source database \"moodle-39\" is being accessed by other users\nDETAIL:  There is 1 other session using the database.\n"}

See https://github.com/geoffreyvanwyk/learningsandbox.online/actions/runs/6953214981/job/18918114038#step:7:241 .

The database cannot be copied while it is being accessed. This is probably due to the cron, which means the site has to be placed in maintenance mode before preparing for reset and disabled again afterwards. This also applies to the moodle_reset playbook.

To website add means of contacting me for support

If I was on Twitter, I could just have linked to that.

I could add a link to LinkedIn. Most people are on there.

Otherwise, find if there is a way for having a Contact page on a static website.

Implement automatic reset of Moodle instances

The automatic reset needs to take place every hour. Originally the intention was to do the reset on the hour. The reset will be performed from GitHub Actions. GitHub Actions may delay or drop a job at high load times, such as on the hour. (See the note for the schedule event: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule). For this reason, the reset should take place 30 minutes past the hour, every hour.

To make the reset instant, a fresh moodledata directory and a fresh database needs to be available at all times for each instance. The reset is then performed by a cron script triggering an Ansible playbook that updates config.php to point to the new directory and database. Thereafter, a new moodledata directory and database needs to be created again for the next switch. The old ones need to be deleted.

Update to Moodle playbook

  • After installation of a Moodle instance, copy the moodledata directory.
  • After installation of a Moodle instance, copy the database.
  • Create GitHub Actions workflow for running Reset Playbook every hour.

Tasks for Reset playbook

  • Rename current moodledata to old.
  • Rename fresh moodledata to current.
  • Rename "current" database to old.
  • Rename next database to "current.
  • Remove old moodledata.
  • Drop the old database.
  • Extract fresh moodledata.
  • Copy next database.

Add favicon

Make it simple, e.g. just the letters LSO in a square or cirlce.

Prevent sending of emails

This is to prevent malicious users using the Moodle instances to send spam.

This can be done in config.php by setting $CFG->noemailever = true;.

The Ansible role for Moodle needs to be updated to be able to set this with a variable.

Rebuild home page with Gulp

Building the website with Gulp will be much easier than with HydePHP, because:

  • with HydePHP, there are two systems: the PHP system and the NPM system. With Gulp, there is only Gulp.
  • the php hyde serve clashes with npm run watch almost every time because they write to the same directory. With every second change almost, the npm run watch command crashes while trying to chmod the mix-manifest.json file. This is very bad for productivity. With Gulp, I will only run one command gulp watch.
  • Autoreloading the web page in the web browser is much simpler with Gulp and BrowserSync. With HydePHP I would probably only figure it out after a lot of work.
  • I only need one page, and maybe a "Contact" page. Gulp feels much lighter for this than HydePHP.
  • HydePHP brings in styling customizations which interferes with DaisyUI.

Add useful plugins from Moodle plugins directory

Some plugins are almost always necessary on any Moodle installation, e.g. the Custom Certificate plugin. Because users cannot install plugins, these plugins should be installed.

  • Make list of useful plugins.

Moodle might have to be upgraded after every reset

If during a deploy of new commmits, new Moodle code is pulled from Moodle's GitHub, then the upgrade pages will appear after the reset has happened, and this will happen again after every reset. This is due to the fact that the saved database will not be upgraded.

Therefore, for each Moodle, the variable moodle_deploy_update must be set to no. Because the reset backups have already been made, all the installations must be redone.

  • Set the moodle_deploy_update variable to no for each Moodle instance (12 minutes)
  • Disable Reset workflow in GitHub Actions (1 minute)
  • Reset Digital Ocean droplet to the ubuntu2204-nopasswd_sudo_user_ubuntu snapshot (1 minute)
  • Run the Deploy workflow in GitHub Actions (50 minutes)
  • Enable Reset workflow in GitHub Actions (1 minute)

Moodle 3.9 cannot be reset

The Reset workflow in GitHub Actions repeatedly failed. I have manually disabled it.

The setup for resetting Moodle 3.9 is now in disarray with regards to the moodledata and the databases.

This is due to stopping the Reset workflow after it started and not allowing it to complete. I had to do that while an automatic deployment was being initiated.

The manual fix for this in the future is to not merge pull requests around the time of the Reset workflow (which is 30 minutes past the hour).

Maybe there is a GitHub Actions way of solving this automatically.

The plan to fix this now is to just rebuild the server from the saved image on Digital Ocean.

Create README

The README must mention why the Learning Sandbox is useful.

Free, instant access to default instances of Moodle versions for potential users who want to try it out, for existing users who want to see how Moodle behaves by default compared to their installations, for someone who quickly ones to try out a feature, and so forth.

The README must also mention the necessary limitations.

  • removal of the ability to install plugins. The removal of that ability is to protect the server from malicious users who might use plugins to take over the server or completely use up all disk space.

  • removal of the ability to send email so that malicious users cannot use the server to send spam.

  • automatic reset to default of every instance on the hour, every hour.

Upgrade the instances

Basically, a schedule should be added to the Deploy workflow for running once a week.

The workflow should run on the hour and disable the Reset workflow before starting, then reenable it afterwards.

Background image of primary hero appears damaged

Not sure how an image could get a permanent discoloring. Probably caused by the theme.

Part of this is to use a light theme. The theme does not have to match Moodle, which was what I was going for with the current theme.

HTTP not redirecting to HTTPS

I have fixed this on the server manually, but it must still be added to the playbooks.

The solution is to disable the default port 80 virtualhost: 000-default.conf.

When time until reset has run out, refresh pages

If the page is not reset, the timer will roll over and indicate that the reset in within an hour again, misinforming the user. The page should be refreshed via JavaScript. This will take the authenticated user back to the login page.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.