My go at deploying to the cloud, EC2. It’s not *that* easy

November 16, 2009

I don’t have much server background, and probably its a lot easier to set up your servers with amazon EC2 than setting them up yourself or at other hosting solutions. I don’t care, it really annoys me that everybody claims how easy it is, showing you how to launch an instance in a minute. Yes, thats really easy, but you quit too abruptly. Nobody wants to set up an instance, then terminate it and lose everything you did on that instance. I say, never press terminate, you will lose every change from the last ami save. You are warned, be prepared or waste a lot of time.

Read on for links an tips for the whole cycle of launching, changing, saving and registering AMI. Everybody deploying to EC2 really have to do all this as a part of setting everything up, being prepared to launch more instances of the same kind.

Read the rest of this entry »


Part 2: local clients pushing data to local server with RESTful web services

November 13, 2009

It’s really easy! But only when you know how! Like most stuff is. I was completely confused at the beginning. What does RESTful web services mean? It’s just a convention. You access the web services almost as you would access using a browser.

  • /products gives index.html with products
  • /products.xml renders the xml with products
  • /products/1 renders the show.html of product with id 1
  • /products/1.xml returns product with id 1 as xml
  • and so on. That’s RESTful

If you are using rails, you follow its convention of a controller with the methods index, show, new, create, edit, update, destroy.

To post data to a RESTful controller, you perform a POST to mydomain.com/myobjects.xml with a xml file. Using httparty, it’s like this

post('/diagonses.xml', :query => {:diagnose => { :time => time,
                                    :diagnosis => 'RESTfully in love'}}})

Creating a RESTful Web Service Client

Read the rest of this entry »


Part 1. Deploying to experimental, :at => local

November 11, 2009

I’d like to share my workflow, as it has proven efficient for me. I’m running two ’servers’ locally (!). Hang on, I said it was efficient, even though it surely doesn’t sound like it. The workflow should gain teams of any sizes, in my opinion.

I am developing an app it in rails and it also exposes some RESTful web services,  with_feed :through => :third_party. The third parties aren’t necessarily third parties, as we develop these too, but they are external apps collecting and sending data to my app. Part 2 will cover the creation of dummy clients that send randomish data to the core app.

OK, I will share the script and procedure I did to have a running server locally alongside developing my app. I wanted to have the server running locally, being able to receive request to the web server, testing the app manually, fast. To distinguish this local server (say localhost:3001) from your development server (sat localhost:3000), I decided to name it experimental, for simplicity. This is my workflow cycle

  1. developing, creating migrations and so on, running mongrel at localhost:3000
  2. git commit -am “I commit small changes, often!”
  3. back_to step 2 if more_should_be_done
  4. relaunch experimental server at localhost:3001, continuously receiving WS requests.

git pull and git push is performed frequently as well, but not as frequent as the above.

Read the rest of this entry »