# iHub Framework (WIP)

> iHub Framework allows you to quickly build nodejs microservices with support for all the stack used by the iHub ecosystem.

# Requirements

You need to have Docker and Docker Compose installed to develope your microservice, you can develop locally with NodeJS 8+ but we strongly discouraged since your service is going to be deployed with kubernetes.

# Installing

First you need to create a .npmrc or change your local npm registry to point for our internal private registry:

`registry=https://registry.infracommerce.com.br/repository/npm-local/`

Then on your project folder:

```bash
$ npm i -S ihub-framework-ts
```

# Graceful Shutdown

The framework treats the shutting down as graceful so we wont lose any data. The ideal is to monitor and adjust the SIGTERM timeout according to each application, the default timeout of docker commands is 10 seconds but depending of your application this time can not be enough, so this must be profiled and align with the responsible of deployment so he can make the correct adjustments.

If you like to test your application and change the docker timeout:

```bash
docker stop ----time=30 foo
```

# Environment Variables

## Project
PROJECT_NAME
NODE_ENV

## Logger

### Elasticsearch
LOGGER_ELASTICSEARCH_ENABLED
LOGGER_ELASTICSEARCH_URL
LOGGER_ELASTICSEARCH_LEVEL

### Console
LOGGER_CONSOLE_LEVEL