Yesterday I wrote an article highlighting how to use attr_encrypter and it was for this app. I made a video so not much text is needed. But this highlights using encryption, UUIDs with ActiceRecord, AJAX calls to a Rails controller, and some jQuery magic. You can access the application at http://vcloudairvms.cfapps.io/
Yesterday, I built out a small ViPR instance in my home lab using Virtual Isilon to start messing with the APIs. I wasn't really planning on showing this particular API because I'm wanting to play with a different set of APIs, but I figured I would take the time and show a ruby example of using the ViPR REST API. REST is awesome. Flat out. I spent part of yesterday trying to decipher the vSphere APIs with Rbvmomi and got completely lost. REST is BEST.
This ruby script is pretty simple. We are going to use the rest-client and JSON gems to fetch some information and parse it. The script will log in, spit out information about every vCenter instance, display host information for each vCenter instance, and display ViPR Service Statistics. I don't have anything configured just yet for storage, but the ViPR REST API is incredibly easy to use.
The World Cup is in full swing and While watching the Brazil v Chile game yesterday I figured I would play around with the unofficial World Cup API. You know the saying "if you don't use it, you lose it"? Well, it seems very true for me when it comes to coding. It seems like I have to constantly re-teach myself things when I don't code for a month or so. On with the fun.
I filed this under rails projects, but it's really just some ruby code...
I set a goal for myself to become familiar with the vCloud Director APIs using REST. Mainly to see how long it would take me to automate my first task and prove to myself I can do it. Well, I'm pleased to say that it's alot easier than I thought. I had a new vCloud Director instance installed on Monday, and by Wednesday morning I was just finishing up my code. So within 2 days I was doing some automation tasks and it really wasn't that hard. It gave me a chance to work directly with the API using the rest-client and nokogiri gems. A total of 200+ lines of ruby code all together
1st: NewOrg.rb This will create a new Organization based on the parameters specified in the XML. Relies on the new_org.xml.
2nd. NewOrgVDCandServices.rb (not completely working) This will create a new Organization VDC based on parameters specified at the beginning of the Script. It also uses 3 XML files for the POST input parameters. After the Organization vDC is created, then deploy a vShield Edge Gateway appliance to the newly created OrgVDC. Wait 120 seconds after deployment, then configure 2 new services are created on the Gateway appliance:
A default firewall rule to allow all internal traffic to pass to anything external
A SNAT rule to allow internal traffic to speak on a NATed address externally.
I've been working on this project for about 1.5 months and I'm very happy that I can finally share it.
So... what is a JumpSquare? Let's start off with Why...
We've all been there before:
You start a new job and have no idea where anything is located
A contractor comes on site and you have to point them to every application
You are constantly sending emails asking where an application has been installed because you never bookmarked it
You have a very large datacenter environment and can't remember all the virtualization, storage, and network addresses
There may be 100+ different applications in your environment and you want to keep track of what's out there.
Maintaining excel documents or sharepoint sites suck
Browser bookmarks can be messy if you have a lot of them
The idea spawned because I had trouble keeping track of 6 VMware environments in our lab. Within those 6 environments, there were 100+ applications consisting of multiple vSphere Web Clients, vCOPs, vClouds, physical assets like switches and arrays. Bookmarks would have been messy and I got tired of sending emails trying to figure out what servers hosted which applications. I got a non-persistent desktop to access the lab environment so bookmarks didn't stick (don't ask why they can't figure that out), plus those bookmarks are only personalized for me. So if someone goes and installs vCOPs for POD3, I have to go to the web client, open it up, search for the IP address, then try and guess to see if i can remember the port or slew of /'s to find the login page. There had to be a better way.
I'm pretty excited to release this and make one long blog post out of it. This is not my usual blog posting topic, but this is a good place to keep it so I can maintain it. I'm a pretty big halloween nut, like really big. check out some pictures from 2012 Halloween.
Last year, I caught wind of the MonsterShield prop controller. For about $200, you can have a prop controller that can control 16 relays, have 15 different animations, with MP3 cd quality audio, that also has an API. I was completely sold. Over some talk with Jason (the creator of the MonsterShield), I wanted to build something that I could use to trigger the animations that I want. I run a yard haunt, and with over 10,000+ people that come around to see the Halloween decorations on the street, I can't use traditional triggers. Motion detectors means they would be going off constantly. And having it timed means I won't have the correct animations set off for specific parts of the yard depending upon where people are standing. I could use multiple prop controllers, but I like centralization. With 16 relays, I can control everything in my yard from a single spot, so I had to figure out the best possible way to trigger the animations I want to see. This way my wife and I can sit on the porch, drink a beer, and set off the electric chair when people aren't ready for it.
I started learning Ruby on Rails earlier this year but didn't have a project, so this became my first go at Ruby on Rails. And thanks to Steven Bryen for lending his ruby expertise from time to time. The great thing about RoR is that you can easily build responsive websites that can be viewed on mobile phones, tablets, as well as desktops. So there is my goal. Using a Raspberry Pi as the Ruby on Rails server, it will send commands to the Arduino to trigger anything I want.
Without further ado, I am pleased to introduce the MonsterRemote. The MonsterRemote is aimed at being a remote control for the MonsterShield prop controller that you can use from any mobile device. Utilizing a smartphone with web browsing capabilities, you can trigger any configured animation on the MonsterShield prop controller. This is a free and open source project with no liability or support.
Dynamic Home Screen that will only display the animations/slots that have been enabled on the MonsterShield
Change the generic names ("0. Scene 00") to any name of your choosing like "0. Ambient Mix" or "0. Scary Jumping Flying Thing"
Enable/Disable Animations in the settings page that will Enable/Disable the slot on the MonsterShield and reflect a new or deleted button on the home screen
Interrupt and stop a triggered animation after selecting yes on a dialogue box
Remotely Shutdown your Raspberry Pi to preserve file integrity of the linux system files
Toggle Ambient settings to be On or Off
Toggle the Animation mode to be Sequential (0,1,2,3..), Random (5,A,9,1..), or Single after selecting your animation(1,1,1,1..)