# eureka-synchronizer

> Synchronize service available on a distant eureka with the local eureka by creating http proxies to distant services

Latest version **2.0.0** (published 2019-12-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install eureka-synchronizer
pnpm add eureka-synchronizer
yarn add eureka-synchronizer
bun add eureka-synchronizer
```

Provides the command `eureka-synchronizer`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2019-12-20 |
| First published | 2017-12-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 20 |
| Unpacked size | 1.4 MB |
| Known vulnerabilities | 0 (+29 in 4 direct dependencies) |
| Install scripts | no |
| Author | F. Boisselier |
| Maintainers | fboisselier52 |

## Links

- npm: https://www.npmjs.com/package/eureka-synchronizer
- Repository: https://gitlab.com/fboisselier52/eureka-synchronizer
- Homepage: https://gitlab.com/fboisselier52/eureka-synchronizer#readme
- Issues: https://gitlab.com/fboisselier52/eureka-synchronizer/issues
- npm.io page: https://npm.io/package/eureka-synchronizer

## Dependencies (20)

- [ip](https://npm.io/package/ip.md) ^1.1.5
- [flat](https://npm.io/package/flat.md) ^5.0.0
- [rxjs](https://npm.io/package/rxjs.md) ^6.5.3
- [axios](https://npm.io/package/axios.md) ^0.19.0
- [rimraf](https://npm.io/package/rimraf.md) ^3.0.0
- [http-proxy](https://npm.io/package/http-proxy.md) ^1.18.0
- [underscore](https://npm.io/package/underscore.md) ^1.9.1
- [@nestjs/core](https://npm.io/package/@nestjs/core.md) ^6.10.12
- [@oclif/config](https://npm.io/package/@oclif/config.md) ^1.13.3
- [@oclif/errors](https://npm.io/package/@oclif/errors.md) ^1.2.2
- [@oclif/parser](https://npm.io/package/@oclif/parser.md) ^3.8.4
- [nest-schedule](https://npm.io/package/nest-schedule.md) ^0.6.3
- [@nestjs/common](https://npm.io/package/@nestjs/common.md) ^6.10.12
- [@oclif/command](https://npm.io/package/@oclif/command.md) ^1.5.19
- [eureka-js-client](https://npm.io/package/eureka-js-client.md) ^4.5.0
- [reflect-metadata](https://npm.io/package/reflect-metadata.md) ^0.1.13
- [https-proxy-agent](https://npm.io/package/https-proxy-agent.md) ^4.0.0
- [@oclif/plugin-help](https://npm.io/package/@oclif/plugin-help.md) ^2.2.3
- [nestjs-console-oclif](https://npm.io/package/nestjs-console-oclif.md) 1.0.3
- [@kubernetes/client-node](https://npm.io/package/@kubernetes/client-node.md) ^0.11.0

## Recent versions

- 2.0.0 (latest) — 2019-12-20
- 1.2.1 — 2018-01-16
- 1.2.0 — 2018-01-09
- 1.1.0 — 2018-01-08
- 1.0.0 — 2017-12-20
- 0.0.0 — 2017-12-20

## README

# Eureka Proxy

Declare in local eureka all services of another eureka with http proxies to each service.

# Usage

## Installing
```
npm install -g eureka-synchronizer
```

## Start
```
eureka-synchronizer --help
```

```
Synchronize service available on a distant eureka or kubernetes with the local eureka by creating http proxies to distant services

USAGE
  $ nestjs-console-oclif TARGET

ARGUMENTS
  TARGET  Must be the eureka url or in kubernetes mode the namespace where search services

OPTIONS
  -f, --filter=filter              Allow to filter, with a regexp, the distant services to bind.
  -h, --help                       show CLI help
  -i, --interval=interval          [default: 60] The interval to refresh proxies in seconds.
  -k, --kubernetes                 Enable kubernetes mode. Search services in kubernetes cluster and inject them in eureka.
  -p, --port=port                  [default: 9000] The first port to bind proxies.
  -s, --subDomain=subDomain        Add a sub-domain to each host in eureka. May be useful by the proxy to resolve distant services.
  -x, --proxy=proxy                The proxy to use to contact the eureka.
  --replaceHost=replaceHost        [default: ] Replace value in each host in eureka. It use the sed pattern : /value to replace/final value/
  --replaceService=replaceService  [default: ] Replace value in service name. It use the sed pattern : /value to replace/final value/

EXAMPLES
  $ eureka-synchronizer --help
  $ eureka-synchronizer http://my-distant.eureka.com/eureka/apps
  $ eureka-synchronizer --kubernetes myNamespace
  $ eureka-synchronizer http://my-distant.eureka.com/eureka/apps --replaceHost /.svc/.priv.myCompagny.com/
  $ eureka-synchronizer --kubernetes default --replaceService /-service// --replaceService /-node/-module/
```

### Kubernetes

`eureka-synchronizer` works with kubernetes and imports kubernetes services into your local eureka.

It use `kubectl` command. Check that your kubectl is configured by running : `kubectl cluster-info`

If the command does not work, follow [kubernetes documentation](https://kubernetes.io/docs/tasks/tools/install-kubectl/)

`eureka-synchronizer` will find services in a namespace of the kubernetes cluster. If you want inject services of the `default` namesapce, run the comamnd : `eureka-synchronizer --kubernetes default`

:warning: You need to have the RBAC permissions to make requests to services via [kubectl proxy](https://kubernetes.io/docs/tasks/access-kubernetes-api/http-proxy-access-api/)

### Example

#### Example with a proxy
```
eureka-synchronizer --proxy http://proxy.corporate.com:3128 http://eureka.dev.net/eureka/apps
```

#### Example with interval, port and filter (name which start with `CORP_SERV_`)
```
eureka-synchronizer -i 30 -p 9000 -f "^CORP_SERV_" http://eureka.dev.net/eureka/apps
```

#### Example with kubernetes cluster and mapping of service names
```
eureka-synchronizer --kubernetes default --replaceService /-service// --replaceService /-node/-module/
```

This command will search services defined in the namespace `default` and map the services name by removing `-service` string and replace in the services name `-node` by `-module`.

---
_Source: https://npm.io/package/eureka-synchronizer · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
