monica
monica copied to clipboard
lost all my work, for the 2nd time.
I'm running Monica in Docker, and for the 2nd time lost my data when the App and Mysql container was updated. In both cases upon restart the DB was cleared.
THe first it happend I was able to find the dangling container from before-update and grab the mysql folder and copy it into the new container. It took almost half a day to figure this our.
Now, it happened again, and after, literally 10 hours, and can't get it to work this time. I really wish there was an EASY export/import function.
there shouldn't be any new containers. are you sure that you set up mysql with persistent option ?
are you sure that you set up mysql with persistent option ?
I don't think I did. Can you point me in the direction of how to do that? Thanks!
example from https://hub.docker.com/_/mariadb/ : -v /my/own/datadir:/var/lib/mysql . so mount the folder /var/lib/mysql inside the container to the /my/own/datadir-folder on the host
@mptpro I would recommend bind mounts. If you're new to docker, it's safer and more straight forward to use bind mounts instead of docker volumes.
@mptpro I got bit by this too, I'm not a big docker user so this caught me off-guard.
I added -v /home/millette/monica-db:/var/lib/mysql
(replace "/home/millette/monica-db" with your own path to an empty directory; I made mine chmod 777 (writeable by anyone) just to be sure. Took me a few tries... Anyhow, the following worked for me:
mysqlCid="$(docker run -d \
-e MYSQL_RANDOM_ROOT_PASSWORD=true \
-e MYSQL_DATABASE=monica \
-e MYSQL_USER=homestead \
-e MYSQL_PASSWORD=secret \
-v /home/millette/monica-db:/var/lib/mysql "mysql:5.7")"
Remember, you must replace /home/millette/monica-db
with a path to your own empty directory. After that you can run:
docker run -d --link "$mysqlCid":mysql -e DB_HOST=mysql -p 8080:80 monica
as usual, following the short docker instructions.
@djaiss @asbiin Might be a good idea to add this caveat to the docker docs.