Programação Shell com processos filhos síncronos usando o Node.js v0.12

Editor’s note: This blog was original authored in English by Marc Harter.

Usar uma API assíncrona para escrever scripts shell e linha de comando utilitário em Node.js é um tanto inconveniente. Pelo fato da maioria dos scripts Shell serem executados na ordem de cima pra baixo; o que torna mais fácil bloquear a execução do script e torná-lo síncrono, ao invés de gerenciar o estado assíncrono com retornos de chamada (usando callbacks).

Felizmente, uma implementação nativa mais rápida vai estar disponível no Node v0.12 para processos filhos síncronos. Mas, isso também pode ser feito com a versão instável 0.11 (uma maneira de alternar de versão é usando o nvm).

Read more

StrongLoop Node.js Weekly Review – Sept 29, 2014

Here’s this week’s recap of the Node.js related blogs we posted last week…

Node.js Editor Comparison: Sublime vs Atom vs Cloud 9

Picking the right editor has always been kind of a big deal for me. I’ve had a pleasure of watching editors evolve and grow over the past few years and have developed a great appreciation for the current state of affairs. I spend hours perfecting my shortcuts, configurations, and plugins—perhaps way too much time actually. In this post I’m going to take a quick look at three editors: Sublime Text, Atom, and Cloud 9 IDE.

Read more…

Node.js Logging with Splunk and StrongLoop Controller

Error stack traces in Node have still have some distance to cover to become really useful. The absence of a thread local type context in the asynchronous world of Node, makes error correlation a nightmare. This is complicated by anonymous/non-strict function constructors. Zones and Promises solve the problem to an extent for development time but still face overhead challenges in production time. Logging frameworks like BunyanWinston or Strong-Loggerhave provided control over verbosity using logging levels – Debug, Info, Warn, Error and Node specific structure by prepending timestamps, cluster – worker processes IDs, app-names or hostnames and rollover capabilities. The fact remains that these logs have to be humanly monitored almost impossibly and quite a few interesting or abnormal events preluding a fatal condition can be missed. In this blog we discuss a simple but effective solution using StrongLoop Controller and Splunk to tackle many of these challenges.

Read more…

What’s next?

  • Ready to develop APIs in Node.js and get them connected to your data? Check out the Node.js LoopBack framework. We’ve made it easy to get started either locally or on your favorite cloud, with a simple npm install.

 

Node.js Editor Comparison: Sublime vs Atom vs Cloud 9

intro

TL;DR Sublime is awesome, Atom has potential and Cloud 9 is downright impressive.

History

Picking the right editor has always been kind of a big deal for me. I’ve had a pleasure of watching editors evolve and grow over the past few years and have developed a great appreciation for the current state of affairs. I spend hours perfecting my shortcuts, configurations, and plugins—perhaps way too much time actually.

Over the years I’ve used everything from Notepad++ and Vim to Delphi and TextMate. The latter has been the biggest and most rewarding to learn and use. Every new editor that I encounter these days I evaluate based on Vim key support first, everything else second.

In this post I’m going to take a quick look at three editors: Sublime Text, Atom, and Cloud 9 IDE. Lets get going!

Read more

Node.js Logging with Splunk and StrongLoop Controller

Logging has been used since the most primitive software days as a form of event storage abstraction. Obviously, system and application level logging have matured over the years. Application logs now usually store records of application events like request details, response codes, and triage constructs like unstructured errors messages or stack traces. Logging frameworks like log4j in the Java world and utilities like syslog have made it easier to control logging levels, history (rollovers) and make application behavior human readable (short for text). Logs are still core to debugging or analytics regardless of the automation and tooling built over them. The same applies with Node.js applications too.

The problem with Node.js logging

Error stack traces in Node have still have some distance to cover to become really useful. The absence of a thread local type context in the asynchronous world of Node, makes error correlation a nightmare. This is complicated by anonymous/non-strict function constructors. Zones and Promises solve the problem to an extent for development time but still face overhead challenges in production time. Logging frameworks like Bunyan, Winston or Strong-Logger have provided control over verbosity using logging levels – Debug, Info, Warn, Error and Node specific structure by prepending timestamps, cluster – worker processes IDs, app-names or hostnames and rollover capabilities.

But the big fact remains that these logs have to be humanly monitored almost impossibly and quite a few interesting or abnormal events preluding a fatal condition can be missed. I obviously don’t need to preach to you how important this logging is for analytics – which is another weak spot in the Node application space. We discuss a simple but effective solution using StrongLoop Controller and Splunk.

What is Splunk?

logo_splunk_2color_K

For those of you not familiar with Splunk, it’s software that searches, monitors, analyzes and visualizes machine-generated big data from websites, applications, servers, networks, sensors and mobile devices. More than 7,900 organizations use Splunk software.

What is StrongLoop Controller?

StrongLoop’s Controller provides an integrated development, runtime and operations tool-chain for deploying scalable, high quality Node code in production. Features include:

  • On-premise – take control of your Node DevOps  in your datacenter or on your own cloud infrastructure
  • Open Source – developed in Node, built for Node apps
  • Clustering – horizontally scale across multiple processes with built in dynamic resizing, load-balancing, hot deploys, rolling restarts and state sharing
  • Debug – Node Inspector in browser with unit test integration, inspection of deep call stacks, pre-emptive breakpoints, source map loading, display & edit of expressions and variables.
  • Log Management – log aggregation across processes in cluster, structured logging, log levels and integration with third party tools
  • Build –  build apps without registry dependencies, support for Git merge, Output  tarball packages usable by npm pack and npm install, publishable archives with dependencies
  • Deploy – publish app to local or remote servers, service lifecycle management (boot, start, restart, status, destroy), redeploy without downtime, scaling
  • Private Registry – multiple npm registry, on-premise or cloud, promote package versions, switch between registries.

Here’s how to get started with Splunk and StrongLoop Controller in six simple steps…

Read more

StrongLoop Node.js Weekly Review – Sept 15, 2014

Here’s this week’s recap of the Node.js related blogs we posted last week…

Building Enterprise APIs with StrongLoop and the New Swagger 2.0 API Specification

In this blog we’ll show just how easy it is to create Node.js powered REST APIs that conform to the new Swagger 2.0 specification using the LoopBack framework. If you are new to Swagger, it defines a standard, language-agnostic interface to REST APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. If you are new to LoopBack, it is an open source Node.js API framework from StrongLoop. It is built on top of Express optimized for mobile, web, and other devices.

Read more…

Node.js v0.12 Shell Programming Bliss with Synchronous Child Processes

Using an asynchronous API for writing shell scripts and command line utilities in Node is inconvenient. Most shell scripts run top to bottom; it’s easier to block and stay synchronous than managing asynchronous state with callbacks. Thankfully, a fast, native implementation of synchronous child processes will be in Node 0.12. But, you can play with it today by installing an unstable release of 0.11 (my preferred way to do this is nvm).

Read more…

StrongLoop’s Support for the Node.js Community

At StrongLoop, supporting the Node.js community is a vital ingredient to our success. It’s important for us to do our part by not just contributing code back to the Node ecosystem, but also in supporting the individuals, organizations and events that make Node the fastest growing developer community in the world. Check out all the open source projects we help maintain plus all the Meetups and events we support as well.

Read more…

Monitor Node Apps

Ready to start monitoring event loops, manage Node clusters and chase down memory leaks? We’ve made it easy to get started with monitoring either locally or on your favorite cloud, with a simple npm install.

Screen Shot 2014-02-03 at 3.25.40 AM

What’s next?

  • Ready to develop APIs in Node.js and get them connected to your data? Check out the Node.js LoopBack framework. We’ve made it easy to get started either locally or on your favorite cloud, with a simple npm install.