This project was developed with:
- Java 17 + Spring (BackEnd)
- PostgreSQL (Database)
- Docker Swarm (Environments created)
On PostgreSQL, citext extension must be installed:
docker-compose exec postgres psql -U thuv -c 'CREATE EXTENSION IF NOT EXISTS citext;'If you need to customize the config, use a Spring profile dev :
- create a file
src/main/resources/application-dev.properties - overwrite needed properties :
app.cas.servicemust be set to the front URL (If you launched the front locally with the help of the README of the front repository, it must be http://localhost:4200/loginAccept)app.cas.rscUrlmust be set to the URL of the CAS you use and you must use the same CAS in the front and the back apps. If you use the CAS launched with docker compose, then the correct url is http://localhost:9443/cas/p3/serviceValidate- You can add somme logging, for instance
go.debug = true logging.level.fr.centralesupelec.thuv=DEBUG logging.level.io.grpc=ERROR logging.level.org.liquibase=DEBUG logging.level.io.sentry=DEBUG logging.level.org.springframework.security=DEBUG
- Execute
docker-compose up -dto start containers. - Generate your keys
- You can now compile the .jar file :
./mvnw package, and it builds intarget/thuv.jar. - Run
java -Dspring.profiles.active=dev -jar target/thuv.jar
- Execute
docker-compose up -dto start containers.
- Once both back-end and front-end apps are running, visit 'http://localhost:4200'
- Connect with default user : username is
casuserand password isMellon - In the terminal, run
docker-compose exec postgres psql -U thuv -c "UPDATE users_roles SET role_id = (SELECT id FROM roles WHERE name = 'ROLE_ADMIN') WHERE user_id = 1;" - Refresh http://localhost:4200
# For MacOS / Ubuntu 21 and older / Debian 11 and older
openssl genrsa -out src/main/resources/private_key.pem 4096
openssl rsa -pubout -in src/main/resources/private_key.pem -out src/main/resources/public_key.pem
# Else
openssl genrsa -traditional -out src/main/resources/private_key.pem 4096
openssl rsa -traditional -pubout -in src/main/resources/private_key.pem -out src/main/resources/public_key.pemYou need to compile with changes you made then run: ./mvnw liquibase:diff to generate a changelog, then rename it and add it to the master.xml file.
In order to update your database, you can use ./mvnw liquibase:update or start the application.
For the first use, you need to launch ./mvnw liquibase:changelogSync in order to sync database and changelog.
- Check that
lti.base-pathJava property is the base URL for the backend (for instancehttps://example.com/api). It will be used to generate absolute URIs. - In Moodle, go to
Site Administration > Plugins > External tool > Manage tools. InTool URLtext box, type the URL of the front followed by/lti/register(for instancehttps://example.com/lti/register) and click "Add LTI Advantage". - It should open an iFrame in which you must connect as an admin, then the tool is automatically registered in Moodle and the platform is saved in MyDocker database.
- In MyDocker, get the "invitation link" for the course you are interested in.
- In Moodle, edit the section of the course you'd like to link to MyDocker, (turn on Editing mode and) click "Add an activity or resource"
- Click "External tool"
- Set any name for the activity, select Preconfigured tool "automatic based on tool URL", and enter as the "Tool URL" the "invitation link" fetched earlier.
- Click "Save and display", you should be redirected to MyDocker logged in as the same user as in Moodle.