python 2.7
twisted-15
requests library
an internet facing linux server for testing.
I always get asked by people, what is this cloud computing fiasco and how do it affect me?
This tutorial is aimed at demystifying from the programmer's prespective and the Network Admin's prespective what cloud computing is.
We will start off with a program that runs without "cloud" and then a program that is "cloud".
Local Program:
a local program is a software where all processes run on the computer the program was launched from.
a simple local program:
This print program runs all processes on your computer and hence is a local program.
Now you might ask the question, what if the program makes a network connection?
In a networked program, you can write a client, but still not be a cloud program.
example:
Even though we make a network connection, the server we connect to is passed as an argument. making this in my opinion not a true cloud program.
However, if you create a client that connects to a http REST API,
with this facebook example:
import requests
r = requests.get('https://graph.facebook.com/oauth/access_token?grant_type=client_credentials&client_id=123&client_secret=XXX')
access_token = r.text.split('=')[1]
print access_token
you have created a client that interfaces with a Internet facing service., as the provider (Facebook) has to verify your identity and return the OAUTH access token.
What does this make cloud computing?
Cloud computing is NOTHING MORE than a buzzword for software where part of the process is run on 1 or more internet facing servers provided by the vendor of the software.
When you think about it this way, that means AOL, XMPP, Slack, IRC all work the same way, IM software is likely the oldest of "cloud systems."
So, How does one write a simple cloud based software?
First we write a simple message server, we will use the twisted matrix examples and expand on those:
The above should be run a TEST VPS,not your home or production systems.
this is a matching client:
and you will see that we are communicating from one client over the internet to ALL of the connected clients on the internet facing server.
at this point we have very basic internet based chat software. In my opinion this really is not yet a SAAS platfrom, as SAAS uses authentication not only for security, but to deliver the right information to the right person.
If you were to add a sqlite database with some basic authentication into the server and some handlers, then you would have the start of an SAAS application, and you could tweak the above code to literaly make anything you want.
I do not intend to post code for the authentication at this time. That I leave to you neophyte