Simple script for remote Mayan EDMS backup

642 views
Skip to first unread message

Roberto Rosario

unread,
Sep 27, 2012, 12:13:48 PM9/27/12
to mayan...@googlegroups.com
Just a simple bash script I use to backup the Mayan installation at work to my laptop.  It creates a sub directory based on the date under the MOUNT_POINT you specify after that does a complete database and document storage copy.


#!/bin/sh
MOUNT_POINT=/home/rosarior/data_disk/ogpe-backup/mayan/backups
MAYAN_SERVER=172.16.1.196
DATE=`date +%Y%m%d`
BACKUP_DIRECTORY="$MOUNT_POINT/$DATE"
REMOTE_SSH_USERNAME=rosarior
REMOTE_MYSQL_USERNAME=root
REMOTE_MYSQL_DATABASE=mayan

echo "Backup directory: $BACKUP_DIRECTORY"
mkdir -p $BACKUP_DIRECTORY

echo -n  "Running mysqldump..."
mysqldump --host=$MAYAN_SERVER -u $REMOTE_MYSQL_USERNAME -p $REMOTE_MYSQL_DATABASE > $BACKUP_DIRECTORY/mayan.sql
echo "mysqldump finished."

echo -n "Running rsync..."
rsync -avz --delete --progress -e ssh $REMOTE_SSH_USERNAME@$MAYAN_SERVER:/var/local/mayan/document_storage/ $BACKUP_DIRECTORY/document_storage/
echo "rsync finished."

echo "Backup complete."

mayan_firsttime

unread,
Nov 15, 2012, 3:48:25 AM11/15/12
to mayan...@googlegroups.com
cool but would be great if you could incorporate this feature to mayan itself

Roberto Rosario

unread,
Dec 12, 2012, 8:08:26 PM12/12/12
to mayan...@googlegroups.com
I am working on a backup app with a few planned features including remote backups (https://github.com/rosarior/mayan/tree/development/apps/backups), but it depends on experimental stuff not present in the current so it will be a while before inclusion into the stable version.

--Roberto

Subhash Pant

unread,
Jun 10, 2016, 9:33:29 PM6/10/16
to Mayan EDMS
Roberto,

I am trying to configure two mayan servers, on ditto hardware. My backup/restore goals are as follows:

1) Keep a backup of everyday diffs into a separate place, includes MySQL and document_storage.
2) Copy the backups from primary to secondary, and overwrite the MySQL Db, as well as document_ storage so that I have a hot standby available.

Do you see any configuration issues with this? basically, on secondary, i intend to overwrite everything everyday, maybe in rename_mayan Db, create new mayan db and restore on top of it.

I also have another question. In the previous versions of Mayan, I was able to access the files using path in the indexes, as defined in the settings_local. But it appears that the feature has been deprecated. Is there any way I can decrypt, or extract files out of my document storage if I ever need to?

Thanks.
--Subhash

Roberto Rosario

unread,
Jul 5, 2016, 7:00:48 PM7/5/16
to Mayan EDMS


On Friday, June 10, 2016 at 9:33:29 PM UTC-4, Subhash Pant wrote:
Roberto,

I am trying to configure two mayan servers, on ditto hardware. My backup/restore goals are as follows:

1) Keep a backup of everyday diffs into a separate place, includes MySQL and document_storage.
2) Copy the backups from primary to secondary, and overwrite the MySQL Db, as well as document_ storage so that I have a hot standby available. 

Do you see any configuration issues with this? basically, on secondary, i intend to overwrite everything everyday, maybe in rename_mayan Db, create new mayan db and restore on top of it.


I would suggest than instead of copying the MySQL DB you do an sql dump and load instead, higher changes the backup will be good. 
 
I also have another question. In the previous versions of Mayan, I was able to access the files using path in the indexes, as defined in the settings_local. But it appears that the feature has been deprecated. Is there any way I can decrypt, or extract files out of my document storage if I ever need to?


The feature was re-added as a filesystem in userspace (FUSE).   Documentation here: http://mayan.readthedocs.io/en/latest/topics/indexes.html#mirroring

execute ./manage.py mountindex [index-slug] [target directory]. Now all your index structure will be available at [target directory].

Bruno CAPELETO

unread,
Jul 17, 2016, 4:47:31 PM7/17/16
to Mayan EDMS
Hi strongly suggest not incorporating backup strategy to MAYAN itself.

Please make clear in the documentation what to be backuped (sql dump + document folder) and how to recover in case of a crash, in order to implement that in a global (per user) strategy.

For incremental backup I personnaly use customized scripts based on rdiff-backup.
Reply all
Reply to author
Forward
0 new messages