Announcing Mecano, a set of functions for system deployment

Announcing Mecano, a set of functions for system deployment

Do you like our work......we hire!

Never miss our publications about Open Source, big data and distributed systems, low frequency of one email every two months.

Update July 2016, Mecano is now renamed Nikita.

We are releasing Node Mecano on GitHub which gather common functions used while deploying systems. The idea was to group those functions into a comprehensive library.

The code started when we wrote Heco as well as when we deployed a Hadoop cluster for one of our customer. It found inspiration in the Chef Resource API.

The functionalities are still limited and there are obviously many potential improvements but we wanted to release the code early. We found it already very usefully and the API should be stable enough to integrate it into your own project.

The functions covered by Mecano are copy, download, execute, extract, git, ln, mkdir, remove and render. Their API is always the same. The first argument defines one or more command to run (an object or an array of objects) and the second one is a callback called on completion which tell you how many common where really run. For example, to copy 2 files, the code will look like:

mecano = require('mecano');
mecano.copy([
    { source: 'file_1', destination: 'dest_1' },
    { source: 'file_2', destination: 'dest_2' }
], (err, copied) ->
    console.log( 'Number of file copied: '+copied );

Calling the same command a second time and the value of copied will be “0” because no new file was copied.

The command share a set of common properties to conditionally run the command and validate its result. For example, the following command will only run if a specified file exists and will emit an error if the exit code isn’t the one provided.

mecano = require('mecano');
mecano.execute({
    cmd: 'whoami',
    if_exists: '/home/itsme', // condition
    code: 0 // default exit code
}, (err, executed) ->
    console.log( 'Did the command run '+(executed?'yes':'no') );

Hope you’ll find it useful as well and don’t hesitate to provide us with feedback.

Share this article

Canada - Morocco - France

We are a team of Open Source enthusiasts doing consulting in Big Data, Cloud, DevOps, Data Engineering, Data Science…

We provide our customers with accurate insights on how to leverage technologies to convert their use cases to projects in production, how to reduce their costs and increase the time to market.

If you enjoy reading our publications and have an interest in what we do, contact us and we will be thrilled to cooperate with you.

Support Ukrain