Hi, this script looks to be exactly what im looking for. Ive tried to install but am having an issue. Ive got nextcloud and mariadb set up in docker using docker compose. When executing the script im getting an error on the host of the database, in my config.php this is set to “db” as both containers are running in the same stack. The db is mounted to my local volume though (i.e. outside of the container) so is there a way to set the path to the database in the script rather than reading it from the config file? Thanks in advance!
It is possible to create a dummy config.php outside the container with the required parameters and make calcardbackup to use that file instead the one from the container. See Does this also work with a broken instance in the repos’ README for more details.
Another approach might be Docker-Calcardbackup.
Here is a quote from the author waja which may help:
The examples there are based on hoellen/nextcloud (https://hub.docker.com/r/hoellen/nextcloud). You just need basically two things:
• path to nextcloud config
• database connection
This is not related to special images. official nextcloud image, linuxserver, hoellen, this does not matter much at all.
I have now been able to get calcardbackup running with my dockerized Nextcloud and MariaDB setup.
For this to work, it is important that the name of the database server (which is configured in nextcloud/config/config.php) is accessible by the host machine running calcardbackup. Therefore you can run this command to add all running containers to the /etc/hosts file:
docker inspect $(docker ps -q) --format='{{range .NetworkSettings.Networks}}{{.IPAddress}} {{end}} {{ printf "%s" .Name}}' | awk {'print $(1), $(NF)'} | sed 's$/$$' >> /etc/hosts
Also, in my case, I had to install the Debian package mariadb-client to be able to send SQL requests to the Docker MariaDB.
Then I can successfully run
./calcardbackup /var/nextcloud/ -i
@Bernie_O Thank you so much! With your script I was able to restore my family calendar.
Though I must admit, that I ran into a few roadbumps because I first forgot to set a version in the dummy config file and then missed the “oc_”-table prefix. But once I straightened out my mistakes it was a breeze. Excellent.
That would be such a cool option, to store ics-files directly in a user’s data directory, just like the notes… The database is a rather hostile environment after a crash.
In case other are blocked with docker, both CalCardBackup and Nextcloud in separate docker with separate container for the DB.
What I did (for a one time backup need, not sure if it’s good for permanent use) is to connect the CalCardBackup container to the nextcloud docker network ID.
Note I’m using TrueNAS Scale Electric Eel (24.10), all apps installed from GUI are running in docker now (migrated from k3s in previous OS version).
Login to your machine in SSH if not your local one or open the shell if you are on it directly:
docker container ls
Find your calcardbackup container name, in my case: ix-calcardbackup-calcardbackup-1 (first I use the name under network, this was not the right one, double check for you).
Then list all the docker networks:
docker network ls
copy the network ID of your nextcloud docker instance. It’s some random string like abc123def456
Then connect the running container to this existing network:
docker network connect abc123def456 ix-calcardbackup-calcardbackup-1 (replace the container by yours if different)
VOILA! CalCardBackup docker (the main and only container here) can access all Nextcloud docker containers including the postgres DB (or MariaDB) contnainer it needs.