Serlo editor as LTI tool
Allows integrating the Serlo Editor into various learning management systems like Moodle, itslearning, edu-sharing, ...
Requirements:
- Docker 24.0.0 or later
- Node 20.14.0 or later
yarnto install dependencies- Create a copy of
.env.templateas.env yarn generate-secretto generate aLTIJS_KEYin .env- Add missing secret values in
.env yarn devto start the LTI tool
Now, the LTI tool is running locally. On code changes the express server will restart and the frontend will be rebuilt.
- Launch the LTI tool using either Saltire or the LMS mocks
- Go to https://saltire.lti.app/platform, sign in, navigate to "Advanced
options" and upload file
saltire-platform_[TYPE].configof thesaltire-configs/directory.TYPE=LTIDeepLinkingshows flow of creating a new Serlo Editor element.TYPE=LTIResourceLink_Instructorshows flow of opening an existing Serlo Editor element as Instructor (editable).TYPE=LTIResourceLink_Learnershows flow of opening an existing Serlo Editor element as Learner (non-editable). - Click "Connect"
yarn dev-mocksto start the edu-sharing/itslearning mocks- Open
http://localhost:8100(edu-sharing) orhttp://localhost:8101(itslearning)
src/backend contains the Express server built on top of
ltijs
src/frontend contains the React frontend bundled with Vite and provided in
express through the /app route
mocks contains mocks for edu-sharing and itslearning that can launch the lti
tool in local development
e2e contains end-to-end tests
uberspace contains scripts and configuration files for setting up a deployment
on Uberspace
If you need to add a new mandatory environment variable in the .env file, add
it to src/utils/config.ts.
You may want to deploy using docker.
First, during development, you must add the following line in /etc/hosts
127.0.0.1 mocks
And then run the following command.
$ yarn dev-image
Now you can open the browser at localhost:8100.
To publish a new docker image, just change the version at package.json and
push to branch staging.
The .env files on Uberspace contain secrets and are stored separately in an S3 bucket.
Making changes:
- SSH into the environment, v.g.
ssh [email protected]if you need to change the development environment. cd ~/serlo-editor-as-lti-tool- Modify the
.envfile. - Restart the serlo-app service
supervisorctl restart serlo-appso that the new .env values are used. - Test if everything works
- Upload the file to the bucket v.g.
s3cmd put .env s3://edtr-env/$USER/.env.
If you prefer or need to do the changes in your local machine, you have two options:
A. UI: If you have the permissions, you can login into IONOS and manage the
.env files there using the UI. You need to download, modify and upload them.
B. CLI:
-
Ask an admin to include you into the IONOS contract and update to policy of the corresponding bucket. Alternatively, you can use the credentials of the dev or admin user.
-
Install a S3 client CLI (we recommend
s3cmd, https://docs.ionos.com/cloud/storage-and-backup/s3-object-storage/s3-tools/s3cmd) and configure it accordingly. For access and secret keys go to https://dcd.ionos.com/latest/#/key-management. Some other info:Default Region: eu-central-3 S3 Endpoint: s3.eu-central-3.ionoscloud.com DNS-style: s3.eu-central-3.ionoscloud.com -
Download the file you want to modify, v.g.
s3cmd get s3://edtr-env/edtrdev/.env .env.edtrdev, change it and upload it v.g.s3cmd put .env.edtrdev s3://edtr-env/edtrdev/.env.
Iframes provide security to the host page but can limit access to required
functionality (especially for cross-origin embedding). Please use the following
settings in iframe attributes sandbox and allow.
If you have/want attribute sandbox use:
<iframe
sandbox="
allow-downloads
allow-forms
allow-modals
allow-popups
allow-popups-to-escape-sandbox
allow-presentation
allow-same-origin
allow-scripts
allow-storage-access-by-user-activation
"
src="..."
...
></iframe>If you don't have/want attribute sandbox it can also be missing. But never an
empty string.
<!-- Do not use -->
<iframe sandbox="" src="..."></iframe>If you have/want attribute allow use
<iframe
allow="
clipboard-read https://editor.serlo.org https://staging.editor.serlo.org https://dev.editor.serlo.org https://editor.serlo-staging.dev;
clipboard-write https://editor.serlo.org https://staging.editor.serlo.org https://dev.editor.serlo.org https://editor.serlo-staging.dev;
fullscreen https://editor.serlo.org https://staging.editor.serlo.org https://dev.editor.serlo.org https://editor.serlo-staging.dev;
autoplay https://editor.serlo.org https://staging.editor.serlo.org https://dev.editor.serlo.org https://editor.serlo-staging.dev
"
src="..."
...
></iframe>or
<!-- Allows all origins access -->
<iframe
...
allow="
clipboard-read *;
clipboard-write *;
fullscreen *;
autoplay *
"
src="..."
></iframe>If you don't have/want attribute allow it can also be missing. But never an
empty string.
<!-- Do not use -->
<iframe allow="" src="..."></iframe>