So after reading about the unscheduled downtime of Amazon S3 yesterday I thought that I should probably release what I’ve done so far. Although most of the work I’ve done has been focused on the storage layer and writing many many tests for it. So last night I spent a few hours hacking in functionality into what will be the REST layer of the service mostly from a PHP S3 Client to provide a very basic service to show what I’ve been doing – mostly handcrafted responses; although I’m probably going to the the pecl http extension to handle most of this in the future
This isn’t really up-to what I’d call alpha ‘quality’ in any respect, but it’s just a sneak peak with many many cavets i.e.
Anonymous authentication doesn’t work at all (you need an authenticated user for all method calls)
Only putBucket, deleteBucket, putObject, getObject, deleteObject have been partially implemented, although most methods are implemented at the storage layer.
Many many things need to be re-factored
Exception handling isn’t fully implemented yet
The REST layer has no tests and the SOAP layer hasn’t been started yet
You need the (PECL) PDO MySQL extension added to PHP (and probably some other PEAR libraries like Crypt/HMAC)
No documentation yet, but I’m willing to help with any questions
You need to be able to edit the httpd.conf for apache to enable PUT and DELETE http verbs*
If your running PHP as CGI then you may need to modify my .htaccess (well maybe?)
You need to create your own user using createUser in the storage class (but I’ll add a script into the subversion to help with this)
Security hasn’t been tested and the code is not optimized in any way
Plus some other stuff that I may have forgotten because I’m tired
You may have got the impression that I’m not entirely satisfied with this code yet and you’d be right. I’m only releasing this as *some* people *may* find it interesting. And one final thing, I don’t have a Amazon S3 account, I’ve basically cobbled this together from the documentation (which can be inconsistent), because I read the T&C’s and I wasn’t sure if Amazon would sue me if I agreed to them, so I didn’t!
Also you’ll need to create a mysql database, but the database details are hardcoded into the src/s3/lib/storage.php file and test/AbstractTest.php for unit tests.
So … blah, blah … it might not work … blah, blah … give me a break and i’ll help you ….. blah, blah …. I won’t be able to do any more work on this for one week before I start again … so here is the SVN URL ….
On the positive side of things, when I do get time next week to continue working on this project the hardest parts of the project have been thought about or have already completed, so implemented the REST and SOAP layers shouldn’t take along as I did implementing the storage layer.
* You need to modify your httpd.conf to allow PUT and DELETE http verbs by including these commands in your htdocs <DIRECTORY> tag (Apache doesn’t allow PUT or DELETE http verbs by default for sensible security reasons)
Script PUT /workspace/s3server/src/index.php
Script DELETE /workspace/s3server/src/index.php
Where the index.php matches where you (relative to your htdocs path) checked out the code.