Skip to content

Commit

Permalink
feat: add configs for workers (worker.yaml), direct hosting (hosts.ya…
Browse files Browse the repository at this point in the history
…ml) and deployment result (deployed.yaml). Add command for worker deployment. Add command for showing versions of used dependencies. Fix issue with circular imports [fixes DXJ-246 DXJ-247 DXJ-259 DXJ-249 DXJ-270] (#141)

* feat: add configs for workers (worker.yaml), direct hosting (hosts.yaml) and deployment result (deployed.yaml). Add command for worker deployment
Add command for showing versions of used dependencies
Fix issue with circular imports [fixes DXJ-246 DXJ-247 DXJ-259 DXJ-249 DXJ-270]

* hopefully fix tests

* change posttest to pretest

* Update package.json

* readme

* unhide and fix description for workers deploy command

* correct description for workers.yaml

* fix contributing.md
  • Loading branch information
shamsartem committed Feb 15, 2023
1 parent 95a70ec commit 2659d9d
Show file tree
Hide file tree
Showing 107 changed files with 7,995 additions and 1,042 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ oclif.manifest.json
# for ease of development
/fluence.yaml
/fluence-lock.yaml
/hosts.yaml
/workers.yaml
src/aqua
src/services
src/ts
Expand All @@ -28,3 +30,6 @@ schemas
.vscode/settings.json
src/ts/src/aqua
src/js/src/aqua

# ignore compiled files
src/lib/compiled-aqua/installation-spell/air
11 changes: 6 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@ Things you need to know:

When you contribute, you have to be aware that your contribution is covered by **[Apache License 2.0](./LICENSE)**, but might relicensed under few other software licenses mentioned in the **Contributor License Agreement**. In particular, you need to agree to the Contributor License Agreement. If you agree to its content, you simply have to click on the link posted by the CLA assistant as a comment to the pull request. Click it to check the CLA, then accept it on the following screen if you agree to it. The CLA assistant will save this decision for upcoming contributions and will notify you if there is any change to the CLA in the meantime.

## Technical guidelines
## Guidelines for contributors

- To use fluence-cli in the development mode, run: `./bin/dev.js` (types are not checked in development mode because it's faster and more convenient to work with. Use typechecking provided by your IDE during development)
- To use fluence-cli in the production mode, run `npm run build` first, then run: `./bin/run.js`. If you want to make sure you are running the actual package the users will use, do `npm run build`, `npm pack` and install this tar package (the approach is used for tests)
- **First** commit in your PR or PR title must use [Conventional Commits](https://www.conventionalcommits.org/) (optionally end your commit message with: `[fixes DXJ-000 DXJ-001]`. Where `DXJ-000` and `DXJ-001` are ids of the Linear issues that you were working on)
- To use Fluence CLI in the development mode, run: `./bin/dev.js` (types are not checked in development mode because it's faster and more convenient to work with. Use typechecking provided by your IDE during development)
- To use Fluence CLI in the production mode, run `npm run build` first, then run: `./bin/run.js`. If you want to make sure you are running the actual package the users will use, do `npm run build`, `npm pack` and install this tar package (the approach is used for tests)
- Don't name arguments or flags with names that contain underscore symbols because autogenerated links in markdown will not work
- pre-commit runs each time before you commit. It attempts to build and lint your project, runs prettier and generates this README.md file that you are reading right now.
- pre-commit runs each time before you commit. It attempts to build and lint your project, runs prettier and generates docs/commands/README.md file.
- If you are using nvm and want to commit using VSCode, place `.huskyrc` file to your home directory
- Don't export anything from command files except for the command itself. If you need to share code between commands - create a separate file
- Avoid using `this` in commands except for inside `initCli` function. This style is easier to understand and there will be less stuff to refactor if instead of using methods on command object you simply use separate functions which can later be moved outside into a separate module for reuse in other commands
- Use `commandObj.error` for human readable errors. They will be reported to analytics as events. Use `throw new Error` (or `assert`) for unexpected errors. They will be reported to analytics as crashes.
- Don't use colors inside commands descriptions. They can't be rendered to markdown and they will not be rendered to users of the packaged fluence-cli anyway, when they run `--help`
- Don't use colors inside commands descriptions. They can't be rendered to markdown and they will not be rendered to users of the packaged Fluence CLI anyway, when they run `--help`
2 changes: 1 addition & 1 deletion bin/dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ oclif.settings.debug = true;
oclif
.run(process.argv.slice(2), import.meta.url)
.then(oclif.flush)
.catch((error) => createErrorPromise(error, oclif.Errors.handle));
.catch((error) => createErrorPromise(error));
3 changes: 2 additions & 1 deletion bin/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ import { createErrorPromise } from "../dist/countlyInterceptor.js";
oclif
.run(process.argv.slice(2), import.meta.url)
.then(oclif.flush)
.catch((error) => createErrorPromise(error, oclif.Errors.handle));
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
.catch((error) => createErrorPromise(error));
49 changes: 48 additions & 1 deletion docs/commands/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* [`fluence dependency cargo install [PACKAGE-NAME | PACKAGE-NAME@VERSION]`](#fluence-dependency-cargo-install-package-name--package-nameversion)
* [`fluence dependency install`](#fluence-dependency-install)
* [`fluence dependency npm install [PACKAGE-NAME | PACKAGE-NAME@VERSION]`](#fluence-dependency-npm-install-package-name--package-nameversion)
* [`fluence dependency versions`](#fluence-dependency-versions)
* [`fluence deploy`](#fluence-deploy)
* [`fluence help [COMMANDS]`](#fluence-help-commands)
* [`fluence init [PATH]`](#fluence-init-path)
Expand All @@ -24,6 +25,7 @@
* [`fluence service new [PATH]`](#fluence-service-new-path)
* [`fluence service remove [NAME | PATH | URL]`](#fluence-service-remove-name--path--url)
* [`fluence service repl [NAME | PATH | URL]`](#fluence-service-repl-name--path--url)
* [`fluence workers deploy`](#fluence-workers-deploy)

## `fluence aqua`

Expand Down Expand Up @@ -88,7 +90,7 @@ EXAMPLES
$ fluence autocomplete --refresh-cache
```

_See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/v1.4.5/src/commands/autocomplete/index.ts)_
_See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/v1.4.6/src/commands/autocomplete/index.ts)_

## `fluence build`

Expand Down Expand Up @@ -241,6 +243,28 @@ EXAMPLES
$ fluence dependency npm install
```

## `fluence dependency versions`

Get versions of all currently used dependencies

```
USAGE
$ fluence dependency versions [--no-input]
FLAGS
--no-input Don't interactively ask for any input from the user
DESCRIPTION
Get versions of all currently used dependencies
ALIASES
$ fluence dependency v
$ fluence dep v
EXAMPLES
$ fluence dependency versions
```

## `fluence deploy`

Deploy application, described in fluence.yaml
Expand Down Expand Up @@ -619,4 +643,27 @@ DESCRIPTION
EXAMPLES
$ fluence service repl
```

## `fluence workers deploy`

Deploy workers to hosts, described in hosts.yaml

```
USAGE
$ fluence workers deploy [--no-input] [--relay <value>] [--force] [--timeout <value>] [-k <value>] [--aqua-logs]
FLAGS
-k, --key-pair-name=<name> Key pair name
--aqua-logs Enable Aqua logs
--force Force removing of previously deployed app
--no-input Don't interactively ask for any input from the user
--relay=<multiaddr> Relay node multiaddr
--timeout=<milliseconds> Timeout used for command execution
DESCRIPTION
Deploy workers to hosts, described in hosts.yaml
EXAMPLES
$ fluence workers deploy
```
<!-- commandsstop -->
11 changes: 10 additions & 1 deletion docs/configs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,13 @@ Defines global config for Fluence CLI
Defines user's secret keys that can be used across different Fluence projects. You can manage user's keys using commands from `fluence key` group of commands with `--user` flag
## [project-secrets.yaml](./project-secrets.md)

Defines project's secret keys that are used only in the scope of this particular Fluence project. You can manage project's keys using commands from `fluence key` group of commands
Defines project's secret keys that are used only in the scope of this particular Fluence project. You can manage project's keys using commands from `fluence key` group of commands
## [workers.yaml](./workers.md)

Defines workers and what they consist of. Currently worker includes a set of services that you want to deploy on a particular peer
## [hosts.yaml](./hosts.md)

Defines which workers to host on which peer IDs
## [deployed.yaml](./deployed.md)

A result of app deployment. This file is created automatically after successful deployment using `fluence workers deploy` command
2 changes: 1 addition & 1 deletion docs/configs/app-properties-relays.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## relays Type

any of the folllowing: `string` or `array` ([Relays](app-properties-relays.md))
any of the following: `string` or `array` ([Relays](app-properties-relays.md))

one (and only one) of

Expand Down
4 changes: 2 additions & 2 deletions docs/configs/app.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ Relays that you can connect to to find the peers where services are deployed

* is optional

* Type: any of the folllowing: `string` or `array` ([Relays](app-properties-relays.md))
* Type: any of the following: `string` or `array` ([Relays](app-properties-relays.md))

* cannot be null

* defined in: [app.yaml](app-properties-relays.md "https://fluence.dev/schemas/app.yaml#/properties/relays")

### relays Type

any of the folllowing: `string` or `array` ([Relays](app-properties-relays.md))
any of the following: `string` or `array` ([Relays](app-properties-relays.md))

one (and only one) of

Expand Down
11 changes: 11 additions & 0 deletions docs/configs/deployed-properties-version.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## version Type

`number`

## version Constraints

**constant**: the value of this property must be equal to:

```json
0
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## host\_id Type

`string`
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## spell\_id Type

`string`
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## worker\_id Type

`string`
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
## items Type

`object` ([Details](deployed-properties-workers-items-properties-installation_spells-items.md))

# items Properties

| Property | Type | Required | Nullable | Defined by |
| :----------------------- | :------- | :------- | :------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [host\_id](#host_id) | `string` | Required | cannot be null | [deployed.yaml](deployed-properties-workers-items-properties-installation_spells-items-properties-host_id.md "https://fluence.dev/schemas/deployed.yaml#/properties/workers/items/properties/installation_spells/items/properties/host_id") |
| [spell\_id](#spell_id) | `string` | Required | cannot be null | [deployed.yaml](deployed-properties-workers-items-properties-installation_spells-items-properties-spell_id.md "https://fluence.dev/schemas/deployed.yaml#/properties/workers/items/properties/installation_spells/items/properties/spell_id") |
| [worker\_id](#worker_id) | `string` | Required | cannot be null | [deployed.yaml](deployed-properties-workers-items-properties-installation_spells-items-properties-worker_id.md "https://fluence.dev/schemas/deployed.yaml#/properties/workers/items/properties/installation_spells/items/properties/worker_id") |

## host\_id



`host_id`

* is required

* Type: `string`

* cannot be null

* defined in: [deployed.yaml](deployed-properties-workers-items-properties-installation_spells-items-properties-host_id.md "https://fluence.dev/schemas/deployed.yaml#/properties/workers/items/properties/installation_spells/items/properties/host_id")

### host\_id Type

`string`

## spell\_id



`spell_id`

* is required

* Type: `string`

* cannot be null

* defined in: [deployed.yaml](deployed-properties-workers-items-properties-installation_spells-items-properties-spell_id.md "https://fluence.dev/schemas/deployed.yaml#/properties/workers/items/properties/installation_spells/items/properties/spell_id")

### spell\_id Type

`string`

## worker\_id



`worker_id`

* is required

* Type: `string`

* cannot be null

* defined in: [deployed.yaml](deployed-properties-workers-items-properties-installation_spells-items-properties-worker_id.md "https://fluence.dev/schemas/deployed.yaml#/properties/workers/items/properties/installation_spells/items/properties/worker_id")

### worker\_id Type

`string`
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## installation\_spells Type

`object[]` ([Details](deployed-properties-workers-items-properties-installation_spells-items.md))
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## name Type

`string`
46 changes: 46 additions & 0 deletions docs/configs/deployed-properties-workers-items.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
## items Type

`object` ([Details](deployed-properties-workers-items.md))

# items Properties

| Property | Type | Required | Nullable | Defined by |
| :------------------------------------------- | :------- | :------- | :------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [name](#name) | `string` | Required | cannot be null | [deployed.yaml](deployed-properties-workers-items-properties-name.md "https://fluence.dev/schemas/deployed.yaml#/properties/workers/items/properties/name") |
| [installation\_spells](#installation_spells) | `array` | Required | cannot be null | [deployed.yaml](deployed-properties-workers-items-properties-installation_spells.md "https://fluence.dev/schemas/deployed.yaml#/properties/workers/items/properties/installation_spells") |

## name



`name`

* is required

* Type: `string`

* cannot be null

* defined in: [deployed.yaml](deployed-properties-workers-items-properties-name.md "https://fluence.dev/schemas/deployed.yaml#/properties/workers/items/properties/name")

### name Type

`string`

## installation\_spells

A list of installation spells

`installation_spells`

* is required

* Type: `object[]` ([Details](deployed-properties-workers-items-properties-installation_spells-items.md))

* cannot be null

* defined in: [deployed.yaml](deployed-properties-workers-items-properties-installation_spells.md "https://fluence.dev/schemas/deployed.yaml#/properties/workers/items/properties/installation_spells")

### installation\_spells Type

`object[]` ([Details](deployed-properties-workers-items-properties-installation_spells-items.md))
3 changes: 3 additions & 0 deletions docs/configs/deployed-properties-workers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## workers Type

`object[]` ([Details](deployed-properties-workers-items.md))
54 changes: 54 additions & 0 deletions docs/configs/deployed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
## deployed.yaml Type

`object` ([deployed.yaml](deployed.md))

# deployed.yaml Properties

| Property | Type | Required | Nullable | Defined by |
| :------------------ | :------- | :------- | :------------- | :-------------------------------------------------------------------------------------------------------------- |
| [version](#version) | `number` | Required | cannot be null | [deployed.yaml](deployed-properties-version.md "https://fluence.dev/schemas/deployed.yaml#/properties/version") |
| [workers](#workers) | `array` | Optional | cannot be null | [deployed.yaml](deployed-properties-workers.md "https://fluence.dev/schemas/deployed.yaml#/properties/workers") |

## version



`version`

* is required

* Type: `number`

* cannot be null

* defined in: [deployed.yaml](deployed-properties-version.md "https://fluence.dev/schemas/deployed.yaml#/properties/version")

### version Type

`number`

### version Constraints

**constant**: the value of this property must be equal to:

```json
0
```

## workers

A list of deployed workers

`workers`

* is optional

* Type: `object[]` ([Details](deployed-properties-workers-items.md))

* cannot be null

* defined in: [deployed.yaml](deployed-properties-workers.md "https://fluence.dev/schemas/deployed.yaml#/properties/workers")

### workers Type

`object[]` ([Details](deployed-properties-workers-items.md))
2 changes: 1 addition & 1 deletion docs/configs/fluence-properties-relays.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## relays Type

any of the folllowing: `string` or `array` ([Relays](fluence-properties-relays.md))
any of the following: `string` or `array` ([Relays](fluence-properties-relays.md))

one (and only one) of

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## envs Type

`object` ([Environment variables](fluence-properties-services-service-config-properties-overrides-module-overrides-properties-environment-variables.md))
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## get Type

`string`
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## loggerEnabled Type

`boolean`
Loading

0 comments on commit 2659d9d

Please sign in to comment.