@effectstream/orchestrator 0.100.14 → 0.100.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +123 -0
- package/package.json +3 -2
- package/scripts/launch-celestia.ts +67 -0
- package/test/examples.test.ts +32 -0
package/README.md
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# @effectstream/orchestrator
|
|
2
|
+
|
|
3
|
+
A multi-chain local development environment for EffectStream. One CLI
|
|
4
|
+
starts every dependency a template needs — Postgres / PgLite, Hardhat,
|
|
5
|
+
contracts, Bitcoin Core, Midnight node + indexer + proof server,
|
|
6
|
+
Cardano-side services, Avail node + light client, NEAR sandbox,
|
|
7
|
+
Celestia, plus the EffectStream sync + runtime + batcher — in the right
|
|
8
|
+
order, with health checks.
|
|
9
|
+
|
|
10
|
+
- One CLI that starts every dependency a template needs: DB, chains, sync, runtime, batcher.
|
|
11
|
+
- Dependency-graph aware: runs in parallel where it can, sequential where it must.
|
|
12
|
+
- Disable any chain with `DISABLE_EVM=true`, `DISABLE_BITCOIN=true`, ...
|
|
13
|
+
- Used by every template in this repo and by the E2E runner.
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
bun add @effectstream/orchestrator
|
|
19
|
+
# or
|
|
20
|
+
npm install @effectstream/orchestrator
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Standalone usage
|
|
24
|
+
|
|
25
|
+
The orchestrator is mostly invoked as a CLI from a template's repo
|
|
26
|
+
root:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# Start every process defined in orchestrator.config.ts (or .json)
|
|
30
|
+
bun packages/build-tools/orchestrator/src/cli.ts start
|
|
31
|
+
|
|
32
|
+
# Show what's running and the health of each
|
|
33
|
+
bun packages/build-tools/orchestrator/src/cli.ts status
|
|
34
|
+
|
|
35
|
+
# Stop everything
|
|
36
|
+
bun packages/build-tools/orchestrator/src/cli.ts stop
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Each process is declared in an `OrchestratorConfig` object: its command,
|
|
40
|
+
working directory, environment, the ports/endpoints to watch for
|
|
41
|
+
readiness, and which other processes it depends on. Then the
|
|
42
|
+
orchestrator builds the dependency graph and runs them in parallel where
|
|
43
|
+
possible.
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
import type { OrchestratorConfig } from "@effectstream/orchestrator/config";
|
|
47
|
+
|
|
48
|
+
export const config: OrchestratorConfig = {
|
|
49
|
+
processes: [
|
|
50
|
+
{
|
|
51
|
+
name: "pglite",
|
|
52
|
+
command: ["bun", "run", "@effectstream/db/start-pglite"],
|
|
53
|
+
readiness: { tcp: { port: 5432 } },
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: "hardhat",
|
|
57
|
+
command: ["bun", "run", "hardhat", "node"],
|
|
58
|
+
readiness: { http: { url: "http://127.0.0.1:8545" } },
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: "deploy-contracts",
|
|
62
|
+
command: ["bun", "scripts/deploy.ts"],
|
|
63
|
+
dependsOn: ["hardhat"],
|
|
64
|
+
},
|
|
65
|
+
// …
|
|
66
|
+
],
|
|
67
|
+
};
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Common chain launchers ship as subpath scripts you can compose: `./launch-pglite`,
|
|
71
|
+
`./launch-evm`, `./launch-bitcoin`, `./launch-cardano`, `./launch-midnight`,
|
|
72
|
+
`./launch-avail`, `./launch-near`. Each wraps a pinned binary from a
|
|
73
|
+
package under `packages/binaries/` (e.g. `@effectstream/npm-midnight-node`,
|
|
74
|
+
`@effectstream/bitcoin-core`, `@effectstream/near-sandbox`) with sensible
|
|
75
|
+
defaults.
|
|
76
|
+
|
|
77
|
+
> **Tip:** Disable chains you don't need with env vars: `DISABLE_EVM=true`,
|
|
78
|
+
> `DISABLE_BITCOIN=true`, `DISABLE_MIDNIGHT=true`, etc. Same flags work for
|
|
79
|
+
> the orchestrator and `e2e/runner.ts`.
|
|
80
|
+
|
|
81
|
+
## CLI reference
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
orchestrator start [config] Start processes (daemonised, exposes HTTP API)
|
|
85
|
+
orchestrator status Show process status
|
|
86
|
+
orchestrator restart <name> Restart a named process
|
|
87
|
+
orchestrator stop [name] Stop a named process, or all
|
|
88
|
+
orchestrator list [config] List processes without starting
|
|
89
|
+
orchestrator silence <name...> Suppress terminal output for named processes
|
|
90
|
+
orchestrator unsilence <name...> Resume terminal output
|
|
91
|
+
orchestrator logs [name...] Follow background daemon log files
|
|
92
|
+
|
|
93
|
+
Global flags:
|
|
94
|
+
--port <n> Orchestrator API port (default: 4747)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Inside EffectStream
|
|
98
|
+
|
|
99
|
+
Every template under
|
|
100
|
+
[`templates/`](https://github.com/effectstream/effectstream/tree/main/templates)
|
|
101
|
+
defines an `orchestrator.config.ts` (or `.json`) and starts dev with one
|
|
102
|
+
command. The E2E runner at
|
|
103
|
+
[`e2e/runner.ts`](https://github.com/effectstream/effectstream/blob/main/e2e/runner.ts)
|
|
104
|
+
is the same machinery, serialised across nine chain suites.
|
|
105
|
+
|
|
106
|
+
## Key subpath exports
|
|
107
|
+
|
|
108
|
+
- `@effectstream/orchestrator/config` — `OrchestratorConfig`, `ProcessConfig` types.
|
|
109
|
+
- `@effectstream/orchestrator/resolve-package` — resolve a package's bin to an absolute path (used by launcher scripts).
|
|
110
|
+
- `@effectstream/orchestrator/launch-pglite`, `./launch-evm`, `./launch-bitcoin`, `./launch-cardano`, `./launch-midnight`, `./launch-avail`, `./launch-near` — opinionated launcher scripts for each chain.
|
|
111
|
+
- `@effectstream/orchestrator/wait-tcp`, `./wait-http` — readiness-check helpers.
|
|
112
|
+
|
|
113
|
+
## Examples
|
|
114
|
+
|
|
115
|
+
- Templates: every directory under [`templates/`](https://github.com/effectstream/effectstream/tree/main/templates) ships a working orchestrator config.
|
|
116
|
+
- E2E: [`e2e/`](https://github.com/effectstream/effectstream/tree/main/e2e) drives the orchestrator under the hood.
|
|
117
|
+
|
|
118
|
+
Runnable: [`test/examples.test.ts`](./test/examples.test.ts).
|
|
119
|
+
|
|
120
|
+
## Links
|
|
121
|
+
|
|
122
|
+
- Docs: https://effectstream.github.io/docs/packages/tools/orchestrator
|
|
123
|
+
- Source: https://github.com/effectstream/effectstream/tree/main/packages/build-tools/orchestrator
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effectstream/orchestrator",
|
|
3
|
-
"version": "0.100.
|
|
3
|
+
"version": "0.100.16",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"homepage": "https://effectstream.github.io/docs/",
|
|
6
6
|
"repository": {
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"./launch-cardano": "./scripts/launch-cardano.ts",
|
|
21
21
|
"./launch-midnight": "./scripts/launch-midnight.ts",
|
|
22
22
|
"./launch-avail": "./scripts/launch-avail.ts",
|
|
23
|
+
"./launch-celestia": "./scripts/launch-celestia.ts",
|
|
23
24
|
"./launch-near": "./scripts/launch-near.ts",
|
|
24
25
|
"./wait-tcp": "./scripts/wait-tcp.ts",
|
|
25
26
|
"./wait-http": "./scripts/wait-http.ts"
|
|
@@ -31,7 +32,7 @@
|
|
|
31
32
|
"start": "bun src/cli.ts start"
|
|
32
33
|
},
|
|
33
34
|
"dependencies": {
|
|
34
|
-
"@effectstream/db": "0.100.
|
|
35
|
+
"@effectstream/db": "0.100.16"
|
|
35
36
|
},
|
|
36
37
|
"description": "Multi-chain local development environment for EffectStream"
|
|
37
38
|
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { ProcessConfig } from "../src/config.ts";
|
|
2
|
+
import { resolvePackageDir, type ResolveLocation } from "./resolve-package.ts";
|
|
3
|
+
|
|
4
|
+
export const CelestiaNames = {
|
|
5
|
+
CLEAN: "celestia-clean",
|
|
6
|
+
DEVNET: "celestia-devnet",
|
|
7
|
+
BRIDGE_WAIT: "celestia-bridge-wait",
|
|
8
|
+
FUND: "celestia-fund-bridge",
|
|
9
|
+
} as const;
|
|
10
|
+
|
|
11
|
+
const REQUIRED_SCRIPTS = {
|
|
12
|
+
"celestia-bridge:start": "Start the Celestia consensus node + bridge",
|
|
13
|
+
"celestia-bridge:wait": "Wait for the Celestia bridge RPC to be ready",
|
|
14
|
+
"celestia-fund:bridge": "Fund the bridge node wallet with tokens",
|
|
15
|
+
} as const;
|
|
16
|
+
|
|
17
|
+
export function launchCelestia(
|
|
18
|
+
packageName: string,
|
|
19
|
+
location: ResolveLocation,
|
|
20
|
+
opts?: { ports?: number[]; home?: string },
|
|
21
|
+
): ProcessConfig[] {
|
|
22
|
+
const cwd = resolvePackageDir("launchCelestia", packageName, location, REQUIRED_SCRIPTS);
|
|
23
|
+
const ports = opts?.ports ?? [26657, 26658];
|
|
24
|
+
const home = opts?.home ?? "/tmp/celestia-home";
|
|
25
|
+
|
|
26
|
+
const cleanScript =
|
|
27
|
+
`await import('fs').then(fs => { try { fs.rmSync('${home}', { recursive: true, force: true }); } catch {} }); console.log('Celestia home cleaned');`;
|
|
28
|
+
|
|
29
|
+
return [
|
|
30
|
+
{
|
|
31
|
+
name: CelestiaNames.CLEAN,
|
|
32
|
+
description: "Remove stale Celestia devnet data",
|
|
33
|
+
args: ["-e", cleanScript],
|
|
34
|
+
waitToExit: true,
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: CelestiaNames.DEVNET,
|
|
38
|
+
description: `Celestia consensus node + bridge (${packageName} celestia-bridge:start)`,
|
|
39
|
+
cwd,
|
|
40
|
+
stopProcessAtPort: ports,
|
|
41
|
+
args: ["run", "celestia-bridge:start"],
|
|
42
|
+
env: { CELESTIA_HOME: home, CELESTIA_FORCE_NO_BBR: "1" },
|
|
43
|
+
waitToExit: false,
|
|
44
|
+
critical: true,
|
|
45
|
+
silent: true,
|
|
46
|
+
dependsOn: [CelestiaNames.CLEAN],
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: CelestiaNames.BRIDGE_WAIT,
|
|
50
|
+
description: `Wait for Celestia bridge RPC (${packageName} celestia-bridge:wait)`,
|
|
51
|
+
cwd,
|
|
52
|
+
args: ["run", "celestia-bridge:wait"],
|
|
53
|
+
waitToExit: true,
|
|
54
|
+
dependsOn: [CelestiaNames.DEVNET],
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: CelestiaNames.FUND,
|
|
58
|
+
description: `Fund the Celestia bridge wallet (${packageName} celestia-fund:bridge)`,
|
|
59
|
+
cwd,
|
|
60
|
+
args: ["run", "celestia-fund:bridge"],
|
|
61
|
+
env: { CELESTIA_HOME: home },
|
|
62
|
+
waitToExit: true,
|
|
63
|
+
critical: true,
|
|
64
|
+
dependsOn: [CelestiaNames.BRIDGE_WAIT],
|
|
65
|
+
},
|
|
66
|
+
];
|
|
67
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Examples for the README — verify the public surface resolves.
|
|
2
|
+
|
|
3
|
+
import { test, expect } from "bun:test";
|
|
4
|
+
import type { OrchestratorConfig, ProcessConfig } from "../src/config.ts";
|
|
5
|
+
|
|
6
|
+
test("README: OrchestratorConfig + ProcessConfig types compose into a valid object", () => {
|
|
7
|
+
const config: OrchestratorConfig = {
|
|
8
|
+
processes: [
|
|
9
|
+
{
|
|
10
|
+
name: "pglite",
|
|
11
|
+
command: ["bun", "run", "@effectstream/db/start-pglite"],
|
|
12
|
+
readiness: { tcp: { port: 5432 } },
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
name: "hardhat",
|
|
16
|
+
command: ["bun", "run", "hardhat", "node"],
|
|
17
|
+
readiness: { http: { url: "http://127.0.0.1:8545" } },
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: "deploy-contracts",
|
|
21
|
+
command: ["bun", "scripts/deploy.ts"],
|
|
22
|
+
dependsOn: ["hardhat"],
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
expect(config.processes.length).toBe(3);
|
|
28
|
+
expect(config.processes[0].name).toBe("pglite");
|
|
29
|
+
|
|
30
|
+
const proc: ProcessConfig = config.processes[1];
|
|
31
|
+
expect(proc.name).toBe("hardhat");
|
|
32
|
+
});
|