BigPanda DevOps Exercise
INTRO
Good morning, Mr. Panda. Your mission, should you choose to accept it, involves the development and deployment of two nanoservices. Please read the following instructions carefully before starting to implement your mission, you don't want to miss any important instruction, especially those in General Guidelines
Get your environment ready
You'll need a linux machine with the ability to run vms.
- Make sure you have python 2.7 installed. (Ubuntu 14.04 is highly recommended).
- Install Ansible (version 2.1).
- Install Vagrant.
- Install VirtualBox.
- Mirror this git repo using the instructions here. Then clone it locally. (Please DO NOT fork the repo)
- Run
vagrant up base
and make sure you can ssh into the machine usingvagrant ssh base
. - Inside the vm execute
nodejs /tmp/bamboo-app/bamboo.js
. - Open your browser, go to http://localhost:8080, you should get some information about how much we love bamboo.
Important note: the infrastracture should work out of the box. There's no hidden part of the excersice in which you need to debug vagrant/virtualbox. If you expirience any issue, please refer to Problems
Ready for action?
Great.
Your project is simple, as a DevOps panda you need to have the ability to develop nanoservices and create a mechanism for deploying them.
Below, you can find the description of your tasks.
NodeJS/Python services
Create two basic NodeJs or Python services, the first is img-panda which should serve static files from a directory called resources
. The directory should contain a random number of files. You may use any image that you like, as long as there is a panda over there. The service should return a random image on every GET request.
The second service shall be called smart-panda, and should just maintain a counter of the amount of POST requests it served, and return it on every GET request it gets. A sample NodeJS service named bamboo-app already exists here
Deployment
Create an ansible role for each of the services. The role should install the service, run it and make sure it's ready to be used in production (see General Guidelines). A sample role for bamboo-app already exists for your convenience. (Please note: samples are not full, and do not contain all relevant the details, you're expected to improve them, and add missing tasks). We understand there might be a short service downtime when re-deploying a service, that’s fine.
Wrapper
This part is a BONUS part, if you find this exercise simple and short, feel free to do it.
Create a simple utility for deploying both services. Your utility should support deploying a single service, or all of them.
Please make sure you have a decent --help
in your script.
Deliverables
A GitHub Pull-Request to YOUR DUPLICATED REPO, containing:
- The code for both img-panda and smart-panda.
- Ansible roles which takes care of provisioning both services on a VM called base.
- Modified base.yml which install ONLY the newly written services on the base VM.
- BONUS A wrapper script on top of ansible-playbook which deploys the latest version of those services.
PLEASE make sure your Pull Request contains all the requirments above, and doesn't contain any code you didn't change.
The Pull-Request should contain a short description of the roles you created, and any other comment you’d like us to know of.
General Guidelines
Your code should be as simple as possible, yet well documented and robust.
Spend some time on designing your solution.
Think about operational use cases from the real world. Few examples:
- Can you run the playbook multiple times without any problem?
- What happens if a service crashes?
- How much effort will it take to create a new service? D.R.Y!
Problems
The one and only reason we're using VirtualBox and Vagrant is simplicity and fast bring up of your environment.
However, environment issues might happen due to various reasons we can't control.
If, for any reason, you experience issues with Vagrant or VirtualBox which you can't solve in 5 minute of work, please do the following:
- Avoid any VirtualBox or Vagrant work.
- Create a new Ubuntu VM on your own.
- Write the two services detailed in NodeJS/Python Services
- Write the roles detailed in Deployment
- In the Deliverables part, assume
base.yml
will run locally on the VM, and modify it accordingly.
Bottom line - follow all the instruction in this document, but assume you're provisioning localhost
machine.