# @simtopy/moleculer-simple-runner

> A simple runner for moleculer, purposed to run within containers and for testing multi-process environment

Latest version **1.0.7** (published 2022-07-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install @simtopy/moleculer-simple-runner
pnpm add @simtopy/moleculer-simple-runner
yarn add @simtopy/moleculer-simple-runner
bun add @simtopy/moleculer-simple-runner
```

Provides the command `run-moleculer`.

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.7 |
| Published | 2022-07-28 |
| First published | 2021-08-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 51.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Lucas E. VINCENT |
| Maintainers | emarechal, brumaire |
| Keywords | moleculer |

## Links

- npm: https://www.npmjs.com/package/@simtopy/moleculer-simple-runner
- Repository: https://gitlab.com/simtopy/moleculer-simple-runner
- Homepage: https://gitlab.com/simtopy/moleculer-simple-runner#readme
- Issues: https://gitlab.com/simtopy/moleculer-simple-runner/issues
- npm.io page: https://npm.io/package/@simtopy/moleculer-simple-runner

## Dependencies (4)

- [ajv](https://npm.io/package/ajv.md) ^8.6.2
- [dotenv](https://npm.io/package/dotenv.md) ^10.0.0
- [moleculer](https://npm.io/package/moleculer.md) ^0.14.16
- [moleculer-repl](https://npm.io/package/moleculer-repl.md) ^0.6.6

## Recent versions

- 1.0.7 (latest) — 2022-07-28
- 1.0.5 — 2021-12-14
- 1.0.4 — 2021-12-13
- 1.0.3 — 2021-12-08
- 1.0.2 — 2021-12-08
- 1.0.1 — 2021-11-10
- 1.0.0 — 2021-09-02
- 0.0.9 — 2021-09-02
- 0.0.8 — 2021-09-02
- 0.0.6 — 2021-09-01
- 0.0.5 — 2021-09-01
- 0.0.4 — 2021-08-31
- 0.0.3 — 2021-08-31
- 0.0.1 — 2021-08-31

## README

# moleculer-simple-runner

A simple runner for **moleculer**, designed to easily test applications in a **multi-process environment** to trooblesoot message brokers and system configuration

## Purpose

We make an intensive use of **moleculer** in our project Simtopy as its design allows flexibility and scalability. To build a strong test policy, we needed to be as close as a real production environment where the microservices are isolated each in their own container, but we still wanted something more lightweight and handy than running containers for integration tests.
Therefore we developped this runner to fit our needs regarding these matters. it allows to isolate each microservice in its own process by using forks.

In addition, we wanted something more lighweight and simple than the full featured moleculer-moleculer to start our service in containers in production environment, so we provided this runner with both a fork and non-fork mode.

## Maintainers

*   Lucas Vincent
*   Ewen Marechal

## Licence

This software is distributed under MIT Licence, feel free to share, modify, fork, reuse of contribute

## Quickstart

### As a standalone process

```bash
npm install moleculer-simple-runner

SERVICES="service1,service2",
SERVICES_DIR="my_services_dir_1:my_services_dir_2"
MOLECULER_REPL_MODE="true" # useful when you start the runner in a dev/pre-prod environment for various audit and testing

run-moleculer
```

### Within a script

```js
import createRunner from "moleculer-simple-runner"

const runnerOptions = {
  SERVICES="service1,service2",
  SERVICES_DIR="my_services_dir_1:my_services_dir_2"
}

// create the broker on the scipt process
let localRunner = await createRunner(runnerOptions)

// create the broker on a forked process
let forkedRunner = await createRunner(runnerOptions, "fork-process-nodeID") // set the second argument to true to used the process pid as a nodeID

// start the broker through the runner api
await localRunner.start()
```

## Configuration

Environement variables / config string :\
MOLECULER_REPL_MODE:\
If set to anything else than a false value, will enter the moleculer repl after the broker start\
SERVICES_DIR:\
One or many directories to search for moleculer services, separated by ":"\
SERVICES :\
whitelist of modules to run, separated by a comma\
EXCLUDED-SERVICES:\\
blacklist of services, separated by a comm\
BROKER_CONFIG: \
path to the broker js config object module\
RUNNER_ENV :\
either a string path to an env file (see dotenv), or a js object to set env variables
RUNNER_ENV_OVERRIDES:\
Overrides the previous env if necessary (when using a base conf + specific conf for services)

---
_Source: https://npm.io/package/@simtopy/moleculer-simple-runner · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
