Driving Behavioral Change for Information Management through Data-Driven Gree...
Telephony with OpenShift Twilio and MongoDB
1. Telephony Applications
with
MongoDB,
OpenShift,
& Twilio
Mark Atwood
Developer Evangelist for Red Hat
OpenShift
me@mark.atwood.name
Twitter @fallenpegasus
2. What is OpenShift?
Red Hat cloud Platform as a Service
Free as in beer, Free as in speech
Languages: Python, Java, Ruby, Node, PHP, & DIY
Storage: Filesystem, MySQL, Postgres, MongoDB
No lock-in, no proprietary APIs
Sign up at http://openshift.redhat.com
Promo code SEATTLE
2
3. What is Twilio?
A cloudy API for telephony
REST interface to the PSTN: Voice & SMS
Pay by the drink
3
4. How Twilio voice works
Someone calls the number
Twilio answers the phone
Twilio does HTTP REST to our app
Our app replies with some "TwiML"
Twilio does what the app told it to
Twilio or the caller hangs up the phone
4
5. How Twilio SMS works
Someone texts to the number
Twilio receives the text & all metadata
Twilio does HTTP REST to our app
Our app replies with some "TwiML"
Twilio does what the app told it to
5
6. What is MongoDB?
If you have to ask that, you shouldn't be here!
Easy to use JSONic Document Store
6
7. What is Python & What is Bottle?
My favorite programming language
My favorite web framework
Supported by OpenShift
Drivers for MongoDB & for Twilio
7
8. A simple app: SMS Group
SMS group chat
http://github.com/fallenpegasus/openshift-smsgroup
+1-XXX-XXX-XXXX
SMS .join to join
SMS .leave to leave
8
9. Glue it all together
Get an OpenShift account
Get a Twilio account
Spin up "smsgroup" app in OpenShift
Attach it to your Twilio account
Play!
9
10. Agenda for Demonstration
Look at the app at twilio.com
Look at the app at openshift.com
SSH into the app
Port forward from local to remote MongoDB
Run local MongoDB clients
10
12. Some useful software design guidelines
Let the language, the libraries, & remote services do the
boring work
Don't keep state in the app, use a data layer
Use queuing to smooth load
12
13. Don't keep state in the app
Keep it in the data layer instead
OpenShift might restart or scale the instance at any time
Don't waste time keeping complex data in the instance
Don't try to write your own database server
13
14. Don't keep state in the app
Keep it in the data layer instead
OpenShift might restart or scale the instance at any time
Don't waste time keeping complex data in the instance
Don't try to write your own database server
MongoDB is an excellent solution
14
15. Use queuing to smooth the load
Don't depend on "their" capacity
Getting local storage quickly is easier than provisioning
more CPU, IO ops, or network bandwidth
15
16. Use queuing to smooth the load
Don't depend on "their" capacity
Getting local storage quickly is easier than provisioning
more CPU, IO ops, or network bandwidth
And it's cheaper
16