Typhonragewind / meshcentral-docker

168 stars 46 forks source link

Backup / restore Mesh and MongoDB #42

Open Janiaking opened 10 months ago

Janiaking commented 10 months ago

Hi everyone and Happy new Year!

My config.json looks like:

"mongodb": "mongodb://mongodb:27017/mesh",
    "mongodbcol": "mesh",
    "WebRTC": "false",
    "autoBackup": {
      "backupIntervalHours": 24,
      "keepLastDaysBackup": 14,
      "zipPassword": "mypassword"
    }
  },

also with "backupPath": "/opt/meshcentral/meshcentral-backups",

but the backup is not taken on sheduled time or even when type in console : "autobackup" command

This backup is only for meshcentral files or also includes MongoDB database ? How to backup and restore MongoDB ? Just copy and paste the files that i got mannually copied?

P.S With your docker-compose.yml with MongoDB database , what are the config to connect to database? I mean there is a defualt password or something when i wish to connect to MongoDB by third party software ( like management database solution to take backup ) ?

Typhonragewind commented 8 months ago

I'm sorry, but I don't use MongoDB and i'm not wholly familiar with that environment. @originaljay Might be the best person to answer this, since he's the author of that PR

originaljay commented 8 months ago

Unfortunately, I moved my MeshCentral instance to a cloud vps and no longer have it running with docker. I did not keep my original configs, but did have my automatic backups going to a network share which still contains the last 10. The backups do include a full dump of the MongoDB database, as well as the contents of the "meshcentral-data" folder. MongoDB backups can be restored with the mongorestore command, which is part of the mongo-tools package (this was the subject of the pull request, referenced by @Typhonragewind). I'd recommend you read that PR for some context. The MeshCentral documentation also includes a bit about restoring a MongoDB backup. The MongoDB container, as created in the "docker-compose-mongodb.yml" file in this repository, does not have any authentication enabled by default, so no username and password to connect. I do not know why your automatic backups are not working - perhaps confirm that the permissions on that target directory are correct? It should be writable by whatever user is running your docker containers. Also, check the mesherrors log in your meshcentral-data directory.

Even though I no longer use it, I would like to thank @Typhonragewind for keeping this Docker image going!