@camunda8/cli 4.7.0-alpha.33 → 4.7.0-alpha.35
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.
|
@@ -21,6 +21,9 @@ c8ctl cluster start
|
|
|
21
21
|
# Start with debug output (streams raw c8run logs)
|
|
22
22
|
c8ctl cluster start --debug
|
|
23
23
|
|
|
24
|
+
# Serve Camunda HTTP on another port (when 8080 is taken)
|
|
25
|
+
c8ctl cluster start --port 9091
|
|
26
|
+
|
|
24
27
|
# Stop the running cluster
|
|
25
28
|
c8ctl cluster stop
|
|
26
29
|
|
|
@@ -486,12 +486,13 @@ export const metadata = {
|
|
|
486
486
|
// so the subcommand flags are documented via `flagsHint` instead.
|
|
487
487
|
passthrough: true,
|
|
488
488
|
passthroughHint:
|
|
489
|
-
'--purge, --debug, --physical-tenants and --c8-version are read by the plugin. For local management, physical-tenants and --physical-tenant are forwarded unchanged to a compatible c8run release.',
|
|
489
|
+
'--purge, --debug, --port, --physical-tenants and --c8-version are read by the plugin. For local management, physical-tenants and --physical-tenant are forwarded unchanged to a compatible c8run release.',
|
|
490
490
|
flagsHint: [
|
|
491
491
|
'--c8-version <version> Camunda version, alias or major.minor (alternative to the positional <version>)',
|
|
492
492
|
'--debug (start, stop) Stream raw c8run output',
|
|
493
493
|
'--purge (stop only) Also delete runtime data after stopping',
|
|
494
494
|
'--physical-tenants <ids> (start only) Comma-separated physical tenants for this run (repeatable; Camunda 8.10+)',
|
|
495
|
+
'--port <number> (start only) Main Camunda HTTP port (default 8080; gRPC 26500 and health 9600 stay fixed)',
|
|
495
496
|
'--physical-tenant <id> (secrets only) Scope secrets to one physical tenant (also --physical-tenant=<id>)',
|
|
496
497
|
],
|
|
497
498
|
subcommands: [
|
|
@@ -512,6 +513,7 @@ export const metadata = {
|
|
|
512
513
|
{ command: 'c8ctl cluster start', description: 'Start a local Camunda 8 cluster (latest stable)' },
|
|
513
514
|
{ command: 'c8ctl cluster start 8.8', description: 'Start the latest cached 8.8.x release' },
|
|
514
515
|
{ command: 'c8ctl cluster start 8.9.0-alpha5', description: 'Start a specific version' },
|
|
516
|
+
{ command: 'c8ctl cluster start --port 9091', description: 'Start a local cluster serving HTTP on port 9091' },
|
|
515
517
|
{ command: 'c8ctl cluster stop', description: 'Stop the running cluster' },
|
|
516
518
|
{ command: 'c8ctl cluster status', description: 'Show whether a cluster is running and how to connect' },
|
|
517
519
|
{ command: 'c8ctl cluster logs', description: 'Stream log output from the running cluster' },
|
|
@@ -556,6 +558,8 @@ function getLogger() {
|
|
|
556
558
|
|
|
557
559
|
const ACTIVE_MARKER_FILE = 'cluster.active';
|
|
558
560
|
const VERSION_MARKER_FILE = 'cluster.version';
|
|
561
|
+
const PORT_MARKER_FILE = 'cluster.port';
|
|
562
|
+
const DEFAULT_HTTP_PORT = 8080;
|
|
559
563
|
// Durable running-cluster PID record, written at start time. Unlike c8run's
|
|
560
564
|
// own `.process` pidfiles — which live INSIDE a version's install dir and
|
|
561
565
|
// vanish when that dir is replaced or removed — this record lives at the
|
|
@@ -1866,29 +1870,39 @@ async function waitForClusterReady(maxWaitMs = CLUSTER_STARTUP_TIMEOUT_MS) {
|
|
|
1866
1870
|
return false;
|
|
1867
1871
|
}
|
|
1868
1872
|
|
|
1869
|
-
function printSummary(rawOutput, version) {
|
|
1873
|
+
function printSummary(rawOutput, version, port = DEFAULT_HTTP_PORT) {
|
|
1870
1874
|
const summary = extractStartupSummary(rawOutput);
|
|
1871
1875
|
|
|
1872
1876
|
if (summary) {
|
|
1873
1877
|
console.log(`\n${summary}\n`);
|
|
1874
|
-
|
|
1878
|
+
} else {
|
|
1879
|
+
// c8run daemonizes so captured output is often empty — print known defaults
|
|
1880
|
+
const urls = clusterUrls(port);
|
|
1881
|
+
console.log('');
|
|
1882
|
+
console.log(`Camunda 8 (${version}) is running:`);
|
|
1883
|
+
console.log('');
|
|
1884
|
+
console.log(` - Operate: ${urls.operate}`);
|
|
1885
|
+
console.log(` - Tasklist: ${urls.tasklist}`);
|
|
1886
|
+
console.log(` - Zeebe GRPC: ${urls.zeebeGrpc}`);
|
|
1887
|
+
console.log(` - Zeebe REST: ${urls.zeebeRest}`);
|
|
1888
|
+
console.log(` - Health: ${urls.health}`);
|
|
1889
|
+
console.log('');
|
|
1890
|
+
console.log(' Default credentials: demo / demo');
|
|
1891
|
+
console.log('');
|
|
1875
1892
|
}
|
|
1876
1893
|
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
console.log('');
|
|
1887
|
-
console.log(' Default credentials: demo / demo');
|
|
1888
|
-
console.log('');
|
|
1894
|
+
if (port !== DEFAULT_HTTP_PORT) {
|
|
1895
|
+
// The built-in 'local' profile targets the default port; tell the user how
|
|
1896
|
+
// to point c8ctl at this cluster rather than rewriting their profile.
|
|
1897
|
+
console.log(` c8ctl's 'local' profile targets port ${DEFAULT_HTTP_PORT}. To use this cluster, either:`);
|
|
1898
|
+
console.log(` c8ctl add profile local-${port} --baseUrl=http://localhost:${port}/v2 --username=demo --password=demo`);
|
|
1899
|
+
console.log(` c8ctl use profile local-${port}`);
|
|
1900
|
+
console.log(` or, with no active profile, set CAMUNDA_BASE_URL=http://localhost:${port}/v2`);
|
|
1901
|
+
console.log('');
|
|
1902
|
+
}
|
|
1889
1903
|
}
|
|
1890
1904
|
|
|
1891
|
-
async function startC8Run(config, debug = false, startArgs = []) {
|
|
1905
|
+
async function startC8Run(config, debug = false, startArgs = [], port = DEFAULT_HTTP_PORT) {
|
|
1892
1906
|
const logger = getLogger();
|
|
1893
1907
|
const binaryPath = getC8RunBinaryPath(config);
|
|
1894
1908
|
const logDir = join(dirname(binaryPath), 'log');
|
|
@@ -1899,6 +1913,7 @@ async function startC8Run(config, debug = false, startArgs = []) {
|
|
|
1899
1913
|
|
|
1900
1914
|
const markerFile = join(config.cacheDir, ACTIVE_MARKER_FILE);
|
|
1901
1915
|
const versionFile = join(config.cacheDir, VERSION_MARKER_FILE);
|
|
1916
|
+
const portFile = join(config.cacheDir, PORT_MARKER_FILE);
|
|
1902
1917
|
|
|
1903
1918
|
if (existsSync(markerFile)) {
|
|
1904
1919
|
// Check whether actual cluster processes are still alive.
|
|
@@ -1921,6 +1936,7 @@ async function startC8Run(config, debug = false, startArgs = []) {
|
|
|
1921
1936
|
logger.warn('Found stale cluster marker (no running processes detected). Cleaning up.');
|
|
1922
1937
|
if (existsSync(markerFile)) rmSync(markerFile);
|
|
1923
1938
|
if (existsSync(versionFile)) rmSync(versionFile);
|
|
1939
|
+
rmSync(portFile, { force: true });
|
|
1924
1940
|
} else if (hasRunningClusterPidfiles(config.cacheDir)) {
|
|
1925
1941
|
// No active marker, but a live process is still tracked — typically an
|
|
1926
1942
|
// orphan recorded only in the durable cache-root PID record after its
|
|
@@ -1941,16 +1957,33 @@ async function startC8Run(config, debug = false, startArgs = []) {
|
|
|
1941
1957
|
|
|
1942
1958
|
logger.info('Starting Camunda 8 local cluster...');
|
|
1943
1959
|
|
|
1960
|
+
// Persist the chosen port BEFORE spawning c8run. If c8ctl is interrupted
|
|
1961
|
+
// while the launcher is still running (SIGINT/SIGTERM, crash), c8run's
|
|
1962
|
+
// `.process` pidfiles can remain live without the success/failure writes
|
|
1963
|
+
// below ever running — and `cluster status` reads the recorded port whenever
|
|
1964
|
+
// tracked processes survive. Without this early write, recovery status would
|
|
1965
|
+
// advertise the default port for a cluster actually serving on the custom
|
|
1966
|
+
// one.
|
|
1967
|
+
writeFileSync(portFile, String(port));
|
|
1968
|
+
|
|
1969
|
+
// c8run passes its environment to every Java process it launches. An
|
|
1970
|
+
// inherited SERVER_PORT would therefore move the bundled Connectors runtime
|
|
1971
|
+
// onto the Camunda port as well (port clash) — use --port instead. On Windows
|
|
1972
|
+
// the variable name is case-insensitive, so the exclusion must be too.
|
|
1973
|
+
const launchEnv = buildC8RunLaunchEnv(resolveLocalStoreEnv(process.env, process.cwd()));
|
|
1944
1974
|
const proc = spawn(binaryPath, ['start', ...startArgs], {
|
|
1945
1975
|
stdio: ['ignore', 'pipe', 'pipe'],
|
|
1946
1976
|
cwd: dirname(binaryPath),
|
|
1947
|
-
env: { ...
|
|
1977
|
+
env: { ...launchEnv, C8RUN_CLI_NAME },
|
|
1948
1978
|
});
|
|
1949
1979
|
|
|
1950
1980
|
if (typeof proc.pid !== 'number') {
|
|
1951
1981
|
// spawn() reports this failure via an async 'error' event; without a
|
|
1952
1982
|
// listener it would crash the process while the hints are flushed below.
|
|
1953
1983
|
proc.on('error', (err) => logger.error(`Failed to spawn c8run: ${err.message}`));
|
|
1984
|
+
if (!hasRunningClusterPidfiles(config.cacheDir)) {
|
|
1985
|
+
rmSync(portFile, { force: true });
|
|
1986
|
+
}
|
|
1954
1987
|
logger.error('Failed to start cluster process: no PID received from c8run.');
|
|
1955
1988
|
logger.error(`Check logs in: ${logDir}`);
|
|
1956
1989
|
logger.info(`Print logs with: cat "${logDir}"/*.log`, { essential: true });
|
|
@@ -1980,31 +2013,49 @@ async function startC8Run(config, debug = false, startArgs = []) {
|
|
|
1980
2013
|
let exitCode = null;
|
|
1981
2014
|
let exitSignal = null;
|
|
1982
2015
|
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
2016
|
+
try {
|
|
2017
|
+
await new Promise((resolve, reject) => {
|
|
2018
|
+
proc.on('error', (err) => {
|
|
2019
|
+
reject(new Error(`Failed to spawn c8run: ${err.message}`));
|
|
2020
|
+
});
|
|
2021
|
+
proc.on('close', (code, signal) => {
|
|
2022
|
+
exitCode = code;
|
|
2023
|
+
exitSignal = signal;
|
|
2024
|
+
resolve();
|
|
2025
|
+
});
|
|
1991
2026
|
});
|
|
1992
|
-
})
|
|
2027
|
+
} catch (error) {
|
|
2028
|
+
if (!hasRunningClusterPidfiles(config.cacheDir)) {
|
|
2029
|
+
rmSync(portFile, { force: true });
|
|
2030
|
+
}
|
|
2031
|
+
throw error;
|
|
2032
|
+
}
|
|
1993
2033
|
|
|
1994
2034
|
if (exitCode !== 0) {
|
|
1995
2035
|
// A failed tenant probe leaves healthy engines alive; preserve their identity
|
|
1996
2036
|
// for stop/status even if the installation directory is subsequently replaced.
|
|
1997
2037
|
try {
|
|
1998
2038
|
recordRunningClusterPids(config, { skipEmpty: true, startupFailed: true });
|
|
2039
|
+
// Persist the port for the survivors too: the success-only marker write
|
|
2040
|
+
// below never runs on this path, so without it a failed custom-port
|
|
2041
|
+
// start would leave status reporting the default port for processes
|
|
2042
|
+
// that actually serve on the custom one.
|
|
2043
|
+
writeFileSync(portFile, String(port));
|
|
1999
2044
|
} catch (error) {
|
|
2000
2045
|
logger.warn(`Could not record surviving cluster processes: ${formatErrorWithCause(error)}. Use "c8ctl cluster stop" while the installation is still present.`);
|
|
2001
2046
|
}
|
|
2047
|
+
if (!hasRunningClusterPidfiles(config.cacheDir)) {
|
|
2048
|
+
rmSync(portFile, { force: true });
|
|
2049
|
+
}
|
|
2002
2050
|
if (startupOutput.trim()) {
|
|
2003
2051
|
logger.error(`c8run output:\n${startupOutput.trim()}`);
|
|
2004
2052
|
}
|
|
2005
2053
|
if (startArgs.length > 0 && /flag provided but not defined: -physical-tenants/.test(startupOutput)) {
|
|
2006
2054
|
logger.error('This cached c8run build lacks --physical-tenants. Install a Camunda 8.10+ build containing physical-tenant CLI support with "c8ctl cluster install 8.10".');
|
|
2007
2055
|
}
|
|
2056
|
+
if (/flag provided but not defined: -port\b/.test(startupOutput)) {
|
|
2057
|
+
logger.error('This cached c8run build does not support --port. Install a newer Camunda 8 Run build (for example "c8ctl cluster install 8.10") or start without --port.');
|
|
2058
|
+
}
|
|
2008
2059
|
logger.error(
|
|
2009
2060
|
`c8run start exited with code ${exitCode ?? 'unknown'}${exitSignal ? ` (signal: ${exitSignal})` : ''}. Cluster will not be marked as running.`,
|
|
2010
2061
|
);
|
|
@@ -2041,15 +2092,23 @@ async function startC8Run(config, debug = false, startArgs = []) {
|
|
|
2041
2092
|
}
|
|
2042
2093
|
writeFileSync(markerFile, 'running');
|
|
2043
2094
|
writeFileSync(versionFile, config.version);
|
|
2044
|
-
|
|
2095
|
+
writeFileSync(portFile, String(port));
|
|
2096
|
+
printSummary(startupOutput, config.version, port);
|
|
2045
2097
|
} else {
|
|
2046
2098
|
// Readiness can fail even after c8run exits successfully. Retain the same
|
|
2047
2099
|
// recovery handle as a nonzero launcher exit before reporting failure.
|
|
2048
2100
|
try {
|
|
2049
2101
|
recordRunningClusterPids(config, { skipEmpty: true, startupFailed: true });
|
|
2102
|
+
// Persist the port for the survivors too (same reason as the nonzero
|
|
2103
|
+
// launcher exit path above): without it, status would report the
|
|
2104
|
+
// default port for processes serving on the custom one.
|
|
2105
|
+
writeFileSync(portFile, String(port));
|
|
2050
2106
|
} catch (error) {
|
|
2051
2107
|
logger.warn(`Could not record surviving cluster processes: ${formatErrorWithCause(error)}. Use "c8ctl cluster stop" while the installation is still present.`);
|
|
2052
2108
|
}
|
|
2109
|
+
if (!hasRunningClusterPidfiles(config.cacheDir)) {
|
|
2110
|
+
rmSync(portFile, { force: true });
|
|
2111
|
+
}
|
|
2053
2112
|
logger.error(
|
|
2054
2113
|
'Cluster failed to start within timeout.',
|
|
2055
2114
|
);
|
|
@@ -2620,8 +2679,11 @@ export async function stopC8Run(config, debug = false) {
|
|
|
2620
2679
|
|
|
2621
2680
|
if (!markerExists && !clusterAppearsRunning) {
|
|
2622
2681
|
// Nothing live to stop. Retire any stale record left by a crash/kill so its
|
|
2623
|
-
// dead PIDs cannot later be mistaken for this cluster (#560).
|
|
2682
|
+
// dead PIDs cannot later be mistaken for this cluster (#560). No process is
|
|
2683
|
+
// serving, so the port record is stale too — drop it, otherwise a later
|
|
2684
|
+
// status would keep advertising the old custom port for a stopped cluster.
|
|
2624
2685
|
clearStaleRunningClusterRecord(config.cacheDir);
|
|
2686
|
+
rmSync(join(config.cacheDir, PORT_MARKER_FILE), { force: true });
|
|
2625
2687
|
logger.warn(
|
|
2626
2688
|
'No cluster is currently running.',
|
|
2627
2689
|
);
|
|
@@ -2643,6 +2705,7 @@ export async function stopC8Run(config, debug = false) {
|
|
|
2643
2705
|
if (existsSync(markerFile)) {
|
|
2644
2706
|
rmSync(markerFile);
|
|
2645
2707
|
}
|
|
2708
|
+
rmSync(join(config.cacheDir, PORT_MARKER_FILE), { force: true });
|
|
2646
2709
|
clearRunningClusterRecord(config.cacheDir);
|
|
2647
2710
|
return staleVersion;
|
|
2648
2711
|
}
|
|
@@ -2808,6 +2871,17 @@ export async function stopC8Run(config, debug = false) {
|
|
|
2808
2871
|
);
|
|
2809
2872
|
}
|
|
2810
2873
|
|
|
2874
|
+
// The port record describes the cluster that was just stopped. Only drop it
|
|
2875
|
+
// once NOTHING still tracks a live process — neither the durable PID record
|
|
2876
|
+
// nor c8run's own `.process` pidfiles. `remainingPids` alone misses a process
|
|
2877
|
+
// tracked only by a pidfile (e.g. one the durable record never captured, or
|
|
2878
|
+
// whose record was already cleared), so gating on it would delete the port
|
|
2879
|
+
// while that survivor still serves — and a later `cluster status` would
|
|
2880
|
+
// advertise the default port for a custom-port cluster.
|
|
2881
|
+
if (!hasRunningClusterPidfiles(config.cacheDir)) {
|
|
2882
|
+
rmSync(join(config.cacheDir, PORT_MARKER_FILE), { force: true });
|
|
2883
|
+
}
|
|
2884
|
+
|
|
2811
2885
|
if (attempted === 0 && !hadSuccessfulStop) {
|
|
2812
2886
|
// ...but only when there is nothing left to reap. If a recorded process is
|
|
2813
2887
|
// still alive (e.g. reaping hit EPERM), the incomplete-stop diagnostic
|
|
@@ -2971,6 +3045,32 @@ function resolveLocalStoreEnv(env, cwd) {
|
|
|
2971
3045
|
return resolvedEnv;
|
|
2972
3046
|
}
|
|
2973
3047
|
|
|
3048
|
+
/**
|
|
3049
|
+
* Build the environment handed to the c8run child process. c8run forwards its
|
|
3050
|
+
* environment to every Java process it launches, so an inherited SERVER_PORT
|
|
3051
|
+
* would also move the bundled Connectors runtime onto the Camunda port (a port
|
|
3052
|
+
* clash) — strip it and pass the port via --port instead.
|
|
3053
|
+
*
|
|
3054
|
+
* On Windows environment-variable names are case-insensitive, so the exclusion
|
|
3055
|
+
* must match case-insensitively there: an inherited `Server_Port` or
|
|
3056
|
+
* `server_port` is the same variable as `SERVER_PORT` and must be removed too.
|
|
3057
|
+
* Elsewhere names are case-sensitive, so only the exact `SERVER_PORT` is dropped
|
|
3058
|
+
* (a distinct lowercase `server_port` is a different variable and is left alone).
|
|
3059
|
+
*
|
|
3060
|
+
* @param {Record<string, string | undefined>} env
|
|
3061
|
+
* @param {string} [platform]
|
|
3062
|
+
* @returns {Record<string, string | undefined>}
|
|
3063
|
+
*/
|
|
3064
|
+
export function buildC8RunLaunchEnv(env, platform = osPlatform()) {
|
|
3065
|
+
if (platform === 'win32') {
|
|
3066
|
+
return Object.fromEntries(
|
|
3067
|
+
Object.entries(env).filter(([name]) => name.toUpperCase() !== 'SERVER_PORT'),
|
|
3068
|
+
);
|
|
3069
|
+
}
|
|
3070
|
+
const { SERVER_PORT: _ignoredServerPort, ...launchEnv } = env;
|
|
3071
|
+
return launchEnv;
|
|
3072
|
+
}
|
|
3073
|
+
|
|
2974
3074
|
/**
|
|
2975
3075
|
* True when a cluster is currently running, returning its version. Requires
|
|
2976
3076
|
* both marker files plus a live pidfile — a stale marker with no live
|
|
@@ -3117,13 +3217,28 @@ async function runClusterLocalCommand(
|
|
|
3117
3217
|
// Status
|
|
3118
3218
|
// ---------------------------------------------------------------------------
|
|
3119
3219
|
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
}
|
|
3220
|
+
/**
|
|
3221
|
+
* Endpoints of the local cluster. `--port` moves only c8run's main HTTP port;
|
|
3222
|
+
* gRPC (26500) and the management/health port (9600) stay fixed.
|
|
3223
|
+
*/
|
|
3224
|
+
export function clusterUrls(port = DEFAULT_HTTP_PORT) {
|
|
3225
|
+
return {
|
|
3226
|
+
operate: `http://localhost:${port}/operate`,
|
|
3227
|
+
tasklist: `http://localhost:${port}/tasklist`,
|
|
3228
|
+
zeebeGrpc: 'localhost:26500',
|
|
3229
|
+
zeebeRest: `http://localhost:${port}/v2/`,
|
|
3230
|
+
health: 'http://localhost:9600/actuator/health',
|
|
3231
|
+
};
|
|
3232
|
+
}
|
|
3233
|
+
|
|
3234
|
+
/** HTTP port recorded by the latest start attempt, or the c8run default. */
|
|
3235
|
+
export function readClusterPort(cacheDir) {
|
|
3236
|
+
const portFile = join(cacheDir, PORT_MARKER_FILE);
|
|
3237
|
+
if (!existsSync(portFile)) return DEFAULT_HTTP_PORT;
|
|
3238
|
+
const raw = readFileSync(portFile, 'utf-8').trim();
|
|
3239
|
+
const port = /^\d+$/.test(raw) ? Number(raw) : NaN;
|
|
3240
|
+
return port >= 1 && port <= 65535 ? port : DEFAULT_HTTP_PORT;
|
|
3241
|
+
}
|
|
3127
3242
|
|
|
3128
3243
|
export async function clusterStatus(cacheDir) {
|
|
3129
3244
|
const logger = getLogger();
|
|
@@ -3136,6 +3251,10 @@ export async function clusterStatus(cacheDir) {
|
|
|
3136
3251
|
// install dir was replaced/removed, orphaning it (#560). Detect it so status
|
|
3137
3252
|
// never reports "stopped" while a tracked cluster process is still alive.
|
|
3138
3253
|
const processesRunning = hasRunningClusterPidfiles(cacheDir);
|
|
3254
|
+
// The port is persisted before c8run starts and may be the only surviving
|
|
3255
|
+
// endpoint record after an interrupted launch. Trust it whenever present;
|
|
3256
|
+
// readClusterPort falls back to the c8run default when it is absent or invalid.
|
|
3257
|
+
const CLUSTER_URLS = clusterUrls(readClusterPort(cacheDir));
|
|
3139
3258
|
const markerVersion = markerExists && existsSync(versionFile)
|
|
3140
3259
|
? readFileSync(versionFile, 'utf-8').trim() || null
|
|
3141
3260
|
: null;
|
|
@@ -3738,6 +3857,15 @@ export function parsePluginArgs(args) {
|
|
|
3738
3857
|
continue;
|
|
3739
3858
|
}
|
|
3740
3859
|
|
|
3860
|
+
if (arg === '--port' || arg.startsWith('--port=')) {
|
|
3861
|
+
const value = arg === '--port' ? args[i + 1] : arg.slice('--port='.length);
|
|
3862
|
+
result.port = parsePort(value);
|
|
3863
|
+
result.startArgs ??= [];
|
|
3864
|
+
result.startArgs.push('--port', String(result.port));
|
|
3865
|
+
i += arg === '--port' ? 2 : 1;
|
|
3866
|
+
continue;
|
|
3867
|
+
}
|
|
3868
|
+
|
|
3741
3869
|
if (arg === '--c8-version') {
|
|
3742
3870
|
const next = args[i + 1];
|
|
3743
3871
|
if (!next || next.startsWith('-')) {
|
|
@@ -3790,12 +3918,26 @@ export function parsePluginArgs(args) {
|
|
|
3790
3918
|
i += 1;
|
|
3791
3919
|
}
|
|
3792
3920
|
|
|
3921
|
+
if (result.port !== undefined && result.subcommand !== 'start') {
|
|
3922
|
+
throw new Error('--port can only be used with the start subcommand');
|
|
3923
|
+
}
|
|
3793
3924
|
if (result.startArgs && result.subcommand !== 'start') {
|
|
3794
3925
|
throw new Error('--physical-tenants can only be used with the start subcommand');
|
|
3795
3926
|
}
|
|
3796
3927
|
return result;
|
|
3797
3928
|
}
|
|
3798
3929
|
|
|
3930
|
+
function parsePort(value) {
|
|
3931
|
+
if (!value || value.startsWith('-')) {
|
|
3932
|
+
throw new Error('Missing value for --port. Provide the HTTP port, for example: c8ctl cluster start --port 9091');
|
|
3933
|
+
}
|
|
3934
|
+
const port = /^\d+$/.test(value) ? Number(value) : NaN;
|
|
3935
|
+
if (!Number.isInteger(port) || port < 1 || port > 65535) {
|
|
3936
|
+
throw new Error(`Invalid value for --port: "${value}". Use an integer between 1 and 65535.`);
|
|
3937
|
+
}
|
|
3938
|
+
return port;
|
|
3939
|
+
}
|
|
3940
|
+
|
|
3799
3941
|
// ---------------------------------------------------------------------------
|
|
3800
3942
|
// Plugin commands export
|
|
3801
3943
|
// ---------------------------------------------------------------------------
|
|
@@ -4056,7 +4198,7 @@ export const commands = {
|
|
|
4056
4198
|
if (parsed.subcommand === 'start') {
|
|
4057
4199
|
try {
|
|
4058
4200
|
await ensureC8RunInstalled(config);
|
|
4059
|
-
await startC8Run(config, parsed.debug, parsed.startArgs);
|
|
4201
|
+
await startC8Run(config, parsed.debug, parsed.startArgs, parsed.port);
|
|
4060
4202
|
} catch (error) {
|
|
4061
4203
|
logger.error(`Failed to start cluster: ${formatErrorWithCause(error)}`);
|
|
4062
4204
|
await flushStartHints(config);
|
|
@@ -6,12 +6,11 @@ development.
|
|
|
6
6
|
## Commands
|
|
7
7
|
|
|
8
8
|
- `c8ctl setup` — the guided wizard: start a local cluster (downloading
|
|
9
|
-
Camunda 8 Run on first run), install Desktop Modeler, create
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
blueprint).
|
|
9
|
+
Camunda 8 Run on first run), install Desktop Modeler, create the Rocket
|
|
10
|
+
Launch example, deploy and run it, and set up AI assistant tooling (skills,
|
|
11
|
+
MCP servers). Nothing is installed without a selection or `--yes`.
|
|
12
|
+
- `c8ctl setup --yes` — set up the defaults without prompting, including the
|
|
13
|
+
Rocket Launch example.
|
|
15
14
|
- `c8ctl setup --remove` — preview and remove setup-managed MCP entries,
|
|
16
15
|
Camunda skills, a c8ctl-managed Desktop Modeler installation, blueprint
|
|
17
16
|
files, and the local cluster: the cluster is stopped, and its runtime
|
|
@@ -4560,7 +4560,6 @@ var SETUP_BLUEPRINTS = [
|
|
|
4560
4560
|
{
|
|
4561
4561
|
id: "rocket-launch",
|
|
4562
4562
|
name: "Rocket Launch",
|
|
4563
|
-
description: "A fully automated hello-world process with a decision.",
|
|
4564
4563
|
guideUrl: "https://docs.camunda.io/docs/guides/getting-started-hello-world/",
|
|
4565
4564
|
source: {
|
|
4566
4565
|
owner: "camunda",
|
|
@@ -4589,52 +4588,6 @@ var SETUP_BLUEPRINTS = [
|
|
|
4589
4588
|
`Inspect it: c8ctl get process-instance ${processInstanceKey} --profile local`,
|
|
4590
4589
|
`Run again: c8ctl run "${join4(projectDir, "rocket-launch.bpmn")}" --profile local --variables '${JSON.stringify(ROCKET_LAUNCH_START_VARIABLES)}'`
|
|
4591
4590
|
]
|
|
4592
|
-
},
|
|
4593
|
-
{
|
|
4594
|
-
id: "service-worker",
|
|
4595
|
-
name: "Service worker",
|
|
4596
|
-
description: "An order process with service worker implementations.",
|
|
4597
|
-
guideUrl: "https://docs.camunda.io/docs/guides/getting-started-example/",
|
|
4598
|
-
source: {
|
|
4599
|
-
owner: "camunda",
|
|
4600
|
-
repo: "camunda-8-get-started",
|
|
4601
|
-
ref: "main",
|
|
4602
|
-
path: "2-order-process-with-service-workers"
|
|
4603
|
-
},
|
|
4604
|
-
// The worker implementations each embed a copy of the model; only
|
|
4605
|
-
// the bpmn/ directory is deployed.
|
|
4606
|
-
deployPath: "bpmn",
|
|
4607
|
-
processFile: "bpmn/order-process.bpmn",
|
|
4608
|
-
// The started instance stalls at its first service task until a
|
|
4609
|
-
// worker connects — starting one is the whole point of the box.
|
|
4610
|
-
// One block per shipped worker language. Node.js and Python cd
|
|
4611
|
-
// into the worker directory: a bare `npm install --prefix <dir>`
|
|
4612
|
-
// is misread by npm on Windows as a global install of the
|
|
4613
|
-
// caller's directory, and the Python worker needs a virtualenv —
|
|
4614
|
-
// pip into an externally managed system Python fails (PEP 668).
|
|
4615
|
-
// Java and C# can address the project directly: -f and --project
|
|
4616
|
-
// share neither defect. Paths are quoted (the working directory
|
|
4617
|
-
// may contain spaces), every command gets its own line (&& is a
|
|
4618
|
-
// syntax error in Windows PowerShell 5.1), and all lines stay
|
|
4619
|
-
// printable ASCII so the box keeps its borders.
|
|
4620
|
-
nextSteps: ({ projectDir, processInstanceKey }) => [
|
|
4621
|
-
"Process instance is running on the local cluster.",
|
|
4622
|
-
"It waits at the first service task until a worker connects.",
|
|
4623
|
-
`Open it: http://localhost:8080/operate/processes/${processInstanceKey}`,
|
|
4624
|
-
" (login using demo / demo as username / password)",
|
|
4625
|
-
"",
|
|
4626
|
-
"Start a worker in your language:",
|
|
4627
|
-
` Node.js: cd "${join4(projectDir, "nodejs")}"`,
|
|
4628
|
-
" npm install",
|
|
4629
|
-
" npm start",
|
|
4630
|
-
` Python: cd "${join4(projectDir, "python")}"`,
|
|
4631
|
-
" python -m venv .venv",
|
|
4632
|
-
" source .venv/bin/activate # Windows: .venv\\Scripts\\activate",
|
|
4633
|
-
" pip install -r requirements.txt",
|
|
4634
|
-
" python main.py",
|
|
4635
|
-
` Java: mvn -f "${join4(projectDir, "java")}" spring-boot:run`,
|
|
4636
|
-
` C#: dotnet run --project "${join4(projectDir, "csharp")}"`
|
|
4637
|
-
]
|
|
4638
4591
|
}
|
|
4639
4592
|
];
|
|
4640
4593
|
var BlueprintScaffoldError = class extends Error {
|
|
@@ -4826,14 +4779,6 @@ function readRemovalMarker(directory) {
|
|
|
4826
4779
|
{ hint: "Repair or remove the marker manually before trying again." }
|
|
4827
4780
|
);
|
|
4828
4781
|
}
|
|
4829
|
-
const blueprint = SETUP_BLUEPRINTS.find(
|
|
4830
|
-
(candidate) => candidate.id === value.id
|
|
4831
|
-
);
|
|
4832
|
-
if (!blueprint) {
|
|
4833
|
-
throw new BlueprintScaffoldError(
|
|
4834
|
-
`Cannot safely remove the blueprint in ${directory}: "${value.id}" is not a supported setup blueprint.`
|
|
4835
|
-
);
|
|
4836
|
-
}
|
|
4837
4782
|
if (value.files.some(
|
|
4838
4783
|
(file) => !isSafeRelativePath(file) || file === MARKER_FILE
|
|
4839
4784
|
) || new Set(value.files).size !== value.files.length) {
|
|
@@ -4852,10 +4797,15 @@ function planSetupBlueprintRemovals({
|
|
|
4852
4797
|
onError
|
|
4853
4798
|
} = {}) {
|
|
4854
4799
|
const root = resolve3(cwd);
|
|
4855
|
-
const directories = [
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
|
|
4800
|
+
const directories = [root];
|
|
4801
|
+
try {
|
|
4802
|
+
directories.push(
|
|
4803
|
+
...readdirSync(root, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => resolve3(root, entry.name))
|
|
4804
|
+
);
|
|
4805
|
+
} catch (error) {
|
|
4806
|
+
if (!onError) throw error;
|
|
4807
|
+
onError(root, error);
|
|
4808
|
+
}
|
|
4859
4809
|
const seen = /* @__PURE__ */ new Set();
|
|
4860
4810
|
const removals = [];
|
|
4861
4811
|
for (const directory of directories) {
|
|
@@ -4866,12 +4816,10 @@ function planSetupBlueprintRemovals({
|
|
|
4866
4816
|
if (!result) continue;
|
|
4867
4817
|
const blueprint = SETUP_BLUEPRINTS.find(
|
|
4868
4818
|
(candidate) => candidate.id === result.marker.id
|
|
4869
|
-
)
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
);
|
|
4874
|
-
}
|
|
4819
|
+
) ?? {
|
|
4820
|
+
id: result.marker.id,
|
|
4821
|
+
name: result.marker.id
|
|
4822
|
+
};
|
|
4875
4823
|
removals.push({
|
|
4876
4824
|
blueprint,
|
|
4877
4825
|
directory,
|
|
@@ -5077,7 +5025,7 @@ async function scaffoldSetupBlueprint({
|
|
|
5077
5025
|
throw new BlueprintScaffoldError(
|
|
5078
5026
|
`Blueprint destination ${directory} already contains the "${marker.id}" blueprint.`,
|
|
5079
5027
|
{
|
|
5080
|
-
hint:
|
|
5028
|
+
hint: "Remove the directory to start over; existing files are never overwritten."
|
|
5081
5029
|
}
|
|
5082
5030
|
);
|
|
5083
5031
|
}
|
|
@@ -5308,7 +5256,7 @@ var SETUP_STEPS = [
|
|
|
5308
5256
|
{
|
|
5309
5257
|
id: "scaffold-blueprint",
|
|
5310
5258
|
title: "Create the blueprint project",
|
|
5311
|
-
detail: "Rocket Launch
|
|
5259
|
+
detail: "Rocket Launch example",
|
|
5312
5260
|
component: "blueprint"
|
|
5313
5261
|
},
|
|
5314
5262
|
{
|
|
@@ -5799,6 +5747,7 @@ async function inspectSetupRemovalInventory({
|
|
|
5799
5747
|
if (!globalThis.c8ctl) throw new Error("c8ctl runtime not initialised");
|
|
5800
5748
|
var c8ctl2 = globalThis.c8ctl;
|
|
5801
5749
|
var LOCAL_TENANT_ID = "<default>";
|
|
5750
|
+
var SETUP_BLUEPRINT = SETUP_BLUEPRINTS[0];
|
|
5802
5751
|
function applyComponentFlags(selected, flags) {
|
|
5803
5752
|
const next = new Set(selected);
|
|
5804
5753
|
if (flags["no-modeler"]) next.delete("modeler");
|
|
@@ -5808,7 +5757,7 @@ function applyComponentFlags(selected, flags) {
|
|
|
5808
5757
|
}
|
|
5809
5758
|
function effectiveBlueprint(selected) {
|
|
5810
5759
|
if (!selected.has("blueprint")) return void 0;
|
|
5811
|
-
return
|
|
5760
|
+
return SETUP_BLUEPRINT.id;
|
|
5812
5761
|
}
|
|
5813
5762
|
async function runPrerequisites(ctx) {
|
|
5814
5763
|
const results = await checkPrerequisites();
|
|
@@ -6034,9 +5983,8 @@ async function runModelerInstall(ctx) {
|
|
|
6034
5983
|
});
|
|
6035
5984
|
}
|
|
6036
5985
|
async function runBlueprintScaffold(ctx, run) {
|
|
6037
|
-
const id = run.blueprintId ?? SETUP_BLUEPRINTS[0].id;
|
|
6038
5986
|
const scaffolded = await scaffoldSetupBlueprint({
|
|
6039
|
-
id,
|
|
5987
|
+
id: SETUP_BLUEPRINT.id,
|
|
6040
5988
|
// The completion line is the step's takeaway — fresh or reused —
|
|
6041
5989
|
// so it survives the success collapse; progress chatter does not.
|
|
6042
5990
|
onProgress: (event) => ctx.logger.info(event.message, {
|
|
@@ -6047,14 +5995,11 @@ async function runBlueprintScaffold(ctx, run) {
|
|
|
6047
5995
|
}
|
|
6048
5996
|
async function runBlueprintDeploy(ctx, run) {
|
|
6049
5997
|
const { logger } = ctx;
|
|
6050
|
-
const blueprint = setupBlueprintById(
|
|
6051
|
-
run.blueprintId ?? SETUP_BLUEPRINTS[0].id
|
|
6052
|
-
);
|
|
6053
5998
|
const directory = run.blueprintDir;
|
|
6054
5999
|
if (!directory) {
|
|
6055
6000
|
throw new Error("The blueprint project was not created.");
|
|
6056
6001
|
}
|
|
6057
|
-
const deployDir =
|
|
6002
|
+
const deployDir = directory;
|
|
6058
6003
|
const health = await checkLocalClusterHealth();
|
|
6059
6004
|
if (!health.healthy) {
|
|
6060
6005
|
throw new Error(
|
|
@@ -6090,17 +6035,19 @@ async function runBlueprintDeploy(ctx, run) {
|
|
|
6090
6035
|
} finally {
|
|
6091
6036
|
rmSync3(deployDataDir, { recursive: true, force: true });
|
|
6092
6037
|
}
|
|
6093
|
-
const processFile = join7(directory,
|
|
6038
|
+
const processFile = join7(directory, SETUP_BLUEPRINT.processFile);
|
|
6094
6039
|
const processId = extractProcessId(readFileSync6(processFile, "utf-8"));
|
|
6095
6040
|
if (!processId) {
|
|
6096
|
-
throw new Error(
|
|
6041
|
+
throw new Error(
|
|
6042
|
+
`Could not find a process id in ${SETUP_BLUEPRINT.processFile}.`
|
|
6043
|
+
);
|
|
6097
6044
|
}
|
|
6098
|
-
logger.info(`Starting a ${
|
|
6045
|
+
logger.info(`Starting a ${SETUP_BLUEPRINT.name} process instance...`);
|
|
6099
6046
|
const created = await c8ctl2.createClient(DEFAULT_PROFILE).createProcessInstance({
|
|
6100
6047
|
processDefinitionId: ProcessDefinitionId.assumeExists(processId),
|
|
6101
6048
|
tenantId: TenantId.assumeExists(LOCAL_TENANT_ID),
|
|
6102
|
-
...
|
|
6103
|
-
variables:
|
|
6049
|
+
...SETUP_BLUEPRINT.startVariables !== void 0 && {
|
|
6050
|
+
variables: SETUP_BLUEPRINT.startVariables
|
|
6104
6051
|
}
|
|
6105
6052
|
});
|
|
6106
6053
|
logger.info(`Process instance created: ${created.processInstanceKey}`);
|
|
@@ -6207,9 +6154,9 @@ function withBufferedOutput(ctx, buffer, aroundPassthrough) {
|
|
|
6207
6154
|
});
|
|
6208
6155
|
return Object.create(ctx, { logger: { value: bufferedLogger } });
|
|
6209
6156
|
}
|
|
6210
|
-
async function executePlan(ctx, selected,
|
|
6157
|
+
async function executePlan(ctx, selected, { color }) {
|
|
6211
6158
|
const { logger } = ctx;
|
|
6212
|
-
const run = {
|
|
6159
|
+
const run = {};
|
|
6213
6160
|
const succeeded = /* @__PURE__ */ new Set();
|
|
6214
6161
|
let failures = 0;
|
|
6215
6162
|
const width = Math.max(...SETUP_STEPS.map((step) => step.title.length));
|
|
@@ -6733,22 +6680,7 @@ async function runSetup(ctx, flags) {
|
|
|
6733
6680
|
selected = defaultSelection();
|
|
6734
6681
|
}
|
|
6735
6682
|
selected = applyComponentFlags(selected, flags);
|
|
6736
|
-
|
|
6737
|
-
if (selected.has("blueprint") && interactive) {
|
|
6738
|
-
const choice = await ctx.prompt.select({
|
|
6739
|
-
message: "Which starter blueprint should we install?",
|
|
6740
|
-
options: SETUP_BLUEPRINTS.map((b) => ({
|
|
6741
|
-
label: b.name,
|
|
6742
|
-
description: `${b.description} \u2014 guide: ${b.guideUrl}`,
|
|
6743
|
-
value: b.id
|
|
6744
|
-
}))
|
|
6745
|
-
});
|
|
6746
|
-
if (choice.cancelled) {
|
|
6747
|
-
logger.info("Cancelled \u2014 nothing was changed.");
|
|
6748
|
-
return;
|
|
6749
|
-
}
|
|
6750
|
-
blueprintId = choice.value;
|
|
6751
|
-
}
|
|
6683
|
+
const blueprintId = effectiveBlueprint(selected);
|
|
6752
6684
|
if (jsonMode) {
|
|
6753
6685
|
logger.json(setupPlanPayload(selected, { blueprint: blueprintId }));
|
|
6754
6686
|
return;
|
|
@@ -6765,29 +6697,24 @@ async function runSetup(ctx, flags) {
|
|
|
6765
6697
|
{ essential: true }
|
|
6766
6698
|
);
|
|
6767
6699
|
}
|
|
6768
|
-
const { failures, run } = await executePlan(ctx, selected,
|
|
6769
|
-
color
|
|
6770
|
-
});
|
|
6700
|
+
const { failures, run } = await executePlan(ctx, selected, { color });
|
|
6771
6701
|
const nextSteps = [];
|
|
6772
6702
|
if (run.blueprintDir) {
|
|
6773
|
-
const blueprint = setupBlueprintById(
|
|
6774
|
-
run.blueprintId ?? SETUP_BLUEPRINTS[0].id
|
|
6775
|
-
);
|
|
6776
6703
|
if (run.processInstanceKey !== void 0) {
|
|
6777
6704
|
nextSteps.push(
|
|
6778
|
-
...
|
|
6705
|
+
...SETUP_BLUEPRINT.nextSteps({
|
|
6779
6706
|
projectDir: run.blueprintDir,
|
|
6780
6707
|
processInstanceKey: run.processInstanceKey
|
|
6781
6708
|
})
|
|
6782
6709
|
);
|
|
6783
6710
|
}
|
|
6784
6711
|
nextSteps.push(`Project: ${run.blueprintDir}`);
|
|
6785
|
-
nextSteps.push(`Guide: ${
|
|
6712
|
+
nextSteps.push(`Guide: ${SETUP_BLUEPRINT.guideUrl}`);
|
|
6786
6713
|
} else if (run.clusterStarted) {
|
|
6787
6714
|
nextSteps.push("Run your first process:");
|
|
6788
6715
|
nextSteps.push(' c8ctl use tenant "<default>"');
|
|
6789
6716
|
nextSteps.push(" c8ctl run my-process.bpmn --profile local");
|
|
6790
|
-
nextSteps.push('Or re-run "c8ctl setup" and
|
|
6717
|
+
nextSteps.push('Or re-run "c8ctl setup" and include the example project.');
|
|
6791
6718
|
}
|
|
6792
6719
|
if (run.clusterStarted) {
|
|
6793
6720
|
nextSteps.push("Operate: http://localhost:8080/operate (demo/demo)");
|
|
@@ -6838,15 +6765,15 @@ async function setupHandler(_args, flagsRecord, ctx) {
|
|
|
6838
6765
|
process.exitCode = 1;
|
|
6839
6766
|
}
|
|
6840
6767
|
}
|
|
6841
|
-
var SETUP_HELP_DESCRIPTION = `Guided first-run setup: install a local cluster,
|
|
6768
|
+
var SETUP_HELP_DESCRIPTION = `Guided first-run setup: install a local cluster, the Rocket Launch example, and AI assistant tooling.
|
|
6842
6769
|
|
|
6843
|
-
The wizard offers to start a local cluster (downloading Camunda 8 Run on first run), install Desktop Modeler, create
|
|
6770
|
+
The wizard offers to start a local cluster (downloading Camunda 8 Run on first run), install Desktop Modeler, create the Rocket Launch example, deploy and run it, and set up AI assistant tooling. Nothing is installed without your say.
|
|
6844
6771
|
|
|
6845
6772
|
Each step announces its title and ends in [SUCCESS], [ERROR] or [SKIPPED]; a step's own output is shown only when it fails, and a failed step does not stop the rest. The blueprint and the cluster MCP server need the local cluster \u2014 deselect the cluster and both options are disabled.
|
|
6846
6773
|
|
|
6847
6774
|
A browser window opens when the local cluster reports healthy; the docs MCP server asks you to sign in in a browser on first use \u2014 announced up front.
|
|
6848
6775
|
|
|
6849
|
-
A run without a selection (piped output, CI) installs nothing unless you pass --yes; --json prints the plan without executing.
|
|
6776
|
+
A run without a selection (piped output, CI) installs nothing unless you pass --yes; --json prints the plan without executing. Setup always uses the Rocket Launch example.
|
|
6850
6777
|
|
|
6851
6778
|
Exit code 0: every selected setup step succeeded, or nothing was installed for lack of a go-ahead (wizard cancelled with Escape; a piped, --quiet or JSON-mode run without --yes; --json or --dry-run printing the plan). Ctrl+C ends the wizard by signal (130 on POSIX shells). A re-run reuses finished work where possible; the deploy, process start and skills install repeat by design. Exit code 1: arguments failed validation, or a step failed \u2014 other eligible steps still ran, while dependents (and the deploy finale after any failure) were skipped.
|
|
6852
6779
|
|