-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
DB data is lost after workspace restart #3054
Comments
I found that the DB data is not included in the snapshot because the The issue is not observed in the PHP stack, which includes the MySQL server, but does not declare the So, the issue has a broader scope. It affects any data written to a volume. Such data would be lost on workspace restart, regardless of having snapshots. |
@kaloyan-raev Yes, volumes are volumes and are not persisted. Are are committing to an image and tagging it. Nothing fancy. |
So what should I do to keep the DB data between restarts? |
I think that anything that is user-mounted should not be saved. We should investigate how to have the actual database be saved within the image (not volume mounted) to avoid this particular issue. Why was the database volume mounted? |
I didn't mount any volume. I use the Java-MySQL stack as is. I even don't know how to mount a volume in the Che stack definition. Just the fact that the MySQL docker image declares |
@kaloyan-raev maybe do a backup and restore of the DB? Or copy the entire /var/lib/mysql to a different location. An ugly hack though. |
@karlsson82 For now I just fork the official mysql image Dockerfile, remove the Note that it requires PR #3049 to run successfully. |
Hi @kaloyan-raev did you ever get to solve your problem? (persist the data, not in the snapshot per se) I just made a test with the pet-clinic sample project that comes with che:
Just used the standard petclinic sample but can't get it to persist data. Have the same problem with a project of mine, but I'm using PostGreSQL instead and same issue. I'm using che latest version 5.14. |
@dev-gbassanini I haven't gone beyond what I have already described in my previous comment, which allowed me to save the DB data in the workspace snapshot. |
@garagatyi @eivantsov - would the proper fix to this type of issue require us analyzing Dockerfile or Composefile to remove any fixed VOLUME statements? That would work for raw recipes, but would not work for any off-the-shelf images that are downloaded. |
@TylerJewell building own image like @kaloyan-raev has suggested |
That is a solution, but not really a reliable solution at large. I'm brainstorming whether there are any system implementations we could explore to work around this limitation? It's possible that this is elegantly handled with Che on k8s - as image VOLUME statements are probably mapped to persistent volumes. That could be an acceptable answer - that we would not support this type of images on Docker, but only on k8s. |
What if user added volume to exclude a heavyweight folder from a snapshot and get better time of snapshotting/restoring? |
Not sure I follow how adding a volume excludes a heavyweight folder from snapshot process? But, in thinking this through, the move to k8s may solve these issues regardless in a couple ways: If persistent volumes live up to the performance expectations, the necessity of snapshots goes down, and if they are still there they are faster as what is added is a smaller file system layer. |
volumes are not included in a snapshot. |
I think we are starting to have a clear understanding on the difference between an enterprise-class version of Che and a version of Che that is not enterprise grade. The differences are things relating to:
I think we are comfortable saying that Che on Docker is a reasonable workgroup solution, but as a result of that deployment there are a couple limitations that it imposes:
However, there is an approach for overcoming all of these limitations with a k8s-based infrastructure. And if this limitation is needed by your project, then you need an enterprise solution. And I am ok with saying that k8s is the only package that we are providing for enterprise solution unless the community contributes an update to Swarm or Cloud Foundry. So with that, I would not implement a similar approach for the Docker solution. Instead, I would just test this to work and verify on k8s. WDYT? |
I don't think persisting data within the snapshot would be the best solution. |
Yes, that is correct. Sorry I hijacked your thread to talk about the larger issue and possible design solutions for it in the future. |
Got it! Thanks @TylerJewell. Just one final clarification...the solution you're thinking about will be only for enterprise-che? |
It would only be for Che on Kubernetes. We are working to provide two packages of Che: stand alone Docker and on Kubernetes. While we will try to leave the IDE / workspace functionality identical between the two deployments, "enterprise" features that are infrastructure-dependent would only be practical with Kubernetes. So I think we could say that the flexibility of what is snapshot is much broader on Kubernetes than what is available on Docker. And that snapshotting flexibility would be a requirement for any sizable enterprise that needs to optimize performance. |
I am closing this issue with the suggested workaround: Build own mysql image without VOLUME Theoretically it is possible to mount a host_path into dev-machine and then make sure db machine inherits this volume through volumes_from. I haven't tried it though. |
The workspace snapshot does not include MySQL DB data.
Reproduction Steps:
touch /myfile
mysql -e "create schema test;"
mysql -e "show databases";
ls -l /myfile
;mysql -e "show databases";
Expected behavior:
Both
/myfile
and thetest
database are available after the restart.Observed behavior:
/myfile
is available, but not thetest
database.Che version: 5.0.0-M8-SNAPSHOT
OS and version: Fedora 24
Docker version: 1.10.3
Che install: local build ->
che.sh run
Additional information:
The text was updated successfully, but these errors were encountered: