The ElasticBox Rocket™ is one of two winners from the official ElasticBox Desk Decor Competition. Created by the ElasticBox product team, Alex and Lavanya, our CTO Alberto and designer Matt, we knew from the beginning, they would be winners (cough* CTO on team cough*); but more importantly, we also discovered that ElasticBox + Jenkins + Raspberry Pi = Awesome.
If you haven’t had a chance to see the homepage of the ElasticBox website, then you’re probably wondering where they got the idea. But since you have seen the ElasticBox website, then you know that the mission was to create a life size version of the scrolling animation on our homepage.
But in this version of the ElasticBox Rocket™ there is a twist, it’s connected to our production deployment Jenkins build job! Internet geeks, try and maintain composure here – but yes – the rocket deploys every time we deploy ElasticBox to production, which is several times a day.
How It is Built:
There are three tools that make the ElasticBox Deployment Rocket a reality.
- ElasticBox, of course, to reinstall the instance that manages our Raspberry PI device.
- A Raspberry PI to control the stepper.
- And our trusty friend Jenkins to trigger the reinstallation of the instance that initiates the Rocket and our production deployment
Step 1: The Rocket & Cloud
Building the clouds and the rocket were arguably the easiest tasks, because they didn’t require any scripting, advanced hardware or integrations, but they did require Legos amongst construction materials that you’d find in a 3rd grade classroom.
The entire rocket was custom built from a Rocket Lego kit. It measures an impressive 4 whole inches in real life. The clouds are perhaps the least exciting piece of the puzzle and are made out of posterboard.
Step 2: The Raspberry PI Box
The Raspberry PI Box in ElasticBox is where the magic really happens, and no, sadly it’s not the kind you can eat. On the hardware side, we bought Raspberry PI that connects to WiFi and stepper motor so we could control the exact number of rotations, and hence, the distance that the ElasticBox Rocket Deploys.
The Deployment Process (the rocket, not the product) is triggered when we deploy ElasticBox (the product, not the rocket) to production. In the Jenkins build job that re-installs our production instances, we include a build step that triggers the reinstallation of our Raspberry PI Box. All this is made possible by our extremely powerful and convenient Jenkins Plugin which you can learn more about here.
Arguably the most important part of the script, which is written in Python, is what we print in the logs when the instance successfully re-installs.
Looking closer at the Box, there are only two variables, a WAV file and a steps variable. In the post_configure script, we load three python modules to make the ElasticBox Rocket™ possible. The first is RPi.GPIOwhich provides a class to control the GPIO (general purpose ins and outs) on the Raspberry Pi. The second is time, a python module that provides various time related functions and is used to time the various elements of the ElasticBox Rocket ™. The last module is called called pygame.mixer which allows us to trigger sound effects throughout the deployment process.
In the script, which you can see here you can see how we execute actions such as the Raspberry PI blinking, steps up and down, and the triggering of multiple WAV files throughout the entire process.
The Final Product:
Now that you know how the ElasticBox Rocket™ works, you’re probably curious about what this little guy looks like while in action. Luckily there is a “high quality” YouTube video for your convenience. Not only does the ElasticBox Rocket ™ launch into posterboard clouds (as explained previously) but it also comes equipped with quite a unique and unoriginal victory theme song. Can you guess which one?
…Don’t Stop Believing By Journey.
And so folks, there you have it, the ElasticBox Rocket™… mind blowing, isn’t it?