MoodleNet: Difference between revisions
No edit summary |
No edit summary |
||
Line 27: | Line 27: | ||
docker run -d --restart unless-stopped -e ARANGO_NO_AUTH=1 -p 8529:8529 --name=mn-3-db arangodb:3.10 | docker run -d --restart unless-stopped -e ARANGO_NO_AUTH=1 -p 8529:8529 --name=mn-3-db arangodb:3.10 | ||
Possibly tweaking some options as you like, e.g. mounting a volume|directory for data or setting a password | Possibly tweaking some options as you like, e.g. mounting a volume|directory for data or setting a password | ||
====Install MoodleNet==== | ====Install MoodleNet ==== | ||
Install Moodlenet by simply issueing the following npm command | Install Moodlenet by simply issueing the following npm command | ||
npm create @moodlenet@latest path/to/installation/folder | npm create @moodlenet@latest path/to/installation/folder | ||
Line 104: | Line 104: | ||
Users can sign up with their email, receive in their inbox a confirmation link to click and create their user-account | Users can sign up with their email, receive in their inbox a confirmation link to click and create their user-account | ||
====Assign admin privileges to user==== | ====Assign admin privileges to your user==== | ||
As you deploy a new instance, no user is present in the system. | As you deploy a new instance, no user is present in the system. | ||
Line 113: | Line 113: | ||
Open the avatar menu on top right header, and click '''admin''' link | Open the avatar menu on top right header, and click '''admin''' link | ||
Click on '''Users''' section on the left, and see your user listed there. Activate the '''admin''' icon to give | Click on '''Users''' section on the left, and see your user listed there. Activate the '''admin''' icon to give yourself admin privileges | ||
Now you can log out and login back with your email, see you gained the '''admin''' link in your avatar menu | Now you can log out and login back with your email, see you gained the '''admin''' link in your avatar menu | ||
== Migrate from V2 == | Admins can directly use that admin page feature anytime to assign and remove admin privileges to other users | ||
== Update the system== | |||
You can easily upgrade MoodleNet keeping system packages always up-to-date with the minor and patch releases by issueing the command | |||
npm update | |||
from within the installation directory, the same where you start the system | |||
Since MoodleNet is npm-package based, it leverages all npm features for upgrades and new packages installation | |||
== Migrate from V2== | |||
If you have a v2 running and want to migrate it to v3 , you can use the [https://www.npmjs.com/package/@moodlenet/v2-migrate-v3 @moodlenet/v2-migrate-v3] | If you have a v2 running and want to migrate it to v3 , you can use the [https://www.npmjs.com/package/@moodlenet/v2-migrate-v3 @moodlenet/v2-migrate-v3] | ||
The v3 system must have access to Moodlenet-V2 persistencies: its running arangoDB instance and the MN2 filesystem as configured in [https://gitlab.com/moodlenet/moodlenet/-/tree/1c8c7eb9b9aa2a3ee912871c670480b3e5fa0f70/packages/ce-platform#set-environment-variables V2 env variable '''STATICASSETS_FS_ROOT_FOLDER'''] | The v3 system must have access to Moodlenet-V2 persistencies: its running arangoDB instance and the MN2 filesystem as configured in [https://gitlab.com/moodlenet/moodlenet/-/tree/1c8c7eb9b9aa2a3ee912871c670480b3e5fa0f70/packages/ce-platform#set-environment-variables V2 env variable '''STATICASSETS_FS_ROOT_FOLDER'''] | ||
After installed Moodlenet, issue the following command from the installation folder | After installed Moodlenet, issue the following command from the installation folder | ||
Line 132: | Line 138: | ||
} | } | ||
re/start the system, all the services will start after the migration done | re/start the system, all the services will start after the migration done | ||
==MoodleNet architecture== | ==MoodleNet architecture== | ||
MoodleNet is a full stack TypeScript/JavaScript system using: | MoodleNet is a full stack TypeScript/JavaScript system using: | ||
*NodeJs | *NodeJs | ||
** NPM Packages [https://nodejs.org/en/knowledge/getting-started/npm/what-is-npm/] | **NPM Packages [https://nodejs.org/en/knowledge/getting-started/npm/what-is-npm/] | ||
**ESM Modules [https://nodejs.org/api/esm.html#introduction] | **ESM Modules [https://nodejs.org/api/esm.html#introduction] | ||
*Browsers | *Browsers | ||
Line 142: | Line 147: | ||
**HTML5 [https://html.spec.whatwg.org/multipage/] | **HTML5 [https://html.spec.whatwg.org/multipage/] | ||
**CSS3 [https://www.w3.org/Style/CSS/] | **CSS3 [https://www.w3.org/Style/CSS/] | ||
==MoodleNet development environment== | ==MoodleNet development environment == | ||
*NodeJs ^16 https://nodejs.org/ | *NodeJs ^16 https://nodejs.org/ | ||
* ArangoDB ^3 (we suggest using [https://www.docker.com/ Docker]) | *ArangoDB ^3 (we suggest using [https://www.docker.com/ Docker]) | ||
*We recommend the open source IDE Visual Studio Code https://code.visualstudio.com/ | * We recommend the open source IDE Visual Studio Code https://code.visualstudio.com/ | ||
=== Setup development environment=== | ===Setup development environment === | ||
'''From the command line interface (CLI):''' | '''From the command line interface (CLI):''' | ||
Line 172: | Line 177: | ||
npm run dev-start-webapp my-dev # <- my-dev: the installaton server to point to | npm run dev-start-webapp my-dev # <- my-dev: the installaton server to point to | ||
Once all started, browse http://localhost:3000 | Once all started, browse http://localhost:3000 | ||
===Mono-Repository management with Lerna.js=== | === Mono-Repository management with Lerna.js=== | ||
MoodleNet project takes leverages [https://lerna.js.org/ lerna.js] to manage multi-package mono-repository . | MoodleNet project takes leverages [https://lerna.js.org/ lerna.js] to manage multi-package mono-repository . | ||
Revision as of 13:38, 7 July 2023
What is MoodleNet?
MoodleNet is a flexible Open Education Technology platform for curating collections of the best known Open Educational (and other) Resources. You'll find more general information in the MoodleNet user documentation.
If you are looking to get started as a MoodleNet developer, we recommend taking the MoodleNet for Developers course with Moodle Academy.
Current status
Take a look at MoodleNet releases in our Tracker.
Roadmap
- The MoodleNet release schedule is available on the MoodleNet Roadmap.
Quick start guide
System Requirements
MoodleNet requires the followings to be available on your system
Notice that the current nodejs LTSs frameworks are nodejs ^18 and npm ^9
We tested so far with the previous LTSs nodejs ^16 and npm ^8
Make sure to have nodejs ^16 installed and you should get npm ^8 as well
Deploy an ArangoDB instance
MoodleNet uses ArangoDB as main database
You can choose how and where to deploy your ArangoDB, as long as it can be reached by MoodleNet process
An easy way to install run ArangDB locally as a service is by using Docker[4] e.g. :
docker run -d --restart unless-stopped -e ARANGO_NO_AUTH=1 -p 8529:8529 --name=mn-3-db arangodb:3.10
Possibly tweaking some options as you like, e.g. mounting a volume|directory for data or setting a password
Install MoodleNet
Install Moodlenet by simply issueing the following npm command
npm create @moodlenet@latest path/to/installation/folder
That will install all MoodleNet core packages in the choosen folder
it will also create a default configuration file (default.config.json) and a default cryptographic key-pair for the system (default.crypto.privateKey , default.crypto.publicKey)
Start MoodleNet process
To start MoodleNet issue the following command from within the installation directory
npm start
open your browser on http://localhost:8080
Notice: on the first run the system will have to compile the webapp, so you'll get a 404 until ready. It should take a few minutes
MoodleNet configuration file
MoodleNet configuration file (default.config.json) holds all static system configs.
Here's how the default config looks like after install:
{ "pkgs": { "@moodlenet/core": { "baseFsFolder": "/path/to/installation/dir/fs", "instanceDomain": "http://localhost:8080", "npmRegistry": "https://registry.npmjs.org", "mainLogger": { "consoleLevel": "info", "file": { "path": "./log/moodlenet.%DATE%.log", "level": "info" } } }, "@moodlenet/crypto": { "keys": { "alg": "RS256", "type": "PKCS8", "private": "/path/to/installation/dir/default.crypto.privateKey", "public": "/path/to/installation/dir/default.crypto.publicKey" } }, "@moodlenet/arangodb": { "connectionCfg": { "url": "http://localhost:8529" } }, "@moodlenet/http-server": { "port": 8080, "defaultRpcUploadMaxSize": "5MB" }, "@moodlenet/ed-resource": { "resourceUploadMaxSize": "1.2GB" }, "@moodlenet/simple-email-auth": { "newUserNotPublisher": false }, "@moodlenet/email-service": { "nodemailerTransport": { "jsonTransport": true } }, "@moodlenet/system-entities": { "rootPassword": "eqhb30x9iq5" }, "@moodlenet/react-app": {} }
here's some relevant configs you may want to check and tweak
- @moodlenet/arangodb.connectionCfg.url : the default config assumes you installed ArangoDB without password with standard port on the same host
- @moodlenet/core.baseFsFolder : path (better absolute path instead of relative to MoodleNet process cwd) to the system root folder for system filesystem persistency, if you want to change the system-filesystem-root after the system already run, move or clone the existing folder somewhere else and set this config properly to point to the new path
- @moodlenet/core.instanceDomain : the public domain of your moodlenet instance (e.g. https://moodlenet.example.com) - the default one (http://localhost:8080) is ok for testing and dev
- @moodlenet/email-service.nodemailerTransport : the nodemailer transport configuration for the system email service. It can be a simple smtp url string, or a nodemailer standard config object. Notice: with the default configuration { "jsonTransport": true } the system won't send any email, it will simply log them)
- @moodlenet/system-entities.rootPassword : a static root password for edge cases - you'll use it to give the first admin permission to a user (see below) - this property is optional, if not set the root user is disabled
- @moodlenet/http-server.port : the HTTP server port to listen
Moodlenet's HTTP service doesn't support HTTPS.
It's always a good practice to back Moodlenet with a HTTP reverse proxy (e.g. nginx, Apache) and it is a must if you want to publish over HTTPS, configuring TLS on it
Default authentication system
Moodlenet comes with a simple email+password authentication system (pkg @moodlenet/simple-email-auth) that lets users signup and login with a verified email
Users can sign up with their email, receive in their inbox a confirmation link to click and create their user-account
Assign admin privileges to your user
As you deploy a new instance, no user is present in the system.
Signup with your email and create your user.
Test login, then logout and browse to the hidden page http://localhost:8080/login/root, here you can type in the rootPassword (specified in config file) to login as root.
Open the avatar menu on top right header, and click admin link
Click on Users section on the left, and see your user listed there. Activate the admin icon to give yourself admin privileges
Now you can log out and login back with your email, see you gained the admin link in your avatar menu
Admins can directly use that admin page feature anytime to assign and remove admin privileges to other users
Update the system
You can easily upgrade MoodleNet keeping system packages always up-to-date with the minor and patch releases by issueing the command
npm update
from within the installation directory, the same where you start the system Since MoodleNet is npm-package based, it leverages all npm features for upgrades and new packages installation
Migrate from V2
If you have a v2 running and want to migrate it to v3 , you can use the @moodlenet/v2-migrate-v3
The v3 system must have access to Moodlenet-V2 persistencies: its running arangoDB instance and the MN2 filesystem as configured in V2 env variable STATICASSETS_FS_ROOT_FOLDER
After installed Moodlenet, issue the following command from the installation folder
npm install @moodlenet/v2-migrate-v3
Edit the default.config.json adding a @moodlenet/v2-migrate-v3 section beside the others, it should look like that
"@moodlenet/v2-migrate-v3": { "v2DbConnectionCfg": { "url": "http://your-mn-v2-arangodb-host:8529" }, "v2AssetFolder": "/path/to/v2/asset/folder" }
re/start the system, all the services will start after the migration done
MoodleNet architecture
MoodleNet is a full stack TypeScript/JavaScript system using:
MoodleNet development environment
- NodeJs ^16 https://nodejs.org/
- ArangoDB ^3 (we suggest using Docker)
- We recommend the open source IDE Visual Studio Code https://code.visualstudio.com/
Setup development environment
From the command line interface (CLI):
Ensure ArangoDB is running on localhost. You may run it in a Docker container issueing a command as below:
docker run -e ARANGO_NO_AUTH=1 -p 8529:8529 --name=mn3-dev arangodb:3.10
Clone the repository, you may wish to fork it, but that's not required:
git clone https://gitlab.com/moodlenet/moodlenet.git
Change to the project's folder:
cd moodlenet
Install and initialize the project:
npm install
Install a development server:
npm run dev-install-backend my-dev # <- my-dev: an arbitrary dev-installation name
In the example we choosed my-dev as installation name, the tool will then setup a dev installation in ./.dev-machines/my-dev
You can create as many dev installations as you wish.
Run development backend:
npm run dev-start-backend my-dev # <- my-dev : the name you choosed when installed
The first run of the system may take some time to install.
The default configuration for dev includes the config @moodlenet/react-app.noWebappServer: true that prevents the server to serve the webapp, so you won't access the webapp on http://localhost:8080
Instead, you'll want to run a webpack+HMR serving the webapp issueing
npm run dev-start-webapp my-dev # <- my-dev: the installaton server to point to
Once all started, browse http://localhost:3000
Mono-Repository management with Lerna.js
MoodleNet project takes leverages lerna.js to manage multi-package mono-repository .
Please refer to Lerna documentation to understand how it manages mono-repo and project-packages dependency linking in the development environment.
Questions? Please take a look in the MoodleNet Community and Tracker for answers or to ask for help.