# software-orchestration

> Provision software to remote servers and local virtual machines.

Latest version **1.1.3** (published 2021-06-08) · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install software-orchestration
pnpm add software-orchestration
yarn add software-orchestration
bun add software-orchestration
```

Provides the command `software-orchestration`.

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.1.3 |
| Published | 2021-06-08 |
| First published | 2020-12-16 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 15 |
| Unpacked size | 47.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | baselwebdev |

## Links

- npm: https://www.npmjs.com/package/software-orchestration
- npm.io page: https://npm.io/package/software-orchestration

## Dependencies (15)

- [chalk](https://npm.io/package/chalk.md) ^4.1.0
- [execa](https://npm.io/package/execa.md) ^4.1.0
- [yargs](https://npm.io/package/yargs.md) ^15.4.1
- [js-yaml](https://npm.io/package/js-yaml.md) ^3.14.1
- [fs-extra](https://npm.io/package/fs-extra.md) ^9.0.1
- [jsonfile](https://npm.io/package/jsonfile.md) ^6.1.0
- [node-ssh](https://npm.io/package/node-ssh.md) ^10.0.2
- [typescript](https://npm.io/package/typescript.md) ^4.1.3
- [@types/node](https://npm.io/package/@types/node.md) 14.0.20
- [@types/ssh2](https://npm.io/package/@types/ssh2.md) ^0.5.46
- [@types/execa](https://npm.io/package/@types/execa.md) ^2.0.0
- [@types/yargs](https://npm.io/package/@types/yargs.md) ^15.0.11
- [@types/js-yaml](https://npm.io/package/@types/js-yaml.md) ^3.12.5
- [@types/fs-extra](https://npm.io/package/@types/fs-extra.md) ^9.0.5
- [@types/jsonfile](https://npm.io/package/@types/jsonfile.md) ^6.0.0

## Recent versions

- 1.1.3 (latest) — 2021-06-08
- 1.1.2 — 2021-05-09
- 1.1.1 — 2021-05-09
- 1.1.0 — 2021-05-03
- 1.0.2 — 2021-02-14
- 1.0.1 — 2020-12-16

## README

# Software orchestration

Provision software to remote servers and local virtual machines.

You can use this library to provision your remote infrastructure and  also utilise the same provisioning logic to your local virtual machine set up.

This repo used to be part of an internal monolithic software I developed for a personal project.

They have been open-sourced and split into three repos:

- [Repo retriever](https://github.com/baselwebdev/repo-retriever)

- [Software orchestration](https://github.com/baselwebdev/software-orchestration)

- [Infrastructure management](https://github.com/baselwebdev/infrastructure-management)

## TODO

- [ ] Add tests and get 100% test coverage

## Install

Install with [npm](https://www.npmjs.com/):

```sh
$ npm install software-orchestration
```

## Usage

Using the CLI

```sh
$ node bin/cli.js --help
Options:
  --help                   Show help                                   [boolean]
  --version                Show version number                         [boolean]
  --target, -t             Specify in which target environment the software
                           should be installed into.                    [string]
  --resourceDirectory, -d  Specify the resource directory absolute path. The resource
                           directory contains your commands, files you want to
                           upload and the ssh config file    [string] [required]
```

The resource directory:

```
root
│   commands.yaml
│
└─── files
    │   my_code.zip
    │   nginx.conf
    │   etc...
```

Define your commands to run on the VM and server in the commands.yaml file.

The commands.yaml file supports variables.

You can define optional pre-provision command that is unique to remote and local.

You can define optional post-provision command that is unique to remote and local.

The commands.yaml file example:

```yaml
variables:
  install: 'sudo yum install -q -y'
  node: '14.x'

preProvision:
  remote:
    - 'echo "export URL=test.com" >> ~/.bashrc'
    - 'mkdir /test.com'/
    - 'cd ~; unzip my_code.zip'
    - 'cd ~; sudo mv my_code/* /teast.com/'

  local:
    - 'echo "export URL=test-local.com" >> ~/.bashrc'

provision:
  - 'sudo yum update -q -y'
  # Enable software repos.
  - 'sudo amazon-linux-extras enable nginx1'
  # Install Nginx
  - '{{install}} nginx'
  # Add NodeJs mirror
  - '{{directory}} curl -sL https://rpm.nodesource.com/setup_{{node}} | sudo bash -'
  # Install nodejs
  - '{{install}} nodejs'
  # Install modules
  - 'cd /test.com/; npm install'

postProvision:
  remote:
    - 'cd /test.com/; npm run tests'
```

Please use the absolute path for privateKey.

You can 1 or more targets defined.

In the following example I am using one remote and local type target.

The ssh.json file example:

```json
{
  "target": [
    {
      "type": "remote",
      "host": "18.133.156.8",
      "username": "ec2-user",
      "privateKey": "my_key.pem"
    },
    {
      "type": "local",
      "host": "192.168.100.9",
      "username": "vagrant",
      "privateKey": "private_key"
    }
  ]
}
```

Software orchestration running:

![Redeploy in action](https://baselwebdevgifs.s3.eu-west-2.amazonaws.com/software-orchestration/infrastructure-orchestration-running.gif)

## About

### Contributing

Pull requests are always welcome. 

For bugs and feature requests, [please create an issue](../../issues/new).

### Author

**Basel Ahmed**

* [github/baselwebdev](https://github.com/baselwebdev)
* [twitter/baselwebdev](https://twitter.com/baselwebdev)

### License

Copyright © 2020, [Basel Ahmed](https://github.com/baselwebdev).
Released under the [MIT License](LICENSE).

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