Playing with Panda without SimpleDB account
If you are interested in trying out panda without getting a SimpleDB account we’ve got good news for you!
There are currently 2 simpledb like tools at this moment(as far as I know). They won’t be for production use, but should be enough to play around or use it for development purpose.
- simplerdb = Ruby implementation.
- simpledb-dev = Python implementation
I initially tried simplerdb, but found that the implementation is not complete, therefore not suitable for Panda use. Also it’s an in-memory db, so the data will be lost every time you stop simplerdb.
I then tried simplerdb-dev(the Python one). simpledb-dev stores data on file systems, so you don’t need to worry about losing data every time you stop simpledb-dev. However, EC2 vapors every time you restart the instance, so you still need to use
Amazon Elastic Block Store to keep your data.
Here are the quick steps to use simpledb-dev at Panda. Please give a try and let me know if you find any issues. If people find this solution useful, I will add simpledb-dev into next AMI release image, and also update the documentation.
-
Setup simplerdb-dev on your EC2 instance.
#You can skip this part if python version is already 2.5 apt-get update apt-get install python2.5-dev rm /usr/bin/python ln -s /usr/bin/python2.5 /usr/bin/python # This step is to install easy_install, Python equivalent of Gems. # If you are installing Panda locally on your machine (I only tried on OSX Leopard), # you may already have easy_install, so you can skip it. curl -O http://peak.telecommunity.com/dist/ez_setup.py python ez_setup.py # Installing Web module easy_install web.py # Downloading simpledb-dev wget http://simpledb-dev.googlecode.com/files/simpledb-dev-0.1.5.zip unzip simpledb-dev-0.1.5.zip cd SimpleDB-Dev/ cd src # Starting simpledb_dev server python simpledb_dev.py 8087 (can be any port number.). Open up another terminal, and follow up to “Configure Panda” section of Getting Started guide
-
Override simpledb url, before “Create S3 buckets and SimpleDB domains” of Getting Started guide. Add the following line at the beginning of config/aws.rb file of Panda
Amazon::SDB::Base::BASE_PATH = 'http://127.0.0.1:8087' -
Continue “Create S3 buckets and SimpleDB domains” of Getting Started guide. Once it’s all done, confirm via console that you can connect to simpledb-dev
$cd /var/local/www/panda $merb -i ~ Loaded DEVELOPMENT Environment... ~ loading gem 'merb-assets' ... ~ loading gem 'merb-mailer' ... ~ loading gem 'merb_helpers' ... ~ loading gem 'uuid' ... ~ loading gem 'to_simple_xml' ... ~ loading gem 'rog' ... ~ loading gem 'amazon_sdb' ... ~ loading gem 'simple_db' ... ~ loading gem 'retryable' ... ~ loading gem 'activesupport' ... ~ loading gem 'rvideo' ... ~ loading gem 'panda' ... ~ loading gem 'gd_resize' ... ~ loading gem 'map_to_hash' ... ~ loading gem 'spec_eql_hash' ... ~ loading gem 'error_sender' ... ~ Compiling routes... ./config/aws.rb:1: warning: already initialized constant BASE_PATH ~ Starting Merb server listening at 0.0.0.0:4000 irb(main):001:0> Amazon::SDB::Base::BASE_PATH => "http://127.0.0.1:8087" irb(main):002:0> User.query => [#<User:0xb71fda08 @key="admin", @new_record=false, @attributes=#<Amazon::SDB:: Multimap:0xb71fd9e0 @size=nil, @mset={}>>] irb(main):003:0> Profile.query => [#<Profile:0xb71dc1c8 @key="561e38b0-706e-012b-b437-123138002d32", @new_record=false, @attributes=#<Amazon::SDB::Multimap:0xb71dc1a0 @size=nil, @mset={}>>, #<Profile:0xb71dc1b4 @key="562ef420-706e-012b-b437-123138002d32", @new_record=false, @attributes=#<Amazon::SDB::Multimap:0xb71dc164 @size=nil, @mset={}>>, #<Profile:0xb71dc18c @key="56101ea0-706e-012b-b437-123138002d32", @new_record=false, @attributes=#<Amazon::SDB::Multimap:0xb71dc128 @size=nil, @mset={}>>, #<Profile:0xb71dc150 @key="5621fa70-706e-012b-b437-123138002d32", @new_record=false, @attributes=#<Amazon::SDB::Multimap:0xb71dc0ec @size=nil, @mset={}>>, #<Profile:0xb71dc114 @key="56dd8600-706e-012b-b437-123138002d32", @new_record=false, @attributes=#<Amazon::SDB::Multimap:0xb71dc0b0 @size=nil, @mset={}>>]
Enjoy