-
Move
onadata
folder to KPI underopenrosa
-
Rename all imports to follow the new path under KPI
-
Identify all duplicates settings. Left comments and #FIXME
-
Commented out all useless, redundant, duplicate settings
-
Import every useful and unique setting from KoboCAT project in
kobo.settings.base.py
-
Specify databases allowed to be touched by Constance Post signal (see
CONSTANCES_DB
in settings) -
Alter
db_routers.py
to block migrations from each other (logic inallow_migrate
). [GitHub]-
⚠️ It does not really block migrations. It does add an entry indjango_migrations
table for every app registered inINSTALLED_APPS
but does not create / alter tables in database. For example, when running./manage.py migrate viewer
in KPI, returns thisRunning migrations:
Applying viewer.0001_initial... OK
Applying viewer.0002_auto_20160205_1915... OK
Applying viewer.0003_auto_20171123_1521... OK
Applying viewer.0004_update_meta_data_export_types... OKbut no tables are created. Django does this in purpose to handle permissions correctly at the model level.
-
-
Monkey-Patch
django.contrib.auth.management.create_permissions
to avoid crashing because content type is wrong while creating KoboCAT model-level permissions in post-signal emitted bymigrate
management command when applying (kinda fake) KoboCAT migrations in KPI [GitHub 1, GitHub 2] -
Keep return
True
inallow_relation
indb_routers.py
. It seems to help when making relationships between common models in KPI and KoboCAT. For example, If I have aUser
object (loaded from KPI) and I want to retrieve its relatedUserProfile
from KoboCAT, Django is able to create SQL to load theUserProfile
object right out of the box (not 100% sure , to be tested it again). Side effect, will raise a ProgrammingError when trying to join tables from two different databases -
Create a decorator (
@use_db
) and utility function to specify the database alias to use indb_routers.py
. Useful to force code to use KoboCAT database when the database cannot be determinated with the app label. [GitHub]
Example:django-guardian
has to be installed in KPI. All of its querysets do not use.using('database_alias')
, so they are pointing to KPI database.
With the decorator, we can makedjango-guardian
use KoboCAT database instead -
Create a custom
User
model which extendsAbstractUser
. Keep retro-compatibility withauth.User
. Usefrom kobo.apps.kobo_auth.shortcuts import User
everywhere instead offrom django.contrib.auth.models import User
.
Needed to overloadhas_perm
and add some logic to test perm against the correct database (i.e. with context manageruse_db
) [GitHub] -
Fork
django_digest
to useget_user_model()
instead of direct import ofUser
. [GitHub] -
Overload
django-guardian
object permission back end to avoid checking permissions at object level with guardian and KPI objects. it does a warning though?: (guardian.W001) Guardian authentication backend is not hooked
-
Remove unicodecsv
-
Remove djangorestframework_guardian dependency
-
Handle DRF for KC (solution: create a base Viewset which follow DRF KoboCAT settings)
-
Import KoboCAT URLs in KPI at root (e.g.
./manage.py show_urls
now displays KoboCAT endpoints/<endpoint>
instead of/kobocat/<endpoint>
as discussed earlier. Easier to setup NGINX) -
Add Java 17 to KPI Dockerfile
-
Add KoboCAT PIP dependencies
-
Add a new script that is called from the entrypoint to handle migration history from existing and new installs.[GitHub] [GitHub 2]
-
Merge
CELERY_BEAT_SCHEDULE
-
Update [NGINX config]
-
Change
~~- SERVICE_ACCOUNT_WHITELISTED_HOSTS=kf.kobo.internal:8000,kf.kobo.internal~~ - SERVICE_ACCOUNT_WHITELISTED_HOSTS=kf.kobo.internal:8000,kf.kobo.internal,kc.kobo.internal:8001,kc.kobo.internal
-
Change
basename
of KPIUserViewSet
touser-kpi
to avoid conflicts with KoboCAT -
Use
CELERY_TASK_ROUTES
to route KoboCAT tasks to their own queue -
Create new celery worker for KoboCAT
-
Clean-up KoboCAT templates
-
Remove ConditionalRedirectMiddleware (move specific condition inside
download_xlsform
) -
Prefix
service_health
andservice_health_minimal
endpoints withlegacy/
in KoboCAT to avoids conflicts with KPI -
Use KPI classes for Digest and Token authentication (no use of KoboCAT tables anymore)
- Merge any helper, utility duplicate (e.g. MongoHelper)
- Remove Django-Digest tables in KoboCAT database for existing environment
- Remove DRF Token tables in KoboCAT database for existing environment
- Rename
auth_user
table tokoboauth_user
to match Django appkobo_auth
- Endpoints can respond under each domain
- 500 errors are handled by KoboCAT templates even if it is a KPI error