Posts

Showing posts from August, 2024

Moodle Google Analytics

  Step 1: Set Up Google Analytics Create a Google Analytics Account : Go to Google Analytics . Sign in with your Google account or create one if you don’t have it. Click on Start for free to set up a new property. Create a New Property : Enter the name of your Moodle site as the property name. Set the reporting time zone and currency. Click Next and fill in the required business information. Click Create . Set Up a Data Stream : Choose Web as your platform. Enter your Moodle site URL and give it a name (e.g., "Moodle"). Click Create stream . Get the Tracking Code : After creating the data stream, you’ll see the tracking ID and a JavaScript snippet. Copy the JavaScript code. This code will be embedded in your Moodle site to track user activity. Step 2: Add Google Analytics Tracking Code to Moodle Log in to Moodle as an Administrator . Navigate to the Additional HTML Settings : Go to Site administration > Appearance > Additional HTML . Insert the Google Analytics Code ...

Automate Moodle backup

Create a Shell Script to automate the backup task i name it backup.sh #!/bin/bash # Get today's date in DD-MM-YY format TODAY=$(date +"%d-%m-%y") MOODLE_IMAGE="backup-moodle-image-$TODAY" MARIADB_IMAGE="backup-mariadb-image-$TODAY" BACKUP_DIR="/home/hame/backup/test" ZIP_NAME="moodle-backup-$TODAY.zip" echo "Commiting moodle-image..." docker commit -p backup-mbda_moodle-1 $MOODLE_IMAGE echo "Saving moodle-image..." docker save -o ~/backup/test/$MOODLE_IMAGE.tar $MOODLE_IMAGE echo "Removing moodle-image..." docker image rm $MOODLE_IMAGE echo "Commiting mariadb-image..." docker commit -p backup-mbda_mariadb-1 $MARIADB_IMAGE echo "Saving mariadb-image..." docker save -o ~/backup/test/$MARIADB_IMAGE.tar $MARIADB_IMAGE echo "Removing moodle-image..." docker image rm $MARIADB_IMAGE echo "Saving mariadb data..." docker run --rm -v moodle_mariadb :/bitnami/mariadb -v $B...

Moodle Backup and Restore in Docker

Backup moodle & mariadb images to a folder First, Run the docker commit container command this is just for copying the container image (where  moodle-moodle-1 &   moodle-mariadb-1   is the name of the constainer try: "docker ps" to look for the name of that container you want to commit ) : # docker commit -p moodle-moodle-1 backup-moodle-moodle-1 # docker commit -p moodle-mariadb-1 backup-moodle-mariadb-1 Alternatively, we can save it as a tar file in any directory and move it freely to any desired docker host system for a deployment: # docker save -o ~/backup-moodle-moodle-1.tar backup-moodle-moodle-1 # docker save -o ~/backup-moodle-mariadb-1.tar backup-moodle-mariadb-1 Backing up Docker volumes to a folder # docker volume ls Secondly , Backup the data in the docker volumes into a compressed file archive and save it to the local directory /tmp or any directory you want (just change only the /tmp to any directory you want) the  mariadb_data, moodle_data, mo...