Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document how to run the hxldash-docker on populate_database mode #7

Open
fititnt opened this issue Apr 12, 2020 · 4 comments
Open

Document how to run the hxldash-docker on populate_database mode #7

fititnt opened this issue Apr 12, 2020 · 4 comments

Comments

@fititnt
Copy link
Member

fititnt commented Apr 12, 2020


With the commit 5be6d9e (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

python /usr/src/app/manage.py migrate

## This command run always with the lastest commit; the user does not have option to disable (Its bad)
python /usr/src/app/manage.py populate_database

python /usr/src/app/manage.py runserver 0.0.0.0:8000

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.

@SimonbJohnson
Copy link

@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

@fititnt
Copy link
Member Author

fititnt commented Apr 12, 2020

@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.

@SimonbJohnson
Copy link

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.

@fititnt
Copy link
Member Author

fititnt commented May 2, 2020

The SimonbJohnson/quickX3#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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants