NathanVaughn / webtrees-docker

Up-to-date Docker image for webtrees with all the bells and whistles.
https://hub.docker.com/r/nathanvaughn/webtrees
MIT License
64 stars 15 forks source link

Backup of database #153

Open KLelong opened 3 days ago

KLelong commented 3 days ago

Hi, Any suggestions how to backup the database ? The webtrees-website mentions two possibilities : phpMyAdmin and mysqldump. phpMyAdmin needs to be installed (which it isn't AFAIK) and for mysqldump you need to access the console of one of the containers, which is not possible (again AFAIK). I'm using portainer if that matters (I'm a container-noob).

Thanks.

NathanVaughn commented 3 days ago

For the database container, if you're using the standard MariaDB or MySQL image, mysqldump is definitely pre-installed. Attaching a console is easy in Portainer, just click the Console button at the bottom of the container status

image

From there, run the mysqldump command and save it to a file you can get out of the container. Example:

mysqldump webtrees -u webtrees -p > /data/webtrees.sql

Personally, I just backup the contents of /var/lib/mysql as part of a daily job.

KLelong commented 2 days ago

Well, that's my problem. I can't connect to the console. I click on "console" and I get this : webtrees-db-console I then click on "connect" and I get this : webtrees-db-console-login forever or until I click on "connecting" which terminates the "connection". Using root as user does not make a difference.

I do have a regular copy of the whole stack, but I would like to have a copy of the system to install on a shared-web-space provider, so not dockerized. Besides that, I think copying a running database is not really safe as a backup.

KLelong commented 2 days ago

I had to do something with another docker-stack, and there also I can't connect to the console, so it's not the webtrees stack that has a problem, but my docker/portainer installation.

NathanVaughn commented 2 days ago

On the host that is running the container, you can also attach a shell manually:

 docker exec -it 2fe042727364cb21bd200886d4fc671f401589ba80e74d23ddd39dc71401744e /bin/bash

Where the hexadecimal string is the container ID.

If you want to schedule a backup job or something, replace /bin/bash with the mysqldump command you want to run instead.