Amazon ec2 How to back up. Script stops on final step


(Clif Caldwell) #1

I am using Amazon ec2 and it is using Ubuntu. It works well and have not pushed the Free Tier limits yet.
The problem I am having is using the Back Up Script. It progresses through the database dump and copying the directory but then it loses connect with the Amazon ec2 instance and you cannot download the file.

I also tried this through ssh but there is no mysql client installed in the base ubuntu instance and when you try to install the mysql client (5.7 I think) and the mariaDB (10 I think) it states that it will break things when it fulfills the dependencies.

Is there a way to get the mysql tables and the openemr particulars without using a mysql dump command? Which OpenEMR directories do I need to copy?

Thanks


(Stephen Waite) #2

hi @Clif_Caldwell, backup script might be failing because max_input_time = -1 isn’t set in your php.ini settings. Should be under something like /etc/php/x.x/apache2/php.ini where x.x is your php version. You’ll have to restart apache in order for it to take effect.


(Clif Caldwell) #3

Thank you. I will give that a try.
Clif


(Clif Caldwell) #4

A couple of issues. The only php.ini files I can find are:
sudo locate php.ini
/root/openemr-devops/docker/openemr/5.0.0/php.ini
/root/openemr-devops/docker/openemr/5.0.1/php.ini
/root/openemr-devops/docker/openemr/5.0.2/php.ini
/root/openemr-devops/docker/openemr/flex/php.ini
/var/lib/docker/aufs/diff/51630a3a37912af12e0dca0a772991d4422453fb00c79a570ae7d8f766aa50c4/etc/php7/php.ini
/var/lib/docker/aufs/diff/5f76b941f460e0eb40c11da3384545d9b7948ad019e15ac2ff011a899944533c/etc/php7/php.ini
/var/lib/docker/aufs/mnt/a02c34c2a811f6b17fc9aaacb19bab5c32ceab81f9ef0e3bbe8ba89756e08a40/etc/php7/php.ini

From this I am assuming that the php.ini files in the /openemr-devops/ directories are the default ones that come with those versions and not the one being uses. Obviously the mounted instances are inside of a docker container.

Two things:

  1. where are the /etc files that apply to the docker container?
  2. where the heck is the openemr tree?

thanks,
Clif


(Stephen Waite) #5

hi @Clif_Caldwell, didn’t realize you’re running an AWS package, the free tier limits might be at play here


(Clif Caldwell) #6

Shoot I should have thought about that. I did have to up my storage slightly (about 15 Gb total). Trying to figure out where the openemr tree is would help then I could look if the file was being archived.

Thanks again


(Stephen Waite) #7

that should be plenty of storage

you’ll need to run a few commands to edit the php.ini
sudo bash
docker exec -it $(docker ps | grep _openemr | cut -f 1 -d " ") /bin/sh
vi /etc/php7/php.ini


(Clif Caldwell) #8

Thank you. I will give it a go.


(Clif Caldwell) #9

That is so cool. Obviously I need to learn docker. Maybe I’ll build a docker media center at home to learn docker.Of course I wish the default editor was nano instead of vi but worked well to get me into editing the php.ini file.
I made sure the max_input_time = -1 (unlimited) and I also upped the max_execution_time = 90 (was bumped up to 90 from 60). Unfortunately the mysql dump worked and it looked like the openemr copy worked as it flashed (very,very briefly) a message (unreadable) and then the frame was unreachable until I refreshed and it went back to the “Create Backup” page.
Thanks again. The cool docker commands are worth the price of admission.


(Stephen Waite) #10

apk add nano :stuck_out_tongue: :slight_smile:


(Clif Caldwell) #11

OK I made a video so I could capture the output and it gets all the way to “Backup file has been created. Will now send download.” That is when this frame is disconnected and I have to refresh the page to reconnect. This is promising because it means that the file is probably in the OpenEMR tree I just have to find it and pull it to my location. Will give this a try. I am not sure what the reason is that it disconnects when it starts the download. Could it be a permission issue? I do not know.


(Clif Caldwell) #12

Unfortunately I cannot find the file. I am not sure if it completes or it deletes it when it gets past the download. Will look at the backup script.


(Stephen Waite) #13

try
tail /var/log/apache2/error.log
from the docker to see if there’s a php error preventing the download


(Clif Caldwell) #15

OK here are the last few attempts:
[Wed Jul 03 14:25:51.363830 2019] [php7:warn] [pid 88] [client ...:55432] PHP Warning: include_once(): Failed opening ‘Archive/Tar.php’ for inclusion (include_path=’.:’) in /var/www/localhost/htdocs/openemr/interface/main/backup.php on line 51, referer: http://ec2-.*..**.compute-1.amazonaws.com/interface/main/backup.php
tar: autoconfig.sh: Warning: Cannot open: Permission denied
tar: run_openemr.sh: Warning: Cannot open: Permission denied
[Wed Jul 03 14:26:44.416371 2019] [php7:warn] [pid 88] [client ..
.*:55432] PHP Warning: include_once(Archive/Tar.php): failed to open stream: No such file or directory in /var/www/localhost/htdocs/openemr/interface/main/backup.php on line 51, referer: http://ec2-.*..**.compute-1.amazonaws.com/interface/main/backup.php
[Wed Jul 03 14:26:44.416404 2019] [php7:warn] [pid 88] [client ..
.*:55432] PHP Warning: include_once(): Failed opening ‘Archive/Tar.php’ for inclusion (include_path=’.:’) in /var/www/localhost/htdocs/openemr/interface/main/backup.php on line 51, referer: http://ec2-.*..**.compute-1.amazonaws.com/interface/main/backup.php
[Wed Jul 03 14:26:53.060544 2019] [php7:warn] [pid 88] [client ..
.*:55432] PHP Warning: include_once(Archive/Tar.php): failed to open stream: No such file or directory in /var/www/localhost/htdocs/openemr/interface/main/backup.php on line 51, referer: http://ec2-...***
.compute-1.amazonaws.com/interface/main/backup.php
[Wed Jul 03 14:26:53.060579 2019] [php7:warn] [pid 88] [client ..
.*:55432] PHP Warning: include_once(): Failed opening ‘Archive/Tar.php’ for inclusion (include_path=’.:’) in /var/www/localhost/htdocs/openemr/interface/main/backup.php on line 51, referer: http://ec2-.*..**.compute-1.amazonaws.com/interface/main/backup.php
[Wed Jul 03 14:26:53.062063 2019] [php7:error] [pid 88] [client ..
.*:55432] PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 529809408 bytes) in /var/www/localhost/htdocs/openemr/interface/main/backup.php on line 108, referer: http://ec2-.*..***.compute-1.amazonaws.com/interface/main/backup.php
/var/www/localhost/htdocs/openemr #


(Stephen Waite) #16

looks like there’s not enough memory available, time to edit the php.ini again :slight_smile:

btw what package did you install, express plus?, most of these have automatic backups built in and you should practice restoring from there which would make this backup process superlative, like this guide suggests


(Brady Miller) #17

Hi,

Pretty sure the backup out of memory error was addressed in most recent 5.0.1 patch.

-brady


(Stephen Waite) #18

container patch guide


(Clif Caldwell) #19

Thanks for the help. Will follow suggestions when I get back.


(Ralf Lukner MD PhD) #20

Cliff: I also use Amazon EC2. I use the Express version with the MySQL database, and I have daily snapshots set up on that. The uploaded documents are not in the database and need to backed up separately. I have started using DropBox (which has a secure version suitable for HIPAA) to put the documents into a file system on it rather than uploading them. Anyway, I hope you have a good experience with the system.
–Ralf


(Clif Caldwell) #21

Thank you. So far I am enjoying the experience. Will let you guys know how the back up solutions work out. Currently I now know how to access the docker container and I as you all know Duplicity is saving everything and I have more than a couple snapshots. To be honest the issue is that I would like to be able to move this data to another server as an experiment and want the backup files in a form that I can use to rebuild OpenEMR on other platforms. Have not patched it yet. Hopefully this afternoon. Thanks to all.