xchem/fragalysis-frontend

Targets fail to load in local development environment

GoelBiju opened this issue · 23 comments

The targets (given by example data) fail to show up in the target list in the fragalysis-frontend when you set up a local development environment. After running docker-compose -d docker-compose.dev.yml up in fragalysis-frontend, the fragalysis-loader fails to find the database tables in the mysql database even though the migrations are applied.

I have had a closer look at this along with @agbeltran and informed @alanbchristie. The problem seems to be that even though the Django migrations run in the "web_dock" container, the mysql database in the "fragalysis-frontend_mysql" docker container is not updated with the latest tables every time it is started, and as a result, the loader cannot populate data into the database meaning no information (including target data) is loaded in the frontend.

In addition to this issue, I wanted to point out that due to the database tables not being updated with the latest schema when the containers are created, changes to the fragalysis-backend models are not reflected in the mysql database when you develop on the backend. This problem has been highlighted to @reskyner.

Is there a specific development workflow that needs to be performed in order to update the database tables to match the Django models?

Just as an update to this issue, I have recently tried updating the Django models on the fragalysis-backend within the OpenShift stack (set up by @alanbchristie) but the same issue occurs. This commit was made on our forked backend repository, however the fragalysis Django REST API mentions that a table was not created on the database for the respective model.

I've created my own docker compose file https://github.com/m2ms/fragalysis-frontend/blob/master/docker-compose.localhost.yml in that I've changed version of neo4j image neo4j:3.5 In my case this was main reason of loader failuring.

I've created my own docker compose file https://github.com/m2ms/fragalysis-frontend/blob/master/docker-compose.localhost.yml in that I've changed version of neo4j image neo4j:3.5 In my case this was main reason of loader failuring.

Thanks @tibor-postek-m2ms for the reply. It seems, however, that the issue is the database tables do not exist even though the fragalysis-stack seems to be applying the Django migrations. You can see below that I have turned on debugging in the Django settings.py and the API request says that the targets table does not exist.

image

I suggest only one thing. Remove everything (all docker images and containers) all your local project directories, then clone again, change docker-compose file (use my version of neo4j) and try it again

I suggest only one thing. Remove everything (all docker images and containers) all your local project directories, then clone again, change docker-compose file (use my version of neo4j) and try it again

@tibor-postek-m2ms there still seems to be no effect, I removed all docker containers/image and freshly cloned all repositories from xchem. The loader still fails with exceptions stating that the "django_db.viewer_target" and "django_db.viewer_project" do not exist in the database.

so try to manually make migration. (remove all migration, remove database and create new migrations from python model and run them)

so try to manually make migration. (remove all migration, remove database and create new migrations from python model and run them)

@tibor-postek-m2ms did you mean to suggest to do this from the fragaylsis-stack docker container since that is the only place when a connection can be made to the mysql docker container?

no connect to running docker container to bash
obrázok

@tibor-postek-m2ms I have connected to the fragalysis_mysql container, however, I don't see any migration related files?
image

Or was it the "web_dock" container?

@tibor-postek-m2ms I'll try dropping the "django_db" database and see what happens.

connect to web_dock
obrázok

@tibor-postek-m2ms I have connected to web_dock and removed all the migrations folders. I have also dropped the "django_db" from the mysql docker container.

I tried running python manage.py makemigrations but it can't find the database since I deleted it, shall I restart the stack?

image

hmm I used custom docker-compose file in which I had network connection between docker services. Try to run stack again or use my dockerfile :)

hmm I used custom docker-compose file in which I had network connection between docker services. Try to run stack again or use my dockerfile :)

So I did a CREATE DATABASE django_db in the mysql container and then ran the migrations again, it started creating some of the tables but got stuck on the viewer:

image

I also remove all created mysql data in directory. you can try it

I also remove all created mysql data in directory. you can try it

@tibor-postek-m2ms I delete the mysql_data directory in the /data folder locally and restarted the stack but it comes up with the same error as when running makemigrations and migrate; related to the inchi field in viewer.Compound:

image

use my docker-file

use my docker-file

I am using your docker-compose.localhost.yml file but it's the same.

@tibor-postek-m2ms I am going to try removing the unique=True on the Compound model and see if that works.

@tibor-postek-m2ms I am going to try removing the unique=True on the Compound model and see if that works.

It seems doing this also had no effect @tibor-postek-m2ms.

UPDATE: The loader is now running again but this time all I did was remove all containers and then delete the database and start the docker-file for localhost. I'll have to try and recreate this @tibor-postek-m2ms .

It seems the inchi issue persists but the tables have been created.

I have tried making some changes to the models and now the database fails to update, so I cannot pinpoint what the exact issue.

I have removed the unique=True constraint on the inchi TextField in the Compound model and migrations work successfully. Although I wasn't sure whether this was required @reskyner , @tibor-postek-m2ms ?