Giter Site home page Giter Site logo

fuge's Introduction

fuge-logo

fuge

Gitter

Fuge provides a generation and execution environment for microservice development on node.js.

demo

If you're using this module, and need help, you can:

Install

To install, use npm to install globally.

npm install -g fuge

Overview

Fuge aims to help developers working on microservice systems in several ways:

  • By providing a microservice scaffold generator

  • By providing a service execution environment

  • By reducing the friction between processes and containers

Scaffold Generator

The scaffold generator creates a fully functional microservice system that is ready to run. Once generated you can add additional services manually or by using the service generator.

Fuge generates services in node.js using the Seneca microservices framework and the HAPI web framework for the API layer.

To generate a skeletal fuge microservice system run:

mkdir mysystem
cd mysystem
fuge generate system

Fuge will ask you for some simple questions and then generate a system for you. The generated system looks as follows:

├── fuge
│   ├── compose-dev.yml
│   └── fuge-config.json
├── service1
│	└── Dockerfile
├── service2
│	└── Dockerfile
└── site
	├── Dockerfile
    ├── api
    └── public

The structure has the following key files:

  • fuge - This directory contains two files
    • compose-dev.yml - a docker-compose yaml file that serves as the main configuration reference for the system
    • fuge-config.json - contains fuge specific settings and overrides not supported by docker-compose
  • service1 - contains a basic http point to point microservice using the Seneca framework
  • service2 - contains a basic http point to point microservice using the Seneca framework
  • site - contains a frontend site for the system. This is comprised of an api and a public site using the HAPI framework

To start the generated system execute:

fuge run ./fuge/compose-dev.yml

This will spin up the site and the two related microservices. Point your browser to http://localhost:10000/ to open the front end and exercise the microservices.

Fuge watches your code for changes and will automatically restart the front end and services as you make changes, providing a rapid development environment for integration testing and debugging.

To generate a new service you can run:

fuge generate service

Fuge will create a new service for you and will optionally add it into your compose-dev.yml.

Execution Environment

Fuge provides a simple shell to manage microservice execution. To start the shell run:

fuge shell ./fuge/compose-dev.yml

The fuge shell supports the following commands:

  • help - display a list of supported commands
  • ps - list status of managed processes and containers
  • proxy - list proxy and port forwarding status
  • info [process name] - show information on a specific process
  • stop [process] - stop a process and any associated watcher
  • stop all - stop all processs and watchers
  • start [process] - start a process
  • start all - start all stopped processes
  • debug [process] - start a process in debug mode and launch node-debug (experimental)
  • watch [process] | all - turn on watching for a process or for all processes
  • unwatch [process] | all - turn off watching for a process or for all processes
  • tail [process] | all - tail output for a process or for all processes
  • untail [process] | all - end tail output for a specific processes or for all processes
  • grep 'search string' [process] - searches a processes log or all processe logs
  • exit - termiate all managed process and exit

Mixed Containers and Processes

If you are familiar with docker, you will notice that fuge generates a Dockerfile for each system componenet and ties the system together with a docker-compose yaml file. In fact, the system generated by fuge can be run entirely using docker-compose. If you have docker installed you can try this out by running:

docker-compose -f ./fuge/compose-dev up

Docker will build a set of containers and start them up for you.

Adding Infrastructure

Lets say that we want one of our services to connect a redis server. We could go ahead and install redis to our development system. Another approach however is to use docker. If you have docker installed then try the following:

Edit compose-dev.yml and add the following:

redis:
  image: redis
  ports:
    - 6379:6379

Ensure that the redis container is on your system by running

docker pull redis

Start the system up in the fuge shell again by running

fuge shell ./fuge/compose-dev.yml

Starting fuge will now start the redis container as well as your micro-services.

Proxy

In addition to running docker containers, Fuge will proxy connections to the docker virtual machine on a mac and windows environment. Running the proxy command will show you how fuge is proxying connections to the docker containers running as part of your system

Contributing

The apparatus team encourage open participation. If you feel you can help in any way, be it with documentation, examples, extra testing, or new features please get in touch.

License

Copyright the apparatus team 2015, Licensed under MIT.

fuge's People

Contributors

coryvirok avatar mcdonnelldean avatar pelger avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.