Jump to content
  • 0

S3 Backup


Qurius

Question

Hello -

 

I've setup backup to use S3 and and it tests out fine. I can force an offsite backup and that works fine with the backup showing in the correct S3 bucket. I have it set for a weekly backup and the cron job notification email shows that the S3 backup successfully completed (see attached) but that weekly backup doesn't show in the S3 bucket. Looking at the cron logs in Blesta for that day's cron job does not show any backup being run. I'm lost at this point on how to get this to work.

 

post-11666-0-22821100-1448125477_thumb.p

 

Thanks for any help.

Link to comment
Share on other sites

9 answers to this question

Recommended Posts

  • 0

Since your cron log contains the message "The backup completed successfully", the backup was triggered with AmazonS3, uploaded to your bucket, and produced no errors (i.e. it was successful). There is no difference between an automatic backup and a forced backup, so it is odd that the backup would not appear in your bucket when run via cron when the log indicates it was successful. Is it possible that it is in the bucket, but not visible? Or that it is in a different bucket than the one you were looking for it in?

Link to comment
Share on other sites

  • 0

I looked at the logs in Tools->Logs->Cron and everything matches to the emailed log up to the point where it says "Attempting to run all system tasks.". Everything after that including the S3 section doesn't show anywhere in the logs that I can find. I ran the forced backup several more times and it is consistently putting it in the right bucket and I assume that the cron job wouldn't be any different?  I'm going to change it to a daily backup in the S3 config and see if it makes any difference.

 

If you can think of anything else I may have missed let me know.

 

Thanks

Link to comment
Share on other sites

  • 0

I believe the cron logs under [Tools] -> [Logs] -> [Cron] only shows company-related automation tasks, not system tasks like Amazon S3 and SFTP backups. However, you can check the database to see when that task has run (via cron, not when manually forcing an upload) by checking the `log_cron` table. For installations with one company, the task `run_id` for Amazon S3 backups is 14, so you can list each record of Amazon S3 via the following query:

SELECT * FROM `log_cron` WHERE `run_id` = 14 ;

If you don't see the records you expect after running that query, it could be possible that another task has failed to run, possbily causing a PHP fatal error, stopping task executions. If that is the case, you should check your automation tasks under [settings] -> [Company] -> [Automation] and look for a task that is still running (denoted by a spinning icon). You could also run this query to check.

Link to comment
Share on other sites

  • 0

The `log_cron` table shows exactly the same output - that it completed successfully. I've set it to do a daily backup and the backup still is not showing in S3. All the company related tasks complete successfully (nothing is hanging in the [Automation] section).  I ran the forced offsite backup again this morning and it shows up immediately in the correct bucket. Is there a more detailed system log other than just the cron job output?

 

Thanks

Link to comment
Share on other sites

  • 0

There are no other logs in Blesta that could be checked, so the next step would be to either check server logs (which probably contain nothing of relevance), or analyze the point a request is made to Amazon S3 and look at the request and subsequent response details. You could do this by checking packets sent/received on your server for requests to s3.amazonaws.com, or update the source in /vendors/amazons3/S3.php for the putObject method to manually debug.

Link to comment
Share on other sites

  • 0

Question -- does the cron send SFTP backups, but not Amazon S3 backups, or neither?

Blesta uses the mysqldump binary to perform a dump of the database prior to sending it to S3 or the SFTP destination. If your CLI version of PHP does not have permissions to execute mysqldump, or it's not in the system path, then that could be the cause of all of this.

 

To test, you can SSH in as your cron user, and type "mysqldump"  or "whereis mysqldump".

Link to comment
Share on other sites

  • 0

Tyson -  There's nothing in the logs that's relevant. Not sure I have the time or expertise to do packet sniffing :unsure:. I'm curious what triggers/populates the `log_cron` table with success/failure (an error code?). Does it check if the file exists on S3?  

 

Paul - I don't have SFTP backup setup...I'll see if I can get it set that up and test. Doesn't the forced backup use the same mysqldump command.

Link to comment
Share on other sites

  • 0

Paul - I don't have SFTP backup setup...I'll see if I can get it set that up and test. Doesn't the forced backup use the same mysqldump command.

 

Yes, but there's a difference. Your web server is executing it, vs cron. If the issue is executing it via cron, then your cron user may not have proper permissions or access to the mysqldump binary whereas your web server does.

Link to comment
Share on other sites

  • 0

 

Blesta uses the mysqldump binary to perform a dump of the database prior to sending it to S3 or the SFTP destination. If your CLI version of PHP does not have permissions to execute mysqldump, or it's not in the system path, then that could be the cause of all of this.

 

SSH in under the same account and ran mysqldump with no errors (returned the usage commands)...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...