Restore Virtual Server from Command Line via S3 bucket

Hi there,

I’d read through these

https://www.virtualmin.com/documentation/developer/cli/restore_domain

https://www.virtualmin.com/node/22584

I have an S3 bucket with a few backup virtual servers files in tar.gz format (they’d grown to very big)

I’d tried to restore via Restore Virtual Servers on the Webmin/Virtualmin php interface but it kept timing out after I clicked the button “Show What Will Be Restored”

So, I tried using the command line instead. This is the command I’d used…

virtualmin restore-domain --source s3://accesskey:secretkey@bucket --domain mydomain.com --all-features --reuid --all-virtualmin

And I’d gotten the following error message in the cli

=== start of error message ===

Checking for missing features …
… all features in backup are supported

Checking for errors in backup …
… no errors found

Starting restore…
Downloading archive from Amazon S3 server …

… download failed! No backup file for virtualmin was found on S3.

Restore failed!

=== end of error message ===

What am I missing? If I have to put in the backup.tar.gz filename, where do I put it in the command?

I’m running Ubuntu 14.04.1 running PHP 5.5.9

Thanz for your guidance!

Anyone knows how to do it via command line? Please advise!

Hi,

Yes, you can restore from an “S3 bucket” using the command line interface (CLI) for Virtualmin.

Instructions can be found at:

https://www.virtualmin.com/documentation/developer/cli/restore_domain

Best Regards, Peter Knowles TPN Solutions

Email: pknowles@tpnsolutions.com
Phone: 604-782-9342
Skype: tpnsupport
Website: http://www.tpnsolutions.com


Ask me about my new support plans which include a FREE copy of Virtualmin Pro!!!

Hello tpnsolutions,

If you’d read my OP, I’d already mentioned the very same page/URL you’re repeating. Please read my question carefully.

Thanz

Hi,

My apologies, was probably half asleep when I wrote my original response.

As I understand it, a “bucket” in the “S3” world has files within it… Something like (if memory serves me correctly) “bucket/filename”… so if you specified only the actual “bucket” it likely failed because you didn’t specify a file within that bucket.

Best Regards, Peter Knowles TPN Solutions

Email: pknowles@tpnsolutions.com
Phone: 604-782-9342
Skype: tpnsupport
Website: http://www.tpnsolutions.com


Ask me about my new support plans which include a FREE copy of Virtualmin Pro!!!

Thanz tpnsolutions,

I already knew that.

What I’m asking is in the OP… the man page does not specify in anyway to specify the exact file. It only specify the bucket as a source… but how to point to the file?

Initially the command line was failing with this:

     could not find ParserDetails.ini in /usr/local/share/perl5/XML/SAXmodule

Had to install

          XML::LibXML and LibXML::Parser to fix that - 

From there I was having similar problems - and my mistake was that I used the directory name in the bucket, rather than the bucket\directory name combination. Command line is now:

virtualmin restore-domain --source s3://:@<bucketname/directory-IN-bucket> --domain --all-features --reuid --all-virtualmin

Now I get this…

Checking for missing features …
… all features in backup are supported

Checking for errors in backup …
… no errors found

Starting restore…
Downloading archive from Amazon S3 server …
… done

Extracting backup archive files …
… done

Restoring backup for virtual server …
Restoring virtual server password, quota and other details …
… done

Updating administration password and quotas ..
.. done

Restoring Cron jobs ..
.. done

Extracting TAR file of home directory ..
.. done