0.1.1 • Published 7 years ago

@mig-frankfurt/adonis-eureka v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
7 years ago

Adonis Eureka npm (scoped) license

:package: ServiceProvider for registering an AdonisJs Application with Netflix Eureka

Adonis Eureka is a Service Provider for registering an AdonisJs 4 application with Eureka built by Netflix. It also works with the Spring Cloud powered version of Eureka.

Built on top of eureka-js-client for Node.js.

:warning: NOTE: This package is under heavy development!

:hand: Requirements

  • AdonisJs >= 4.0
  • Adonis Ignitor ($ adonis install @adonisjs/ignitor)

:hammer: Setup

Install via adonis

$ adonis install @mig-frankfurt/adonis-eureka

Register Provider

const providers = [
  '@mig-frankfurt/adonis-eureka/providers/EurekaProvider'
]

This ServiceProvider will be available under the namespace 'MigFrankfurt/Adonis/Eureka'

Use hook

If not already existent, create /start/hooks.js

const { hooks } = require('@adonisjs/ignitor')

hooks.after.httpServer(() => {
  const Eureka = use('MigFrankfurt/Adonis/Eureka')
  Eureka.start()
})

:wrench: Configuration

Config will be copied during installation to /config/eureka.js

KeyEnvDefaultDescription
eureka.defaultAccessMethodEUREKA_DEFAULT_ACCESS_METHOD'byAppName'Define the default access method for other instances. Possible: 'byAppName' or 'byVipAddr'
eureka.server.hostEUREKA_SERVER_HOST'localhost'Hostname of the Eureka Server
eureka.server.portEUREKA_SERVER_PORT8761Port of the Eureka Server
eureka.server.servicePathEUREKA_SERVER_SERVICE_PATH'/eureka/apps/'ServicePath of the Eureka Server
eureka.instance.appNameEUREKA_INSTANCE_APP_NAME'AdonisJs Instance'Instance name shown in Eureka
eureka.instance.hostnameEUREKA_INSTANCE_HOSTNAME'localhost'Hostname of the instance
eureka.instance.ipAddrEUREKA_INSTANCE_IP_ADDRESSENV('HOST')IP address of the instance
eureka.instance.portEUREKA_INSTANCE_PORTENV('PORT')Port of the instance
eureka.instance.vipAddrEUREKA_INSTANCE_VIP_ADDRESSS'adonisjs.instance'Vip address of the instance
eureka.instance.dataCenterInfoNameEUREKA_INSTANCE_DATACENTER_INFO_NAME'MyOwn'Datacenter Info Name of the Instance

:satellite: Api

Start Eureka

const Eureka = use('MigFrankfurt/Adonis/Eureka')
Eureka.start()

Stop Eureka

const Eureka = use('MigFrankfurt/Adonis/Eureka')
Eureka.stop()

Get instances by app name

const Eureka = use('MigFrankfurt/Adonis/Eureka')
const instances = Eureka.getInstances('SERVICENAME') // if eureka.defaultAccessMethod === 'byAppName'
// or
const instances = Eureka.getInstancesByAppName('SERVICENAME')

Get instances by vip address

const Eureka = use('MigFrankfurt/Adonis/Eureka')
const instances = Eureka.getInstances('VIPADDR') // if eureka.defaultAccessMethod === 'byVipAddr'
// or
const instances = Eureka.getInstancesByVipAddr('VIPADDR')

:hospital: Developed by

Medical Informatics Group (MIG)\ University Hospital Frankfurt\ Theodor-Stern-Kai 7\ 60590 Frankfurt\ https://mig-frankfurt.de

Maintained by: Patric Vormstein (vormstein@med.uni-frankfurt.de)

:page_with_curl: License

MIT License

Copyright (c) 2017 Medical Informatics Group (MIG) Frankfurt

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

0.1.1

7 years ago

0.1.0

7 years ago

0.0.13

7 years ago

0.0.12

7 years ago

0.0.11

7 years ago

0.1.0-alpha.1

7 years ago

0.0.10

7 years ago

0.0.9

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago