Creating Armada service.

If you went through Getting Started series, you should already have a feel for how to operate services on Armada. In this guide we will show what is needed for the service to run on Armada smoothly and what problems Armada helps to solve.

There are only a handful of steps needed to adapt your existing service to run on Armada. If you want to create a service from scratch the easiest way is to use one of our templates, like:

$ armada create my_fancy_service -b python

That way most of the steps are already done and you can focus on adding new functionalities to the template service. Just as it has been described in Getting Started - Building services part.

But because we want to learn more about Armada, we will go the "harder" way. We will assume that we already have a running service (or just its foundation) and want to run it on Armada. As an example we will use service coffee-counter which purpose is to count number of coffees drunk by its users. It is written in python using simple framework:
from collections import Counter import web import json coffees = Counter() class Drink(object): def POST(self, user, count): coffees[user] += int(count) return "{0}'s coffee count is now {1}.\n".format(user, coffees[user]) class Report(object): def GET(self): return json.dumps(coffees) def main(): urls = ( '/drink/(.*)/(.*)', Drink.__name__, '/report', Report.__name__, ) app = web.application(urls, globals()) if __name__ == '__main__': main()

You can run services written in almost any language or framework on Armada and the instruction for "armadizing" it will be similar to the one described in the next chapters.