Resolve "sms cv data needs to be queried via rest api"
Closes Issue #70 (closed)
What does the MR do?
Implementation of cron scheduling`
-
define new generic service
cron-schedulerfor scheduling periodic tasks -
run
cron-scheduleronly ifCRON_SETUP_SERVICE=true -
initialize SMS/CV remote tables in database depending on
SMS_ACCESS_TYPE/CV_ACCESS_TYPE- if
..._ACCESS_TYPE=api, foreign tables are not initialized by database but will be created and updated byupdate_..._tables.pyscript via cron scheduling - first task implemented: update/sync tables in database via sms-cv rest api
- not yet implemented but will follow in another MR: upate/sync tables via sms rest api
- if
-
using the aforementioned new environment variables:
name value used in service SMS_ACCESS_TYPE db/api database, cron-scheduler CV_ACCESS_TYPE db/api database, cron-scheduler CRON_SETUP_SERVICE true/false cron-scheduler -
built with
Dockerfilewith entrypointtini, executing./cron-entrypoint.sh -
cron-entrypoint.sh:- exit service if
CRON_SETUP_SERVICE=false - prepend environment variables to crontab (to make them available for cron), start cron service
- exit service if
Check if sms_cv sync works correctly with
docker compose exec database psql -c "SELECT * FROM sms_cv_measured_quantity;"This should return a table with data.
For testing it might make sense to change the cron-expression to
* * * * *in thecrontab.txt
A bit of clean-up
- pass image tags also to services built with Dockerfiles (
database,tomcat,cron-scheduler) - use updated SMS-URL and CV-URL
- switch group of demo user in
frontend/user.jsonto allow to login to frontend with AAI after django fixture is loaded (withdocker compose exec -T frontend python3 manage.py loaddata user.json thing.json)- group
Testexists in dev-AAI and produces a primary key error if user is part of that group as it is already present in frontend database
- group
Edited by Joost Hemmen