fastybird/gateway-node

FastyBird IOT server API gateway node for accessing to nodes

dev-master 2020-09-11 07:37 UTC

This package is auto-updated.

Last update: 2020-10-11 07:49:32 UTC


README

Build Status Code coverage PHP from Travis config Licence Downloads total Latest stable PHPStan

What is FastyBird gateway node?

Gateway node is a core microservice for controlling whole ecosystem of FastyBird ecosystem via {JSON:API} interface.

FastyBird gateway node is an Apache2 licensed distributed microservice, developed in PHP with Nette framework.

Requirements

FastyBird gateway node is tested against PHP 7.4 and ReactPHP http 0.8 event-driven, streaming plaintext HTTP server and RabbitMQ 3.7 message broker

Getting started

NOTE: If you don't want to install it manually, try docker image

The best way to install fastybird/gateway-node is using Composer. If you don't have Composer yet, download it following the instructions. Then use command:

$ composer create-project --no-dev fastybird/gateway-node path/to/install
$ cd path/to/install

Everything required will be then installed in the provided folder path/to/install

This microservice is composed from one console command.

HTTP server
$ vendor/bin/fb-console fb:node:server:start

This server is listening for incoming http api request messages from clients. And also is listening for new data from exchange bus from other microservices.

Install with docker

Docker Image Version (latest by date) Docker Image Size (latest by date) Docker Cloud Build Status

Docker image: fastybird/gateway-node

Use docker hub image

$ docker run -d -it --name gateway fastybird/gateway-node:latest

Generate local image

$ docker build --tag=gateway-node .
$ docker run -d -it --name gateway-node gateway-node

Configuration

This microservices is preconfigured for default connections, but your infrastructure could be different.

Configuration could be made via environment variables:

Environment Variable Description
FB_NODE_PARAMETER__DATABASE_VERSION=5.7 MySQL server version
FB_NODE_PARAMETER__DATABASE_HOST=127.0.0.1 MySQL host address
FB_NODE_PARAMETER__DATABASE_PORT=3306 MySQL access port
FB_NODE_PARAMETER__DATABASE_DBNAME=gateway_node MySQL database name
FB_NODE_PARAMETER__DATABASE_USERNAME=root Username
FB_NODE_PARAMETER__DATABASE_PASSWORD= Password
FB_NODE_PARAMETER__SERVER_ADDRESS=0.0.0.0 HTTP server host address
FB_NODE_PARAMETER__SERVER_PORT=8000 HTTP server access port
FB_NODE_PARAMETER__SECURITY_CORS_ORIGIN=* HTTP server allowed origins
FB_NODE_PARAMETER__SECURITY_CORS_PROTOCOL=http HTTP server origin protocol
FB_NODE_PARAMETER__SECURITY_CORS_DOMAIN=localhost HTTP server origin domain
FB_NODE_PARAMETER__SECURITY_CORS_PORT=8000 HTTP server origin port

NOTE: In case you are not using docker image or you are not able to configure environment variables, you could edit configuration file ./config/default.neon

Initialization

This microservice is using database, so you have to initialise basic database schema. It could be done via shell command:

$ php vendor/bin/doctrine orm:schema-tool:create

After schema is created, you should create api token to protect api endpoints:

$ vendor/bin/fb-console fb:gateway-node:keys:create

And now could be defined routes:

$ vendor/bin/fb-console fb:gateway-node:routes:create

Console command will ask you for all required information.

After this steps, microservice could be started with server command

Feedback

Use the issue tracker for bugs or mail or Tweet us for any idea that can improve the project.

Thank you for testing, reporting and contributing.

Changelog

For release info check release page

Maintainers

1866672?s=460&v=4
Adam Kadlec

Homepage http://www.fastybird.com and repository http://github.com/fastybird/gateway-node.