Updater cron job for Norppa (palaute)
Uses the APIs provided by importer to update Sisu data
docker-compose.yml
includes cofiguration for a development database.
Start the dev environment with npm start
and Norppa's migrations are executed automatically.
Importer url can be freely configured to point to the staging/production instance or a local container with the IMPORTER_API_URL
variable.
Copy models and migrations from ../palaute
with npm run sync
. One should not edit the files here, instead commit to palaute
You might not want to run updater completely when doing tunkkaus so you might comment out some of the update functions from the runUpdater function.
Example:
Skipping user and organisation updates to start the updater from the function call updateCoursesAndTeacherFeedbackTargets()
.
However it is mandatory to run the updater completely at least once to get all of the data in to the database.
const runUpdater = async () => {
// Dependencies between updating, may result in failure if order not kept
// await updateUsers()
// Note: if importer updates data after updateUsers but before updateStudentFeedbackTargets, you may get a foreign key constraint error.
// Its not a huge problem, just run the updater again or wait for the next cron.
// await updateOrganisations()
await updateCoursesAndTeacherFeedbackTargets()
await updateStudentFeedbackTargets()
await updateFeedbackTargetCounts()
await synchronizeInterimFeedbacks()
}
If you wish to run updater with Norppa locally to confirm changes you need to enable the updater service in Norppa
For this Norppa and Updater directories much be adjacent in the same directory on your machine.
├── root directory (for example Repositories)
│ ├── norppa-updater
│ ├── palaute
Create a .env
file inside the project's root directory. In that file, copy the contents of the .env.template
file and add correct values for the variables based on the documentation.
Norppa-updater uses the same Sequelize model definitions as acual Norppa. Use the script npm run sync
to copy Norppa model definitions to norppa-updater, assuming that the Norppa repository is in the directory
../palaute
.