Speakers:
Patrick McClory - Solutions Architect, RightScale
Patrick Moore - Operations Manager, Koupon Media
Gordon Bailey - Lead Infrastructure Engineer, Koupon Media
RightScale offers a robust REST-based API and, while it is available to all, having platform-specific clients certainly helps in the process of consuming and working with any given programming interface. We’ll demonstrate the RightScale .NET API 1.5 wrapper project with a few examples of how it can help to automate your process, integrate with existing tools, and even make your life easier when implemented within your daily operating applications.
Integrating RightScale, Windows, and .NET for Fun and Profit - RightScale Compute 2013
1. april25-26
sanfrancisco
cloud success starts here
Integrating RightScale, Windows and
.net for Fun and Profit
Gordon Bailey, Director of Technology/IT | Koupon Media
Patrick Moore, Director of Operations | Koupon Media
Patrick McClory, Solutions Architect | RightScale
2. #2#2
#RightscaleCompute
Agenda
• API 1.5 Overview
• RightScale.netClient Intro and Overview
• Demos…
• MSBuild and Dev/Test in the cloud
• Advanced PowerShell Management with RightScale + API 1.5
• PHB Demo
• Insight from KouponMedia
3. #3#3
#RightscaleCompute
RightScale API 1.5
• REST API with JSON and XML response types
• RightScale core functionality exposed
• http://reference.rightscale.com/api1.5/index.html
5. #5#5
#RightscaleCompute
RightScale.netClient Overview
• Generic wrapper for the RightScale API 1.5 toolset
• Media Types = Classes/Object Model
• Resources = Static methods per class
• A couple of assumptions made:
• Generally, resources map to media types 1:1
• For Resources with multiple urls, more descriptive names are better:
• Instance.index() and Instance.index_ServerArray(serverArrayId)
7. #7#7
#RightscaleCompute
Use Case/Scenario
• We‘re running a .net shop using Team Foundation Services
2012 (TFS) for source control
• Standard web application being developed
• We‘ll use the Mileage Stats demo app
• Slightly modified to use Microsoft SQL Server instead of SQL CE
• DB Backups and scripts available for download
• Application is nearing time to be released to production
• Ability to test in multiple environments rapidly is critical
• Build from local consistently with how production builds are
created
12. #12#12
#RightscaleCompute
Resources
• Source code for reference app in github
• Team Foundation Server or another MSBuild orchestration
utility like CruiseControl.net or TeamCity
• Web Deploy 3.0 installed on all machines packaging builds
• RightScale Support page on MSDeploy
• Some more detail in another blog post
14. #14#14
#RightscaleCompute
Use Case/Scenario
• Familiar platform for Windows Sysadmins
• Leverage RightScale within other automation processes already
scripted
• Manage our Dev/Test Environments from the MSBuild Demo
• On the way out the door—let‘s make sure we tear the instances down
• Build a scheduled task to stand them up again in the morning with the
latest stable build
17. #17#17
#RightscaleCompute
Resources
• Cmdlet code is in Github
• Also builds a package as a part of the post-build events on the
RightScale.netClient solution
• PowerShell API direct call examples on support.rightscale.com
• Will give you examples from curl, PowerShell and sometimes the
RightAPIClient ruby gem
• Other PowerShell references
• ss64.com/ps
• http://www.microsoft.com/en-us/download/details.aspx?id=7097
• http://www.jonoble.com/blog/2011/12/12/powershell-quick-reference-
guides-and-cheat-sheets.html
19. #19#19
#RightscaleCompute
Use Case/Scenario
• Disclaimer: this is not a serious demo
• Let‘s explore a bit of what‘s possible now that we have a
common hook within the .net Framework (v4.5)
• Taking a little inspiration from ‗Wally‘:
• Let‘s figure out the craziest way to enable laziness
• Need to not loose our jobs either—we‘ve got to get some work done
• Goal: Whenever the boss is on the way, let‘s do something that looks
impressive
21. #21#21
#RightscaleCompute
Really going out of our way to ‗not work‘
• We‘ve built a motion detector using a netduino and a few other
parts:
• Netduino Plus 1
• HC-SR04 Ultrasonic Distance Sensor
• Microtivity IM 161 LCD display
• HC-SR501 Human Sensor Module
• Wireless network bridge
• Some code to make it work
• A .net Micro Framework console app to drive the sensors and logic
• Netduino SDK 4.2.2
• Netduino Plus 1 Firmware Upgrade to 4.2.0
• A small service application to take input and do that ‗something‘ we need
to be doing (i.e. launching a 3-tier stack for a developer)
26. #26#26
#RightscaleCompute
Operations Maturity
• PAST – where we came from
• Too long, too many doing too little, too much
• Time
• Servers
• Cost
• PRESENT – what we realized
• Do more with less
• Small company embracing cloud, mobility, and social solutions
• Scalable solution
• Easier, Efficient, Faster
• FUTURE – how we can get better
• Visibility for all
• Never enough mentality
27. #27#27
#RightscaleCompute
RS Professional Experience
• Learning to ride a bike for the first time
• Training wheels, helmet, knee pads, elbow pads
• Confidence comes from within…. AND those teaching us
• Deployments, templates, scripts oh my!
• ―Give a man a fish and you feed him for a day. Teach a man to fish and
you feed him for a lifetime.‖
• Not just a face in the crowd
• Personal, day-to-day service
• ―People work with people they like‖
• http://www.rightscale.com/about_us/top-ten-myths-about-working-at-rightscale.php
28. #28#28
#RightscaleCompute
Factual Results: time & money
• Actual results of all the who-ha
• How much was our time worth?
• Connecting time & money
• Realizing where you need to adjust in order to grow
• Spending what you need to not what you think you need to
29. #29#29
#RightscaleCompute
Factual Results: time & money
• Time: sometimes the easy way is the Right way
• PAST: 2-3 hours
• Manual
• Tedious
• Human error
• PRESENT: 45 mins – 1 hour
• 4 steps
• Consistent
• FUTURE: 25 mins flat (our new PR goal)
• Quick, easy, efficient
30. #30#30
#RightscaleCompute
Factual Results: time & money
• Cost: cutting branches off the money tree
• PAST: X servers costing $x.xx / month
• Not utilizing full to even quarter of server capability
• Not utilizing all of an already paid for service
• PRESENT: Y servers cost = X servers cost
• Fully customizable templates, scripts, servers
• Utilizing more and more of a server / service
• MSDN - Scheduler
• FUTURE:
• Not taking the shortcuts but understanding what we need compared to what we want
31. #31#31
#RightscaleCompute
Contact Info
• Gordon Bailey
• gbailey@kou.pn
• Patrick Moore
• patrickm@kou.pn
• Patrick McClory – Solutions Architect
• patrick@rightscale.com
• @patrickmcclory
• http://www.linkedin.com/in/patrickmcclory
• https://github.com/patrickmcclory/
34. #34#34
#RightscaleCompute
RightScale.netClient status
• Still in Alpha – not feature
complete/parity with API 1.5 – 14
Resources to complete
• Demo-ready, feedback welcome, but
not production complete as of yet
• Published on nuget and available on
github
• Lots of functional tests for existing work
within a unit test project – dependent
on some specific setup, but designed
to test functionality
37. #37#37
#RightscaleCompute
Class Design
• Generic
RightScaleObjectBase<T>
• Derived base class for
taggable objects
• Will likely expand as
development continues to
manage globally used
concepts
• Tags
• Actions
• Other property-level items
Base Class Management
• Centralized logic for all API
calls
• Cached authentication
mechanism for all calls
within the same application
scope
• One and done
Singleton for Web Client
38. #38#38
#RightscaleCompute
RightScale.netClient.Base Classes
• RightScaleObjectBase<T> handles generic
properties and actions
• Type parameter is required to manage serialization and
deserialization of JSON objects
• Handles single and list deserialization
• Centralized place to parse and manage links collection
• TaggableResourceBase<T>
• For objects that are able to receive tags—separate base
class derived from RightScaleObjectBase<T>
39. #39#39
#RightscaleCompute
RightScale.netClient.Core.APIClient
• Single point of interaction for all HTTP methods
• Handles username/password/account number or
OAuth authentication for API 1.5
• Automatically authenticates if not already
authenticated
• Auth information can be sored in
app.config/machine.config under specific keys
Singleton Implementation for API Caller