Public | Automated Build

Last pushed: 3 days ago
Short Description
Short description is empty for this repo.
Full Description

island v1.5

An opinionated, full-stacked Microservices framework for node, powered by TypeScript.







import * as island from 'island';
import * as keeper from 'island-keeper';
import { EndpointController } from './controller/endpoint.controller';
import { EventController } from './controller/event.controller';

const serviceName = 'hawaii';

class HawaiiIslet extends island.Islet {
  main() {
    const islandKeeper = keeper.IslandKeeper.getInst();
    islandKeeper.init('consul', 'island');
    islandKeeper.setServiceName(serviceName);

    const amqpChannelPoolAdapter = new island.AmqpChannelPoolAdapter({url: 'amqp://rabbitmq:5672'});
    this.registerAdapter('amqpChannelPool', amqpChannelPoolAdapter);
    const rpcAdapter = new island.RPCAdapter({amqpChannelPoolAdapter, serviceName});
    rpcAdapter.registerController(EndpointController);
    this.registerAdapter('rpc', rpcAdapter);

    const eventAdapter = new island.EventAdapter({amqpChannelPoolAdapter, serviceName});
    eventAdapter.registerController(EventController);
    this.registerAdapter('event', eventAdapter);
  }
}

island.Islet.run(HawaiiIslet);

Table of Contents

Installation

$ npm install island --save

Features

  • Free from service discovery
  • Support various types of communication
    • RPC(strong link between islands)
    • Event(weak link between islands)
    • Push messaging(to user) via socket.io
  • Ensure that each island gets proper parameters
  • Track communications per each request
  • Chain contexts with UUID per each request

v1.2

Changes

  • Support to expand langid from property name for @validate @sanitize #69
  • Fix singleton bug #64

v1.0

Changes

Breaking Changes

Building

In order to build the island, ensure that you have Git and Node.js installed.

Clone a copy of the repo:

$ git clone https://github.com/spearhead-ea/island.git

Change to the island directory:

$ cd island

Install prerequisites and dev dependencies:

$ npm install -g gulp typescript
$ npm install

Tests

To run the test suite, first install the dependencies, then run npm test:

$ npm install
$ RABBITMQ_HOST=localhost npm test

Environment Variables

Environments Type Default Notes LegacyKeys
ISLAND_SERVICE_NAME string 'no-service-name' 'SERVICE_NAME'
ISLAND_HOST_NAME string 'no-host-name' TraceLog uses this as a name of node 'HOSTNAME'
ISLAND_USE_DEV_MODE boolean false When true, allows APIs which has options.developmentOnly 'USE_DEV_MODE'
ISLAND_SERIALIZE_FORMAT_PUSH string 'msgpack' currently able Push format json and msgpack 'SERIALIZE_FORMAT_PUSH'
ISLAND_EVENT_PREFETCH number 100 'EVENT_PREFETCH'
ISLAND_RPC_PREFETCH number 100 Count of RPC Prefetch 'RPC_PREFETCH'
ISLAND_RPC_EXEC_TIMEOUT_MS number 25000 Timeout during RPC execution
ISLAND_RPC_WAIT_TIMEOUT_MS number 60000 Timeout during RPC call
ISLAND_SERVICE_LOAD_TIME_MS number 60000 Time to load service
ISLAND_LOGGER_LEVEL string 'info' Log level for logger
ISLAND_LOGGER_TYPE string 'short'
ISLAND_RPC_RES_NOACK boolean false
ISLAND_NO_REVIVER boolean false 'NO_REVIVER'
ISLAND_STATUS_EXPORT boolean false If it is true, use island-status-exporter 'STATUS_EXPORT'
ISLAND_STATUS_EXPORT_TIME_MS number 10 * 1000 Time to save file for instance status 'STATUS_EXPORT_TIME_MS'
ISLAND_STATUS_FILE_NAME string island-status-exporter uses this as a name for file 'STATUS_FILE_NAME'
ISLAND_STATUS_EXPORT_TYPE string 'FILE' status-exporter uses this type for saving data 'STATUS_EXPORT_TYPE'
ISLAND_TRACEMQ_HOST string MQ(formatted by amqp URI) for TraceLog. If omitted it doesn't log
ISLAND_TRACEMQ_QUEUE string 'trace' A queue name to log TraceLog
ISLAND_TRACE_HEADER_LOG boolean false When true, add trace log to msg.header
ISLAND_ENDPOINT_SESSION_GROUP string 'ENDPOINT_SESSION_GROUP'
ISLAND_CONSUL_HOST string 'consul' The address of consul. 'CONSUL_HOST'
ISLAND_CONSUL_PORT string '8500' consul port. work with CONSUL_HOST 'CONSUL_PORT'
ISLAND_CONSUL_NAMESPACE string 'CONSUL_NAMESPACE'
ISLAND_CONSUL_TOKEN string 'CONSUL_TOKEN'
ISLAND_RABBITMQ_HOST string 'amqp://rabbitmq:5672' The address of rabbitmq. 'RABBITMQ_HOST'
ISLAND_RABBITMQ_PUSH_HOST string 'RABBITMQ_PUSH_HOST'
ISLAND_RABBITMQ_RPC_HOST string 'RABBITMQ_RPC_HOST'
ISLAND_RABBITMQ_EVENT_HOST string 'RABBITMQ_EVENT_HOST'
ISLAND_RABBITMQ_POOLSIZE number 100 'RABBITMQ_POOLSIZE'
ISLAND_REDIS_AUTH string 'REDIS_AUTH'
ISLAND_REDIS_HOST string 'redis' The address of redishost. 'REDIS_HOST'
ISLAND_REDIS_PORT number 6379 'REDIS_PORT'
ISLAND_MONGO_HOST string 'mongodb://mongodb:27017' 'MONGO_HOST'
ISLAND_RPC_DISTRIB_SIZE number 16
ISLAND_USE_CIRCUIT_BREAK boolean false
ISLAND_CIRCUIT_BREAK_TIME_MS number 60 * 1000
ISLAND_CIRCUIT_BREAK_FAILRATE_THRESHOLD number 0.2
ISLAND_CIRCUIT_BREAK_REQUEST_THRESHOLD number 10
ISLAND_FLOWMODE_DELAY number 10000

Milestones

For details on our planned features and future direction please refer to our milestones

People

The original author of island is Wonshik Kim

The current lead maintainer is Kei Son

List of all contributors

License

MIT

Docker Pull Command
Owner
wokim
Source Repository