Open fititnt opened 4 years ago
@fititnt - a quick note, the populate command will not overwrite or reset the data, but rather append the new dashboards to what is already there
@SimonbJohnson interesting, very interesting. I will document this.
If this already is implemented, eventually maybe is possible to implement an extra param on python manage.py populate_database
to point to a different JSON file (but the default still the hxldash/management/commands/data.json
).
Not sure how the file was generated, but since it already is a JSON, at some point (way, way on future) it could be possible to export the datasets on JSON that the same version of hxldash can be able to import.
Yes, it would be pretty easy for it to load files this way.
The file is a list of config variables for a dash. They can currently be obtained from the raw html of the dashboard view page:
view-source:https://hxldash.com/view/319
It the config variable declared towards end.
The https://github.com/SimonbJohnson/quickX3/issues/69 was already implemented. We're ready to change the Dockerfile to use the master branch and document better this feature.
Later this issue will be solved.
https://github.com/SimonbJohnson/quickX3/issues/69
With the commit https://github.com/covid-taskforce-cplp/hxldash-docker/commit/5be6d9e2d4d21b61d7a2e1f9c64ba72ddc576dd8 (note: it does not use the master branch, but a testing branch), while is pretty fast to just make it work to test the sample dataset, may (not tested) reset the database (or at least the 3 first rows) when using the image created at #6.
This issue is just to remember that, ideally, by default we should have some way to allow the user not automatically run the command to pre-populate the database, and this feature should be the default. So for pre-populate the database the user should intentionally interested in doing it.
Some referentes
hxldash-docker/docker-entrypoint.sh
fititnt/uwazi-docker/blob/master/docker-entrypoint.sh
See https://github.com/fititnt/uwazi-docker/blob/master/docker-entrypoint.sh. On this was a quick check on how to allow an initial run.
Potential alternative: research how other python/django apps do this type of initialization
Very likely already there is strategies on how to do this type of initialization instead of we just copy the concept from the uwazi-docker.
But, while the hxldash-docker may not be focused to be production-ready, if it can be used to be used in production with changes is a win-win for anyone later wanting to use it as reference. Anyway the license is public domain, so not even cite creators is need.