Tao_of_Micro_Services_

The Tao of Microservices book cover

The Tao of Microservices is the new book by nearForm co-founder and chief technology officer (CTO) Richard Rodger. Due for publication in full in Fall 2016, the book’s first two chapters are available now as part of publisher Manning’s early access program (MEAP).

Continue reading

nearForm has released version 1.0 of Seneca, its open source microservices toolkit for Node.js. Visit the Seneca website and take a look at it on GitHub.

seneca-logo

Evolution of Seneca

It’s been a long road for Seneca. It started life back in 2010 as a one-man project by nearForm CTO, Richard Rodger – “one developer’s itch”, as he describes it. It quickly gained a small but dedicated following and began to grow and evolve. Today, it is a fully functional microservices toolkit for Node.js that is in production use in several organizations worldwide, including Intel and CoderDojo. It is also the core of a vibrant open source community and a growing team of contributors.

Improvements in Seneca 1.0

This release of Seneca represents the culmination of a long period of ecosystem-wide work to provide stability and ease of use across the board. We wanted to focus our efforts on creating a solid foundation for our community and users to work with.

With this in mind, I wanted to share some of the high-level changes and improvements we have made across the organization:

  • Quality and maintenance
    • Decomposed core functionality into plugins for easier management
    • Integration with Coveralls and Travis across the board
    • Drastic increase in code coverage in all org repos
  • Business logic components (plugins)
    • Major cleanup across the board on all plugins
    • Deprecated various projects in favour of community-created ones
  • Data entities
    • Major cleanup efforts across the board on all stores
    • Documentation improvements
    • Initial ground work to move Entities into its own plugin
  • Service discovery
  • Third party integration
  • Community
    • Implemented Charka CoC across the organization
    • Appointed lead maintainers to key projects

Core principles of Seneca

The ethos of the Seneca framework is to place the needs of developers above the needs of maintainers. In line with this ethos, the core principles of Seneca are as follows:

  • Acceptance. All uses of Seneca are valid and accepted. To make this possible, the core API is kept small, and there is a plugin and decoration mechanism so that developers can make Seneca their own.
  • Brevity. To quote a recent blog post by Matteo Collina, architect at nearForm and core contributor to Seneca, “no code is better than any code”. In other words, less is more. Seneca enables you to write clean, concise code so that you have less to think about and write fewer bugs. To do this, it provides a chainable API, an abbreviated form of JSON, and an abbreviated way to load plugins.
  • Continuity. Seneca won’t break your code. Major releases with API changes provide a plugin to support the previous release, so that you can continue to use your old code with a one-line addition.

Documentation quality

Just because a project is open source shouldn’t mean that its developers have to put up with poor documentation.

Even when it was still little more than a twinkle in its creator’s eye, Seneca placed a high value on good quality documentation. The new version features enhanced tutorials, comprehensive API and plugin docs, and a super-detailed getting started guide.

As part of nearForm’s stewardship, our in-house writer and editor regularly quality checks the Seneca docs and makes corrections and improvements to maintain standards.

Thanks

Seneca exists today because of the commitment, enthusiasm and hard work of several contributors in the areas of coding, quality assurance, writing, editing and testing. See the full list of contributors’ names.

Find out more

See Richard Rodger’s own blog post for a detailed account of the genesis of Seneca right up to the new release.

 

I’m delighted to announce the first release of fuge, nearForm’s open source generation and execution environment for microservice development on Node.js. fuge is open source under the MIT license. fuge-logo

fuge background

At nearForm we have developed a significant number of microservice-based systems. There are clear benefits to the microservice architectural style. Primarily, we are able to work with smaller units of code that are easier to reason about and test in isolation. Microservices also give us the ability to perform rapid, incremental deployments and deliver features faster.

So what’s not to like?

Well, as with all approaches to software development, there are a number of trade-offs to be made. One of the main trade-offs with microservices is the developer experience. This can be difficult because in order to run a copy of the system for local development, you have to run several processes instead of a single monolith. Current IDEs and tooling are oriented towards monolithic system development and don’t support the microservice paradigm well. There is even a name for this dilemma: ‘shell hell’.

Escaping shell hell

fuge blog post fig 1

Figure 1: Shell hell

There are several approaches to tackling shell hell. At nearForm, we have tried them all. For one, you can apply the ‘ostrich algorithm’. In other words, just develop services in isolation and maintain a central integration and staging system. This can work for a while. However, this model begins to break down as the number of developers increases.

Another approach is to use containers. For example, docker-compose allows you to run a bunch of service containers with a single command. The problem with this is that the development cycle time can be a little slow as a new container layer needs to be built for each change.

On several projects at nearForm, we have built custom scripts to spin up our microservices and this has worked well. However, we decided that we didn’t want to keep reinventing the wheel. And so, fuge was born.

fuge features

fuge provides two key pieces of functionality to help accelerate microservice development. Firstly, it acts as a code generator to produce system and service scaffolding. Secondly, it provides an execution environment for microservices.

Let’s look at each of these features in turn.

Code generation

Whilst each project has its own unique requirements, code scaffold generation can be a great way to start off on a good footing and can help to speed up development.

If you have ever used Ruby on Rails, Yeoman or similar code generation tools, you will appreciate how powerful code generation can be. fuge provides a similar scaffold generation capability for microservices. Let’s look at this in action.

First of all, install fuge with:

npm install -g fuge

Once fuge is installed, cd to a clean empty directory and run:

fuge generate apparatus/system

fuge asks a few questions and then generates a fully functional system for you comprising a front end and two microservices. Under the hood, fuge runs a set of Yeoman generators to construct the system for you. Let’s take a look at the generated code:

Figure 2: fuge code

Figure 2: fuge code

fuge generates a system complete with Docker files for each component. This means that you can take the system as it is and create containers immediately. fuge uses the docker-compose file syntax, so the generated system is compatible with docker-compose, swarm and associated tools and can also be run in development using fuge.

Execution environment

Aside from code generation, the key benefit of fuge is an execution environment for microservices through the fuge shell.

Figure 3: fuge shell

Figure 3: fuge shell

The fuge shell provides a number of features that help you to develop a microservice-based system. These features are as follows:

  • The ability to start and stop groups of services with a single command
  • A network proxy that bridges between microservice processes and Docker containers
  • A process watcher that restarts microservices as changes are made to the code
  • Log tailing and searching on a per-service basis

Spin ‘em up

Being able to manage service processes en masse is a huge boon to local development. Within the fuge shell, the command start all spins up all processes that are under management. fuge watches all processes under management for changes and restarts as required. This makes integration testing and debugging significantly simpler.

Mix it up

If you have worked with Docker during local development on Mac or Windows, you have experienced the friction of having to determine the Docker VM IP address and then having to code services to connect to infrastructural containers such as Mongo or Redis. fuge automatically provides a proxy layer to make this transparent to service processes. This increased transparency significantly reduces container friction.

Wrap it up

At nearForm, we are actively using fuge on a number of projects. So far, we find it a great asset in our microservice development arsenal. fuge is under active development and we intend to keep adding features to it to make our – and your – life easier. Coming up on the road map, we will be adding more service generators and live debugging capability to allow us to seamlessly connect to and debug running service processes.

If you are interested in using fuge on your next project or adding it to a current one, check out the GitHub repository for more detailed documentation and examples. As always, feel free to get in touch with us at nearForm.

nearForm is delighted to welcome aboard new advisor and senior architect Eran Hammer. Eran is a high-profile member of the global Node.js community. He is best known internationally for leading the software development team at Walmart that transformed the US retail giant’s mobile e-commerce platform to Node.js with two extremely successful and uneventful Black Fridays, the busiest shopping day of the year.

Eran Hammer

Continue reading

Page 1 of 612345...Last »