-
-
Notifications
You must be signed in to change notification settings - Fork 524
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
Cockpit Docker fails to restore data from MongoDB after docker rebuild #799
Comments
Also having this problem with Docker and MongoDB with the use of volumes. Unable to use docker if the data storage of collections doesn't persist as it should. |
Ah, I managed to solve this... :) So apparently it works like this: Whenever you create a collection, singleton,.... It generates a file that hosts the 'model' of that type. That file is a PHP file that is stored in 'storage'. Furthermore, images and other uploaded media/files are stored in 'storage' as well. It is the content of the entries that is saved in MongoDB. That is why it's possible to recreate a previously existing model in a fresh docker container and suddenly see your entries pop up again. All in all the solution was really simple: both the MongoDB as well as the storage need to be valid External sources. For MongoDB that means setting up environment variables: https://getcockpit.com/documentation/reference/docker For storage, that means setting up a persistent Docker volume. Lastly, you need to add a separate config file to the docker image in order to enable the usage of the MongoDB environment variables. The changes to the documentation to include this config.php page are already made, but not online yet. You can find a working config example here: https://github.com/woutervddn/cockpit-docs/blob/b52ec6d63c0627b3c27180df109f93e0077927c3/reference/docker/index.md |
For anyone looking for simple docker-compose that you can run without having to write the Dockerfile configs yourself -> https://github.com/AKApumkin/cockpit-persistent |
why don't you store all Json in mongodb when configured ( data and models ), cockpit container in production must stay away from data it only needs to hold code. it is painful that everytime we rebuild the docker container we lose all the collection models that are physically stored on docker or volume. |
Yesterday I posted this on the Discourse: https://discourse.getcockpit.com/t/bug-or-intended-behavior-mongodb-cockpit-docker-fails-to-restore-data-after-docker-restart/107
I'm since then certain that this is a bug.
I spawned a cockpit instance using MongoDB on a Dokku instance (self hosted heroku). The application connects and I can create a singleton.
When I rebuild the docker container using the Dokku commandline the singleton is gone. However, during the creation process of the exact same singleton (name, label, description) with the exact same fields, the form fields are prefilled with the original content.
It is as if redis, mongo or (cockpit itself?) fails to read the singleton from the DB.
I also noticed this behavior on a normal docker image (not running on Dokku).
Is there a way to force refresh the cache? Or does the root of this problem reside somewhere else?
The text was updated successfully, but these errors were encountered: