WebPagetest Forums
Restoring archives from S3 - Printable Version

+- WebPagetest Forums (https://www.webpagetest.org/forums)
+-- Forum: WebPagetest (/forumdisplay.php?fid=7)
+--- Forum: Private Instances (/forumdisplay.php?fid=12)
+--- Thread: Restoring archives from S3 (/showthread.php?tid=12477)

Restoring archives from S3 - dcross-rea - 08-16-2013 09:41 AM

I have built up a private instance using CloudFormation, with archiving to S3.

This is working well, but I want to be able to blow away the EC2 Server instance, recreate and restore from the archive.

Is there functionality built into WebPageTest to do this? I can't find much about this and the zip looks simply like the contents of individual tests from /results/ (without recursive dirs)

Any help greatly appreciated, at the moment I have hacked around it by using an EBS volume as a www mountpoint.


RE: Restoring archives from S3 - pmeenan - 08-17-2013 12:12 AM

If the tests are archived to s3 you should be able to bring up a clean new instance (with nothing in results/) that has the same s3 archive config and it will automatically restore any tests as they are accessed.

RE: Restoring archives from S3 - dcross-rea - 08-19-2013 05:07 PM

Hrm. Sounds straight-forward, yet how are they 'accessed'. I browse to results-history and there is nothing in the list after recreating the instance with the same S3 settings. New .zips appear in the bucket when I run a test.

I was wondering if it had anything to do with trying to do a dir style listing over https. Testing with links I can retrieve a zip, but get access denied when trying to load the base URL. I think however that this is a feature of s3 and you would simply be making API calls to s3 yeah?

My settings.ini looks like:


In the meantime I will go off and browse the source to try to work this out. Thanks Wink


I have also tried writing the URL to http://webpagetest:8888/result/130812_PT_1/ where 130812_PT_1.zip exists on the s3 bucket and can be retreived using wget, which brings me to a 'test not found' page.

I am bringing down version 2.12.

OK, I just looked at the source and found that archive_s3_url should be the base url, and does not include the bucket name. Corrected this and now results are displayed upon requesting them in the url.

This leaves the desire to still have these listed in the results history. My work around at the moment is to mount logs/ on an EBS volume. Any suggestions of a nicer way much appreciated.

RE: Restoring archives from S3 - pmeenan - 08-24-2013 08:35 AM

Sorry for the delay. You are correct, the logs don't get archived right now. I've generally considered the logs to be lossy but I'll see if I can think about any way to get them archiving cleanly as well.

RE: Restoring archives from S3 - dcross-rea - 08-27-2013 05:53 PM

To archive logs to s3 I ended up basically copying some of your code and hacking it into archive.inc at line 94:

$targetDate = new DateTime('now', new DateTimeZone('GMT'));
$logfileName = 'logs/' . $targetDate->format("Ymd") . '.log';
$s3->putObject($s3->inputFile($logfileName, false), $bucket, $logfileName, S3::ACL_PUBLIC_READ, $metaHeaders, $requestHeaders);

I am actually using Python's boto to drive, which takes care of restoring the logs with cloudformation. I'll hopefully have this up on github in coming days.

RE: Restoring archives from S3 - phedenskog - 08-25-2015 07:45 AM

Did you have time to add something for archiving the logs to S3? Would love that functionality Smile