Windows OpenEMR Backup and Recovery over Amazon Web Services

From OpenEMR Project Wiki
Revision as of 18:58, 22 May 2012 by Bradymiller (talk | contribs)
A way to automate the encrypted backup of my windows server to Amazon web services (S3 cloud). This is very inexpensive and allows a wide geographic secured backup option.This basic idea would likely work on various other platforms as well. I combined a freeware I found at www.dragondisk.com and previous backup scripts from the wiki. I extracted the command line tools to a directory I named C:\Dragon. I then wrote the following script in a text file using notepad and then saved it as a command file (filename.cmd) . You have to set up a web services account on Amazon, make a bucket you can name anything you desire, and add a folder named xampp to your bucket. You can then use windows scheduler to schedule running your command file at any schedule you desire when you are not using your server, since it shuts down services to run. It takes a long time to run the first time, but after that just backs up changed files.
net stop "mysql"
net stop "apache2.2"
SET DGTOOLS_ACCESS_KEY=myaccesskey #you get these keys from the secuity set up area on amazon
SET DGTOOLS_SECRET_KEY=mysecretkey #web services after your account is active
SET DGTOOLS_ENCRYPTION_PASSWORD=mypassword
SET DGTOOLS_DECRYPTION_PASSWORD_0=mypassword #make up good strong passwords
SET DGTOOLS_DECRYPTION_PASSWORD_1=myoldpassword
cd C:\Dragon
start /wait dgsync.exe -z -e aes-256-cbc "C:/xampp/" "s3://mybucketname/xampp/"
net start "apache2.2"
net start "mysql"
The restore command line is the reverse of above and should allow you to restore to any windows machine you desire if your server crashes.
dgsync.exe "s3://mybucketname/xampp/" "C:/xampp/"
This has been tested only a few times after some basic test runs, but without apparent problems. Here is the sourceforge forum thread if have questions or feedback: Windows Backup Solution