SlideShare a Scribd company logo
Node.js
in a heterogeneous system

Alexey Migutsky : Senior Software Developer @ Lohika
What do we do?
What do we do?

Ubix.io
PaaS for BigData analytics in cloud
environments.
What do we use?
Scala

Python

What do we use?

Bash
Javascript
BDAS (Spark + Shark)
AWS
Black Voodoo Magic™

What do we use?
Velocipede™
Brains
What’s next?
Node & Maven

Jenkins & Node testing

What’s next?

Velocipede™

CI
?
Why Node.js?
Why Node.js?
Fast and easy
Easy websockets support
Plays nice with AWS
We use it as a web-tier orchestrator
Node & Maven
Node & Maven
We use maven (pom.xml)
We use npm (packege.json)
We have node+maven projects!
Project structure
Node.js in a heterogeneous system
Project structure
+ Subprojects are maven modules
+ Subprojects use common code base
+ Easy « build process »
+ Easy deployments
- Uber root package.json
- Mangled dependencies
Custom modules
Custom modules
Live in root /node_modules right now
Planning to move to separate git repos
Tested with subprojects
Tests
Tests
Mocha + Sinon + Chai
Sinon-chai + mocha-sinon
Chai-as-promised

Rewired
Jenkins TAP plugin
Test example
describe('##getConfiguration', function () {
it('should return promise and resolve with data ', function (done) {
var promise = sysStore.getConfiguration('somekey');
promise.should.eventually.become({key: 'somekey'})
.then(function () {
mockDb.getItem.should.be.calledWithMatch(
mockTables.system,
{key: sinon.match.string}
);
})
.should.notify(done);
});
});
Test Env How-to
Test Env How-to
Goals:
-

run from root using mvn test
run from sub using npm test
human-readable result logs
result >> in console and file
Jenkins support
http://www.mindmeister.com/346337860
Test Env How-to
package.json
"devDependencies": {
"mocha": "*",
"sinon": "1.6.*",
"chai": "*",
"sinon-chai": "*",
"mocha-sinon": "*",
"chai-as-promised" : "*",
"rewire" : "*"
},
"scripts" : {
"test" : "./runtest.sh"
}
Test Env How-to
runtest.sh

#!/bin/bash
mocha $(find test -name '*.js') -R tap |
tee test/testresults.tap; (exit ${PIPESTATUS[0]})

The whole command runs in a single line. Wrapped here for display purpose
Test Env How-to
pom.xml (maven-antrun-plugin)

<execution>
<id>test-nodejs</id>
<phase>test</phase>
<configuration>
<tasks name="Run mocha tests">
<exec dir="${basedir}”
executable="npm”
failonerror="true">
<arg value="test"/>
</exec>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
Build process
Build process
-

No npm install on build server (too slooow)

-

Fixed deps versions (update by-hand)

-

All deployable deps are checked in!

-

Build phase only copies deps in subprojects

http://www.futurealoof.com/posts/nodemodules-in-git.html
Deployment
Deployment
-

Builds are stored at S3

-

Copied to instances by orchestration tools

-

Managed by upstart
Deployment
upstart (server.conf)
#this should be put in /etc/init/server.conf on Ubuntu
description ”Node.js server"
author
"Alexey Migutsky"
# used to be: start on startup
# until we found some mounts weren't ready yet while booting:
start on started mountall
stop on shutdown
# Automatically Respawn:
respawn
respawn limit 20 5
# Max open files are @ 1024 by default. Bit few.
limit nofile 32768 32768
script
# Not sure why $HOME is needed, but we found that it is:
export HOME="/root”
exec /usr/local/bin/node /usr/local/server/app.js >> /var/log/server-err.log 2>&1
end script

post-start script
end script

http://kvz.io/blog/2009/12/15/run-nodejs-as-a-service-on-ubuntu-karmic/
Deployment hint
Have a look at http://pm2.io/
Continuous Integration
Node.js in a heterogeneous system
« hack some node.js »
npm test
Node.js in a heterogeneous system
Node.js in a heterogeneous system
build & test
build & test
store
build & test
store
build & test
store
build & test
store
That’s it!
That’s it!
Thanks

@mr_mig_by
bit.ly/mr_mig

More Related Content

What's hot (20)

PDF
Network Automation with Ansible
Anas
 
PPT
Ansible presentation
John Lynch
 
PPTX
Create Rest API in Nodejs
Irfan Maulana
 
PDF
Ansible Automation to Rule Them All
Tim Fairweather
 
PDF
docker build with Ansible
Bas Meijer
 
PPTX
Build RESTful API Using Express JS
Cakra Danu Sedayu
 
PPTX
Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12
Keith Resar
 
PDF
Introduction to Ansible
Michael Bahr
 
PDF
Ansible Case Studies
Greg DeKoenigsberg
 
PDF
Running JavaScript Efficiently in a Java World
irbull
 
PPTX
Grunt and Bower
George Estebe
 
PDF
Ansible 101
Gena Mykhailiuta
 
KEY
Nodejs web,db,hosting
Kenu, GwangNam Heo
 
PDF
Cialug August 2021
Andrew Denner
 
ODP
Ansible basics workshop
David Karban
 
PDF
Ansible, best practices
Bas Meijer
 
PDF
Production Ready Javascript With Grunt
XB Software, Ltd.
 
PDF
Ansible Introduction - Ansible Brno #1 - David Karban
ansiblebrno
 
PPT
Local Dev on Virtual Machines - Vagrant, VirtualBox and Ansible
Jeff Geerling
 
PPTX
Ansible: How to Get More Sleep and Require Less Coffee
Sarah Z
 
Network Automation with Ansible
Anas
 
Ansible presentation
John Lynch
 
Create Rest API in Nodejs
Irfan Maulana
 
Ansible Automation to Rule Them All
Tim Fairweather
 
docker build with Ansible
Bas Meijer
 
Build RESTful API Using Express JS
Cakra Danu Sedayu
 
Ansible Automation Best Practices From Startups to Enterprises - Minnebar 12
Keith Resar
 
Introduction to Ansible
Michael Bahr
 
Ansible Case Studies
Greg DeKoenigsberg
 
Running JavaScript Efficiently in a Java World
irbull
 
Grunt and Bower
George Estebe
 
Ansible 101
Gena Mykhailiuta
 
Nodejs web,db,hosting
Kenu, GwangNam Heo
 
Cialug August 2021
Andrew Denner
 
Ansible basics workshop
David Karban
 
Ansible, best practices
Bas Meijer
 
Production Ready Javascript With Grunt
XB Software, Ltd.
 
Ansible Introduction - Ansible Brno #1 - David Karban
ansiblebrno
 
Local Dev on Virtual Machines - Vagrant, VirtualBox and Ansible
Jeff Geerling
 
Ansible: How to Get More Sleep and Require Less Coffee
Sarah Z
 

Similar to Node.js in a heterogeneous system (20)

PDF
LCE13: LAVA Multi-Node Testing
Linaro
 
PDF
I Just Want to Run My Code: Waypoint, Nomad, and Other Things
Michael Lange
 
PPT
Ferrara Linux Day 2011
Gianluca Padovani
 
PDF
Node.js - JavaScript Chicago Meetup
hugs
 
PDF
node.js 실무 - node js in practice by Jesang Yoon
Jesang Yoon
 
PDF
How to-node-core
IsaacSchlueter
 
PDF
[HKOSCON][20190615][DevOps with Ansible, From Native to Kubernetes]
Wong Hoi Sing Edison
 
KEY
Dcjq node.js presentation
async_io
 
PPTX
Node.js, Vagrant, Chef, and Mathoid @ Benetech
Christopher Bumgardner
 
PDF
Continuous Integration for front-end JavaScript
Lars Thorup
 
PDF
Intro to node.js - Ran Mizrahi (27/8/2014)
Ran Mizrahi
 
PDF
Intro to node.js - Ran Mizrahi (28/8/14)
Ran Mizrahi
 
PDF
Node.js Web Development .pdf
Abanti Aazmin
 
PPTX
A brief intro to nodejs
Jay Liu
 
PPTX
How do I write Testable Javascript so I can Test my CF API on Server and Client
Gavin Pickin
 
PPTX
PHP Indonesia - Nodejs Web Development
Irfan Maulana
 
PPTX
Irfan maulana nodejs web development
PHP Indonesia
 
PDF
Unity Loves HelNode - Helsinki Node.js November Meetup
Helsinki Node.js Meetup Group
 
PDF
Node.js, toy or power tool?
Ovidiu Dimulescu
 
PPTX
How to write test in node.js
Jason Lin
 
LCE13: LAVA Multi-Node Testing
Linaro
 
I Just Want to Run My Code: Waypoint, Nomad, and Other Things
Michael Lange
 
Ferrara Linux Day 2011
Gianluca Padovani
 
Node.js - JavaScript Chicago Meetup
hugs
 
node.js 실무 - node js in practice by Jesang Yoon
Jesang Yoon
 
How to-node-core
IsaacSchlueter
 
[HKOSCON][20190615][DevOps with Ansible, From Native to Kubernetes]
Wong Hoi Sing Edison
 
Dcjq node.js presentation
async_io
 
Node.js, Vagrant, Chef, and Mathoid @ Benetech
Christopher Bumgardner
 
Continuous Integration for front-end JavaScript
Lars Thorup
 
Intro to node.js - Ran Mizrahi (27/8/2014)
Ran Mizrahi
 
Intro to node.js - Ran Mizrahi (28/8/14)
Ran Mizrahi
 
Node.js Web Development .pdf
Abanti Aazmin
 
A brief intro to nodejs
Jay Liu
 
How do I write Testable Javascript so I can Test my CF API on Server and Client
Gavin Pickin
 
PHP Indonesia - Nodejs Web Development
Irfan Maulana
 
Irfan maulana nodejs web development
PHP Indonesia
 
Unity Loves HelNode - Helsinki Node.js November Meetup
Helsinki Node.js Meetup Group
 
Node.js, toy or power tool?
Ovidiu Dimulescu
 
How to write test in node.js
Jason Lin
 
Ad

Recently uploaded (20)

PPTX
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
PDF
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
PPTX
Digital Circuits, important subject in CS
contactparinay1
 
PPTX
Securing Model Context Protocol with Keycloak: AuthN/AuthZ for MCP Servers
Hitachi, Ltd. OSS Solution Center.
 
PDF
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PPTX
Talbott's brief History of Computers for CollabDays Hamburg 2025
Talbott Crowell
 
PDF
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
PDF
Evolution: How True AI is Redefining Safety in Industry 4.0
vikaassingh4433
 
PDF
🚀 Let’s Build Our First Slack Workflow! 🔧.pdf
SanjeetMishra29
 
PDF
Dev Dives: Accelerating agentic automation with Autopilot for Everyone
UiPathCommunity
 
PDF
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
PDF
Next Generation AI: Anticipatory Intelligence, Forecasting Inflection Points ...
dleka294658677
 
PPTX
Essential Content-centric Plugins for your Website
Laura Byrne
 
PPTX
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
PPTX
Manual Testing for Accessibility Enhancement
Julia Undeutsch
 
PPTX
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
PDF
Bharatiya Antariksh Hackathon 2025 Idea Submission PPT.pdf
ghjghvhjgc
 
PDF
99 Bottles of Trust on the Wall — Operational Principles for Trust in Cyber C...
treyka
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
PPTX
CapCut Pro PC Crack Latest Version Free Free
josanj305
 
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
Digital Circuits, important subject in CS
contactparinay1
 
Securing Model Context Protocol with Keycloak: AuthN/AuthZ for MCP Servers
Hitachi, Ltd. OSS Solution Center.
 
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
Talbott's brief History of Computers for CollabDays Hamburg 2025
Talbott Crowell
 
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
Evolution: How True AI is Redefining Safety in Industry 4.0
vikaassingh4433
 
🚀 Let’s Build Our First Slack Workflow! 🔧.pdf
SanjeetMishra29
 
Dev Dives: Accelerating agentic automation with Autopilot for Everyone
UiPathCommunity
 
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
Next Generation AI: Anticipatory Intelligence, Forecasting Inflection Points ...
dleka294658677
 
Essential Content-centric Plugins for your Website
Laura Byrne
 
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
Manual Testing for Accessibility Enhancement
Julia Undeutsch
 
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
Bharatiya Antariksh Hackathon 2025 Idea Submission PPT.pdf
ghjghvhjgc
 
99 Bottles of Trust on the Wall — Operational Principles for Trust in Cyber C...
treyka
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
CapCut Pro PC Crack Latest Version Free Free
josanj305
 
Ad

Node.js in a heterogeneous system