Automated Drone Management System for node.js fleet

We’re using fleet (https://github.com/substack/fleet) to deploy and manage our node.js application (and there are enough of them).

fleet provides you with a way to create “drones” (in any server) under a “fleet master” (same server, or another) which will be able to deploy new commits from Git to the drones, stop the currently running application under the drone, start it, install node modules under the drone.. and so on and so on. You can also run multiple applications under the same drone.

Think of it as an army. fleet=Battalion Commander, Drones=Squad Leaders, applications=Soldiers.

The drone will also rerun the application when it crashes.

What fleet DOESN’T do, is.. manage the rest of the scenarios.

If the fleet master crashes .. FAIL!

If the drone crashes.. FAIL!

If the server resets.. FAIL!

if the drone is running a false command.. FAIL!

To overcome this problem, and be able to automatically create fleets, drones, run applications, deploy releases,  etc.. I’ve written a Python (fabric based) tool (which should be cron-ed). It is based on a json config in which each fleet (and its drones) will be specified. It does the following:

  • if a fleet is missing, clone it, run it, create the drones under it.
  • if a drone is missing, create it.
  • if an application is in a respawning state, recreate it.
  • if a fleet is not up, but should, run it.
  • if a drone exists but isn’t loaded, load it.
  • if a drone is up, but isn’t running any application, spawn it.
  • if a drone exists but shouldn’t, remove it.

You will be able to create fleets and drones and fix problems by easily editing a json file. You wanna add 10 more drones and run 6 different apps? easy.

Currently, the tool is centered around our specific environment, but in a month or so I will release it to the public. If you want to use it, let me know and I’ll get you going before its release.

Leave a comment