@synopackageland/cli 0.48.5 → 0.48.7
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/CHANGELOG.md +5 -0
- package/README.md +14 -7
- package/dist/standalone/daemon-nofile.d.ts +6 -6
- package/dist/standalone/daemon-nofile.js +8 -48
- package/dist/standalone/daemon.d.ts +1 -1
- package/dist/standalone/daemon.js +2 -2
- package/dist/standalone/inspect-spk.js +3 -1
- package/dist/standalone/lifecycle.js +3 -4
- package/dist/standalone/manifest.js +3 -1
- package/dist/standalone/spk.js +2 -5
- package/docs/daemon-nofile.md +81 -0
- package/package.json +4 -2
- package/skills/SKILL.md +5 -2
- package/skills/reference/compose.md +4 -2
- package/skills/reference/create.md +2 -0
- package/skills/reference/ctl.md +1 -1
- package/skills/reference/identity-gateway.md +4 -2
- package/skills/reference/install.md +3 -1
- package/skills/reference/lifecycle.md +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
- Reject daemon.nofile in check, build and inspect until package-safe activation is supported
|
|
6
|
+
- Stop daemons through the non-root SDK controller during migration and teardown; continue executor cleanup after a daemon stop failure
|
|
7
|
+
|
|
3
8
|
## 0.48.5
|
|
4
9
|
|
|
5
10
|
- Require templates ~0.40.0: new scaffolds pin SDK/App 0.50.0 and UI 0.20.0, whose AppShell pages show no visible title and scroll only their content; the CLI controller SDK default stays 0.49.5
|
package/README.md
CHANGED
|
@@ -89,9 +89,16 @@ alongside npm lockfiles. Do not disable checksum verification for public SDK
|
|
|
89
89
|
packages. Private mirrors can use explicitly configured Go authentication and
|
|
90
90
|
checksum settings; a failed fetch reports `SDK_DOWNLOAD_FAILED`.
|
|
91
91
|
|
|
92
|
-
The CLI pins
|
|
93
|
-
context. Explicit App SDK declarations take precedence.
|
|
94
|
-
|
|
92
|
+
The CLI pins an SDK release for its daemon controllers, Compose planning and installer
|
|
93
|
+
context. Explicit App SDK declarations take precedence. Locally installed templates
|
|
94
|
+
retain their own scaffold SDK pins; none declare daemon ingress.
|
|
95
|
+
|
|
96
|
+
`daemon.nofile` is currently unsupported. `check`, `build` and `inspect` report
|
|
97
|
+
`STANDALONE_DAEMON_NOFILE_UNSUPPORTED`: registering a system unit does not let
|
|
98
|
+
package-account hooks activate it. Remove this option to use the daemon's inherited
|
|
99
|
+
limits. This does not guarantee a higher file descriptor limit. See
|
|
100
|
+
[daemon file descriptor limits and migration](docs/daemon-nofile.md).
|
|
101
|
+
|
|
95
102
|
Every App method is declared once in operations.json; ctl generate writes the
|
|
96
103
|
permissions table and runtime bindings. Dynamic names and custom HTTP dispatchers
|
|
97
104
|
are rejected. Use fixed
|
|
@@ -102,8 +109,8 @@ unimported development commands are excluded. Use
|
|
|
102
109
|
authentication. See [App entry and registration](docs/app-entry.md).
|
|
103
110
|
|
|
104
111
|
`init` and `add` read their templates from the locally installed
|
|
105
|
-
`@synopackageland/templates`. The CLI
|
|
106
|
-
|
|
112
|
+
`@synopackageland/templates`. The CLI's npm dependency range selects compatible
|
|
113
|
+
templates patches during installation or update. Templates
|
|
107
114
|
patches need only a templates release; update the npm installation to receive them.
|
|
108
115
|
The CLI never fetches templates at runtime, so offline use works after installation;
|
|
109
116
|
commit a lockfile and use `npm ci` to reproduce a chosen dependency tree.
|
|
@@ -364,7 +371,7 @@ contract for the complete transport and CGI validation rules.
|
|
|
364
371
|
|
|
365
372
|
`webapi.call` request parameters are JSON-only; it has no request upload field.
|
|
366
373
|
Use streaming `files.write` for uploads, up to 100 MiB per file. Reads and URL
|
|
367
|
-
downloads retain their separate 64 MiB limit. Rebuild with SDK
|
|
374
|
+
downloads retain their separate 64 MiB limit. Rebuild with an SDK that supports the requested file descriptor budget and approve
|
|
368
375
|
the refreshed executor payload.
|
|
369
376
|
|
|
370
377
|
## App launch mode
|
|
@@ -629,7 +636,7 @@ package start activates nginx.
|
|
|
629
636
|
|
|
630
637
|
Older SDK/DSM targets retain the direct listener and explain its certificate or
|
|
631
638
|
unencrypted-HTTP limitations before opening it. Native resource/startup failures
|
|
632
|
-
fail closed; they do not silently expose a direct listener. The native runtime uses the resolved SDK release; new scaffolds pin the SDK
|
|
639
|
+
fail closed; they do not silently expose a direct listener. The native runtime uses the resolved SDK release; new scaffolds pin the SDK selected by the installed templates.
|
|
633
640
|
|
|
634
641
|
Compose Apps may opt in to Intel render devices with
|
|
635
642
|
`compose.devices.gpu.services: [media]`. The matching SDK discovers exact devices
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import type { StandaloneError
|
|
1
|
+
import type { StandaloneError } from './manifest.js';
|
|
2
2
|
export declare const DAEMON_NOFILE_MIN_SDK = "0.49.5";
|
|
3
3
|
export declare const DAEMON_NOFILE_MIN_DSM = "7.0-40761";
|
|
4
|
+
export declare const DAEMON_NOFILE_UNSUPPORTED = "STANDALONE_DAEMON_NOFILE_UNSUPPORTED";
|
|
5
|
+
export declare const DAEMON_NOFILE_ACTIVATION_PROBLEM = "daemon.nofile is currently unsupported: DSM package hooks cannot activate the required system unit as the package account. Remove daemon.nofile to use inherited limits; higher limits require a verified native mechanism or an explicitly approved, package-scoped SDK service-control operation.";
|
|
6
|
+
/** Do not ship a registered unit that the package account cannot activate. */
|
|
7
|
+
export declare function requireDaemonNoFileActivation(nofile?: number): void;
|
|
4
8
|
export declare function daemonNoFileSdkProblem(sdk: string): string | undefined;
|
|
5
9
|
export declare function daemonNoFileIdentityProblem(pkg: string): string | undefined;
|
|
6
10
|
export declare function readNoFile(value: unknown, fail: (e: StandaloneError) => void): number | undefined;
|
|
7
11
|
export declare function daemonSystemUnitName(pkg: string): string;
|
|
12
|
+
/** Legacy archive shape, retained for inspection only. New builds reject NOFILE. */
|
|
8
13
|
export declare function renderDaemonSystemUnit(pkg: string, nofile: number): string;
|
|
9
|
-
/** One fixed dispatch layer covers every native lifecycle composition, including
|
|
10
|
-
* delegated jobs and rootOps. The unit itself calls the SDK directly. */
|
|
11
|
-
export declare function renderNoFileLifecycle(manifest: StandaloneManifest, script: string): string;
|
|
12
|
-
/** Refuse old pins or mismatched local SDK overrides before producing an SPK. */
|
|
13
|
-
export declare function requireDaemonNoFileSource(dir: string, sdk: string, nofile?: number): void;
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import { readFileSync } from 'node:fs';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
1
|
import { StandaloneBuildError } from './spk.js';
|
|
4
2
|
export const DAEMON_NOFILE_MIN_SDK = '0.49.5';
|
|
5
3
|
export const DAEMON_NOFILE_MIN_DSM = '7.0-40761';
|
|
4
|
+
export const DAEMON_NOFILE_UNSUPPORTED = 'STANDALONE_DAEMON_NOFILE_UNSUPPORTED';
|
|
5
|
+
export const DAEMON_NOFILE_ACTIVATION_PROBLEM = 'daemon.nofile is currently unsupported: DSM package hooks cannot activate the required system unit as the package account. Remove daemon.nofile to use inherited limits; higher limits require a verified native mechanism or an explicitly approved, package-scoped SDK service-control operation.';
|
|
6
|
+
/** Do not ship a registered unit that the package account cannot activate. */
|
|
7
|
+
export function requireDaemonNoFileActivation(nofile) {
|
|
8
|
+
if (nofile !== undefined)
|
|
9
|
+
throw new StandaloneBuildError(DAEMON_NOFILE_UNSUPPORTED, DAEMON_NOFILE_ACTIVATION_PROBLEM);
|
|
10
|
+
}
|
|
6
11
|
export function daemonNoFileSdkProblem(sdk) {
|
|
7
12
|
const match = /^(\d+)\.(\d+)\.(\d+)$/.exec(sdk);
|
|
8
13
|
if (match) {
|
|
@@ -24,6 +29,7 @@ export function readNoFile(value, fail) {
|
|
|
24
29
|
fail({ code: 'STANDALONE_DAEMON_NOFILE_INVALID', message: 'daemon.nofile must be an integer from 1024 to 1048576; the daemon always runs as the package account' });
|
|
25
30
|
}
|
|
26
31
|
export function daemonSystemUnitName(pkg) { return `pkg-${pkg}-daemon.service`; }
|
|
32
|
+
/** Legacy archive shape, retained for inspection only. New builds reject NOFILE. */
|
|
27
33
|
export function renderDaemonSystemUnit(pkg, nofile) {
|
|
28
34
|
const problem = daemonNoFileIdentityProblem(pkg);
|
|
29
35
|
if (problem)
|
|
@@ -48,49 +54,3 @@ TimeoutStartSec=0
|
|
|
48
54
|
TimeoutStopSec=0
|
|
49
55
|
`;
|
|
50
56
|
}
|
|
51
|
-
/** One fixed dispatch layer covers every native lifecycle composition, including
|
|
52
|
-
* delegated jobs and rootOps. The unit itself calls the SDK directly. */
|
|
53
|
-
export function renderNoFileLifecycle(manifest, script) {
|
|
54
|
-
if (manifest.daemon?.nofile === undefined)
|
|
55
|
-
return script;
|
|
56
|
-
const pkg = manifest.package, unit = daemonSystemUnitName(pkg);
|
|
57
|
-
const controls = [`"/var/packages/${pkg}/target/daemon/control"`, `"\${SYNOPKG_PKGDEST:-/var/packages/${pkg}/target}/daemon/control"`];
|
|
58
|
-
if (!controls.some(c => script.includes(c)))
|
|
59
|
-
return script;
|
|
60
|
-
for (const control of controls)
|
|
61
|
-
script = script.replaceAll(`exec ${control}`, 'synopkgland_daemon_control').replaceAll(control, 'synopkgland_daemon_control');
|
|
62
|
-
const dispatch = `synopkgland_daemon_control() {
|
|
63
|
-
synopkgland_daemon_action="$1"
|
|
64
|
-
shift
|
|
65
|
-
case "$synopkgland_daemon_action" in
|
|
66
|
-
start|restart) /usr/syno/bin/synosystemctl "$synopkgland_daemon_action" ${unit} ;;
|
|
67
|
-
stop)
|
|
68
|
-
if [ -f /usr/local/lib/systemd/system/${unit} ]; then
|
|
69
|
-
/usr/syno/bin/synosystemctl stop ${unit} || return $?
|
|
70
|
-
fi
|
|
71
|
-
"\${SYNOPKG_PKGDEST:-/var/packages/${pkg}/target}/daemon/control" stop "$@" ;;
|
|
72
|
-
uninstall)
|
|
73
|
-
if [ -f /usr/local/lib/systemd/system/${unit} ]; then
|
|
74
|
-
/usr/syno/bin/synosystemctl stop ${unit} || return $?
|
|
75
|
-
fi
|
|
76
|
-
"\${SYNOPKG_PKGDEST:-/var/packages/${pkg}/target}/daemon/control" uninstall "$@" ;;
|
|
77
|
-
*) "\${SYNOPKG_PKGDEST:-/var/packages/${pkg}/target}/daemon/control" "$synopkgland_daemon_action" "$@" ;;
|
|
78
|
-
esac
|
|
79
|
-
}
|
|
80
|
-
`;
|
|
81
|
-
return script.replace('#!/bin/sh\n', () => `#!/bin/sh\n${dispatch}`);
|
|
82
|
-
}
|
|
83
|
-
/** Refuse old pins or mismatched local SDK overrides before producing an SPK. */
|
|
84
|
-
export function requireDaemonNoFileSource(dir, sdk, nofile) {
|
|
85
|
-
if (nofile === undefined)
|
|
86
|
-
return;
|
|
87
|
-
let main = '', linux = '';
|
|
88
|
-
try {
|
|
89
|
-
main = readFileSync(join(dir, 'daemonctl/main.go'), 'utf8');
|
|
90
|
-
linux = readFileSync(join(dir, 'daemonctl/nofile_linux.go'), 'utf8');
|
|
91
|
-
}
|
|
92
|
-
catch { /* Fail closed below. */ }
|
|
93
|
-
const problem = daemonNoFileSdkProblem(sdk);
|
|
94
|
-
if (problem || !/\bNoFile\s+int\s+`json:"nofile,omitempty"`/.test(main) || !main.includes('validateNoFile(cfg.NoFile)') || !main.includes('applyNoFile(c.NoFile)') || !linux.includes('func applyNoFile('))
|
|
95
|
-
throw new StandaloneBuildError('STANDALONE_DAEMON_NOFILE_SDK_REQUIRED', problem ?? `daemon.nofile requires matching SDK ${DAEMON_NOFILE_MIN_SDK} source with validated non-root NOFILE inheritance; update the SDK pin or development override before building`);
|
|
96
|
-
}
|
|
@@ -5,7 +5,7 @@ import { type DaemonRestart } from "./daemon-restart.js";
|
|
|
5
5
|
import type { CommandRunner } from "./build.js";
|
|
6
6
|
import type { StandaloneError, StandaloneManifest } from "./manifest.js";
|
|
7
7
|
export interface Daemon {
|
|
8
|
-
/**
|
|
8
|
+
/** Legacy inventory only; new builds reject this until activation is package-safe. */
|
|
9
9
|
nofile?: number;
|
|
10
10
|
/** Optional bounded recovery; omission uses the SDK controller default. SDK 0.26.0 or later. */
|
|
11
11
|
restart?: DaemonRestart;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { readNoFile,
|
|
1
|
+
import { readNoFile, requireDaemonNoFileActivation } from "./daemon-nofile.js";
|
|
2
2
|
import { portDefaults } from "./install-ports.js";
|
|
3
3
|
import { operationBudgetSeconds, runtimeBudgetSdkSupported } from "../runtime/runtime-budgets.js";
|
|
4
4
|
import { goChildEnv } from "../runtime/go-env.js";
|
|
@@ -234,11 +234,11 @@ export function requireBackendDaemonSource(source, daemon) {
|
|
|
234
234
|
export async function buildDaemonControl(manifest, arch, work, run) {
|
|
235
235
|
if (!manifest.daemon && !(manifest.compose && manifest.identityGateway))
|
|
236
236
|
return undefined;
|
|
237
|
+
requireDaemonNoFileActivation(manifest.daemon?.nofile);
|
|
237
238
|
const out = join(work, `daemon-control-${arch}`);
|
|
238
239
|
const sdk = daemonSdkVersion(manifest);
|
|
239
240
|
const source = runtimeBudgetSource(sdkSource(sdk).goDir, manifest);
|
|
240
241
|
requireDaemonRestartSource(source, sdk, manifest.daemon?.restart);
|
|
241
|
-
requireDaemonNoFileSource(source, sdk, manifest.daemon?.nofile);
|
|
242
242
|
requireBackendDaemonSource(source, manifest.daemon);
|
|
243
243
|
const result = await run("go", [
|
|
244
244
|
"build",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { readNoFile, daemonSystemUnitName, renderDaemonSystemUnit, daemonNoFileSdkProblem, daemonNoFileIdentityProblem, DAEMON_NOFILE_MIN_DSM } from "./daemon-nofile.js";
|
|
1
|
+
import { DAEMON_NOFILE_UNSUPPORTED, DAEMON_NOFILE_ACTIVATION_PROBLEM, readNoFile, daemonSystemUnitName, renderDaemonSystemUnit, daemonNoFileSdkProblem, daemonNoFileIdentityProblem, DAEMON_NOFILE_MIN_DSM } from "./daemon-nofile.js";
|
|
2
2
|
import { gatewayIngressPathProblem, gatewayIngressOwnershipSupported } from './gateway-ingress.js';
|
|
3
3
|
import { renderGatewayIngressCheck } from './native-gateway.js';
|
|
4
4
|
import { portDefaults, portInstallSteps } from "./install-ports.js";
|
|
@@ -155,6 +155,8 @@ export async function inspectSpk(spkPath, expectedKind) {
|
|
|
155
155
|
}
|
|
156
156
|
const dependencies = inspectPackageDependencies(metadata.dependencies, findings);
|
|
157
157
|
const daemonNoFile = readNoFile(metadata.daemon_nofile, e => findings.push(e.message));
|
|
158
|
+
if (metadata.daemon_nofile !== undefined)
|
|
159
|
+
findings.push(`[${DAEMON_NOFILE_UNSUPPORTED}] ${DAEMON_NOFILE_ACTIVATION_PROBLEM}`);
|
|
158
160
|
if (daemonNoFile !== undefined) {
|
|
159
161
|
const problem = daemonNoFileSdkProblem(typeof metadata.daemon_sdk === 'string' ? metadata.daemon_sdk : 'unknown');
|
|
160
162
|
if (problem)
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { renderNoFileLifecycle } from "./daemon-nofile.js";
|
|
2
1
|
import { renderGatewayIngressCheck } from './native-gateway.js';
|
|
3
2
|
import { renderSettingsHook } from './install-settings.js';
|
|
4
3
|
import { renderComposeRetainedData } from "../build-spk/compose-retained-data.js";
|
|
@@ -16,7 +15,7 @@ import { composeAppScript } from "./app-scripts.js";
|
|
|
16
15
|
const UNINSTALL_ONLY = '[ "${SYNOPKG_PKG_STATUS:-}" = UPGRADE ] || synopkgland_uninstall_hook\n';
|
|
17
16
|
/** Package-account lifecycle hooks for CGI, daemon and background packages. */
|
|
18
17
|
export function renderStandaloneScript(name, manifest) {
|
|
19
|
-
const script =
|
|
18
|
+
const script = renderStandaloneScriptInternal(name, manifest);
|
|
20
19
|
const prefix = renderStandaloneScriptPrefix(name, manifest);
|
|
21
20
|
const sdk = prefix ? script.replace('#!/bin/sh\n', () => '#!/bin/sh\n' + prefix) : script;
|
|
22
21
|
return manifest.appScripts?.some((app) => app === name)
|
|
@@ -161,9 +160,9 @@ function renderStandaloneScriptBody(name, manifest) {
|
|
|
161
160
|
},
|
|
162
161
|
});
|
|
163
162
|
const stopDaemon = manifest.daemon
|
|
164
|
-
? `"/var/packages/${manifest.package}/target/daemon/control" stop "\${SYNOPKG_PKGDEST:-/var/packages/${manifest.package}/target}" "\${SYNOPKG_PKGVAR:-/var/packages/${manifest.package}/var}" ||
|
|
163
|
+
? `"/var/packages/${manifest.package}/target/daemon/control" stop "\${SYNOPKG_PKGDEST:-/var/packages/${manifest.package}/target}" "\${SYNOPKG_PKGVAR:-/var/packages/${manifest.package}/var}" || daemon_result=$?\n`
|
|
165
164
|
: "";
|
|
166
|
-
return normal.replace("#!/bin/sh\n", `#!/bin/sh\n${workerStop}if [ "$1" = start ]; then\n${request("start")}fi\nif [ "$1" = stop ]; then\n${stopWorker}${stopDaemon}${request("stop")}${workerResult}fi\n`);
|
|
165
|
+
return normal.replace("#!/bin/sh\n", `#!/bin/sh\n${workerStop}if [ "$1" = start ]; then\n${request("start")}fi\nif [ "$1" = stop ]; then\n${stopWorker}daemon_result=0\n${stopDaemon}${request("stop")}[ "$daemon_result" = 0 ] || exit "$daemon_result"\n${workerResult}fi\n`);
|
|
167
166
|
}
|
|
168
167
|
if (name === "preuninst")
|
|
169
168
|
return renderExecutorPreuninst(manifest, workerStop, stopWorker, workerResult, request);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { daemonNoFileSdkProblem, daemonNoFileIdentityProblem, DAEMON_NOFILE_MIN_DSM } from './daemon-nofile.js';
|
|
1
|
+
import { daemonNoFileSdkProblem, daemonNoFileIdentityProblem, DAEMON_NOFILE_MIN_DSM, DAEMON_NOFILE_UNSUPPORTED, DAEMON_NOFILE_ACTIVATION_PROBLEM } from './daemon-nofile.js';
|
|
2
2
|
import { readRegistry, registryFile } from '../ctl/registry.js';
|
|
3
3
|
import { gatewayIngressPathProblem, gatewayIngressOwnershipSupported } from './gateway-ingress.js';
|
|
4
4
|
import { nativeGatewaySdk } from "./native-gateway.js";
|
|
@@ -348,6 +348,8 @@ function readManifest(raw, c) {
|
|
|
348
348
|
if (problem)
|
|
349
349
|
c.fail("STANDALONE_DAEMON_INGRESS_MIN_DSM", problem);
|
|
350
350
|
}
|
|
351
|
+
if (daemon?.nofile !== undefined)
|
|
352
|
+
c.fail(DAEMON_NOFILE_UNSUPPORTED, DAEMON_NOFILE_ACTIVATION_PROBLEM);
|
|
351
353
|
if (daemon?.nofile !== undefined && backend) {
|
|
352
354
|
if (osMinVer && !isDsmAtLeast(osMinVer, DAEMON_NOFILE_MIN_DSM))
|
|
353
355
|
c.fail('STANDALONE_DAEMON_NOFILE_DSM_REQUIRED', `daemon.nofile requires DSM ${DAEMON_NOFILE_MIN_DSM} or later; the target is never raised automatically`);
|
package/dist/standalone/spk.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { requireDaemonNoFileActivation } from "./daemon-nofile.js";
|
|
2
2
|
import { gatewayIngressOwnershipSupported } from './gateway-ingress.js';
|
|
3
3
|
import { portDefaults, portInstallSteps, writePortPayload } from "./install-ports.js";
|
|
4
4
|
import { packageDependencies, dependencyInfo } from "./package-dependencies.js";
|
|
@@ -73,6 +73,7 @@ export class StandaloneBuildError extends Error {
|
|
|
73
73
|
*/
|
|
74
74
|
export async function assembleStandaloneSpk(options) {
|
|
75
75
|
const { manifest } = options;
|
|
76
|
+
requireDaemonNoFileActivation(manifest.daemon?.nofile);
|
|
76
77
|
const staging = mkdtempSync(join(tmpdir(), "syno-standalone-spk-"));
|
|
77
78
|
try {
|
|
78
79
|
if ((manifest.capabilities.rootOps ||
|
|
@@ -302,10 +303,6 @@ export async function assembleStandaloneSpk(options) {
|
|
|
302
303
|
const resource = renderStandaloneResource(manifest, portal);
|
|
303
304
|
if (resource)
|
|
304
305
|
writeFile(join(staging, "conf", "resource"), resource);
|
|
305
|
-
if (manifest.daemon?.nofile !== undefined) {
|
|
306
|
-
mkdirSync(join(staging, "conf/systemd"), { recursive: true });
|
|
307
|
-
writeFile(join(staging, "conf/systemd", daemonSystemUnitName(manifest.package)), renderDaemonSystemUnit(manifest.package, manifest.daemon.nofile));
|
|
308
|
-
}
|
|
309
306
|
if (manifest.capabilities.jobs) {
|
|
310
307
|
mkdirSync(join(staging, BACKGROUND_UNIT_DIR), { recursive: true });
|
|
311
308
|
writeFile(join(staging, BACKGROUND_UNIT_DIR, backgroundUnitName(manifest.package)), renderBackgroundUnit(manifest.package, isBridgeBackend(manifest.backend) ? BRIDGE_WORKER_ARGS : [], manifest.daemon?.timeouts.stop ?? manifest.lifecycleTimeouts?.stop ?? 30));
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Daemon file descriptor limits
|
|
2
|
+
|
|
3
|
+
`daemon.nofile` is currently unsupported. Manifest validation, SPK building
|
|
4
|
+
(including direct assembly) and inspection report
|
|
5
|
+
`STANDALONE_DAEMON_NOFILE_UNSUPPORTED`. No system unit is generated for new
|
|
6
|
+
packages. Removing the option preserves ordinary non-root SDK startup with the
|
|
7
|
+
limits inherited from DSM; it does not establish any minimum above those limits.
|
|
8
|
+
|
|
9
|
+
The numeric declaration and legacy archive unit shape remain readable so an old
|
|
10
|
+
SPK produces an actionable diagnostic instead of silently passing inspection.
|
|
11
|
+
|
|
12
|
+
## DSM activation boundary
|
|
13
|
+
|
|
14
|
+
DSM's [systemd resource documentation](https://help.synology.com/developer-guide/resource_acquisition/systemd_user_unit.html)
|
|
15
|
+
distinguishes user units from system units. The framework registers and removes
|
|
16
|
+
`conf/systemd/pkg-*` units. This does not authorize a package-account lifecycle
|
|
17
|
+
hook to start or stop those system units.
|
|
18
|
+
|
|
19
|
+
A controlled DSM 7.3.2 fixture established these limits:
|
|
20
|
+
|
|
21
|
+
- The generated package service and its package-account hooks inherit a hard
|
|
22
|
+
NOFILE limit of 4096. The shell hook's soft limit is 1024.
|
|
23
|
+
- `conf/systemd/override/pkg-service` applies `TimeoutStartSec`, but does not
|
|
24
|
+
propagate `LimitNOFILE` into the generated service.
|
|
25
|
+
- An INFO `start_dep_services` declaration naming the custom package system unit
|
|
26
|
+
does not activate it. An `[Install]` dependency alone does not enable it.
|
|
27
|
+
- Package-account `synosystemctl` and `systemctl` requests are denied. A user
|
|
28
|
+
manager cannot raise its inherited hard limit; see
|
|
29
|
+
[systemd's resource limit rules](https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html).
|
|
30
|
+
|
|
31
|
+
These observations qualify the current refusal. They do not prove that every DSM
|
|
32
|
+
release lacks another native mechanism. Support requires a verified activation
|
|
33
|
+
and teardown mechanism, not just a syntactically valid unit file.
|
|
34
|
+
|
|
35
|
+
## Migration and cleanup
|
|
36
|
+
|
|
37
|
+
Regenerate a package after removing `daemon.nofile`. Its lifecycle hooks call the
|
|
38
|
+
SDK daemon controller directly for stop, upgrade and uninstall, including when
|
|
39
|
+
the outgoing payload has a legacy NOFILE unit. They do not attempt unprivileged
|
|
40
|
+
system-manager control first. Executor stop still runs after a daemon stop
|
|
41
|
+
failure and the hook preserves failure status.
|
|
42
|
+
|
|
43
|
+
DSM owns removal of the old registered unit during resource release on upgrade
|
|
44
|
+
or uninstall. Hooks do not unlink system files or invoke `daemon-reload` as the
|
|
45
|
+
package account.
|
|
46
|
+
|
|
47
|
+
An already installed legacy hook can prevent DSM from reaching that release:
|
|
48
|
+
DSM uses the incoming `preupgrade` but still runs the outgoing `preuninst`.
|
|
49
|
+
The old hook tries to stop the system unit and returns on access denial even
|
|
50
|
+
when SDK stop already succeeded. Upgrading the CLI cannot rewrite that installed
|
|
51
|
+
hook. Such an installation requires administrator recovery of its exact legacy
|
|
52
|
+
unit before retrying an upgrade or uninstall. The CLI does not perform that
|
|
53
|
+
privileged recovery automatically. Automatic migration of these broken outgoing
|
|
54
|
+
hooks remains unsupported until the approved service-control contract exists.
|
|
55
|
+
|
|
56
|
+
A failed SDK teardown remains a failure requiring recovery. Removing the manifest
|
|
57
|
+
option does not make an application that needs a higher limit ready for release.
|
|
58
|
+
|
|
59
|
+
## Required contract for a privileged SDK alternative
|
|
60
|
+
|
|
61
|
+
If no native mechanism meets the lifecycle requirements, a future SDK operation
|
|
62
|
+
would need administrator-approved root executor authority. It is not implemented
|
|
63
|
+
or implicitly authorized by `daemon.nofile`.
|
|
64
|
+
|
|
65
|
+
- Derive exactly one unit name, `pkg-<validated-package>-daemon.service`, from the
|
|
66
|
+
executor's trusted package identity. Accept only a fixed action enum such as
|
|
67
|
+
start, stop and restart; accept no caller-supplied unit name, command or path.
|
|
68
|
+
- Anchor the installed unit bytes to the approved package payload. Verify the
|
|
69
|
+
fixed SDK executable, package User/Group, package slice, NOFILE value and
|
|
70
|
+
lifecycle arguments before every privileged control operation. Reject replaced,
|
|
71
|
+
symlinked, foreign or mismatched units.
|
|
72
|
+
- Require a distinct, digest-bound service-control approval. Ordinary daemon
|
|
73
|
+
startup, App code, the daemon controller and every worker remain non-root;
|
|
74
|
+
`conf/privilege` retains `defaults.run-as: package`.
|
|
75
|
+
- Bound operations, verify readiness and report the actual manager failure.
|
|
76
|
+
During stop, upgrade and uninstall, attempt SDK cleanup even if service control
|
|
77
|
+
fails. Preserve failed/cleanup-required outcomes and support recovery after a
|
|
78
|
+
partially completed operation.
|
|
79
|
+
- Verify old-unit release, rollback and uninstall with an active legacy unit.
|
|
80
|
+
Never use App-side sudo, a broad root lifecycle hook or arbitrary systemctl
|
|
81
|
+
access as a substitute for this operation.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synopackageland/cli",
|
|
3
|
-
"version": "0.48.
|
|
3
|
+
"version": "0.48.7",
|
|
4
4
|
"description": "Syno Package Land Developer Kit CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -16,9 +16,11 @@
|
|
|
16
16
|
"schema",
|
|
17
17
|
"docs/ctl-external.md",
|
|
18
18
|
"skills",
|
|
19
|
-
"docs/shared-folders.md"
|
|
19
|
+
"docs/shared-folders.md",
|
|
20
|
+
"docs/daemon-nofile.md"
|
|
20
21
|
],
|
|
21
22
|
"scripts": {
|
|
23
|
+
"check:docs": "node --test scripts/check-doc-versions.test.mjs && node scripts/check-doc-versions.mjs",
|
|
22
24
|
"build": "rm -rf dist && tsc",
|
|
23
25
|
"test": "npm run build && node --import tsx --test --test-concurrency=${SYNOPKGLAND_GATE_JOBS:-3} test/*.test.ts test/ctl/*.test.ts",
|
|
24
26
|
"test:glossary": "node --test scripts/test/glossary-drift.test.mjs",
|
package/skills/SKILL.md
CHANGED
|
@@ -5,7 +5,7 @@ description: Initialize, extend, check, build, inspect, and deploy Synology appl
|
|
|
5
5
|
|
|
6
6
|
# Independent Synology SPKs
|
|
7
7
|
|
|
8
|
-
The CLI installs templates through
|
|
8
|
+
The CLI installs templates through its declared npm dependency range. A templates patch needs only a
|
|
9
9
|
templates release; npm install/update selects a patch in that minor line. The CLI
|
|
10
10
|
uses the locally installed templates and reads their SDK pin for defaults; it
|
|
11
11
|
never downloads templates at runtime. Preserve the lockfile and use `npm ci` for
|
|
@@ -14,7 +14,10 @@ the CLI: executor manifest format 1 in the resolved SDK pins the executor releas
|
|
|
14
14
|
Go toolchain and six payload digests. Preserve npm integrity and Go module sums.
|
|
15
15
|
The CLI verifies bytes before packaging and never fetches a manifest at NAS runtime.
|
|
16
16
|
Unsupported formats require a CLI update; invalid manifests fail closed.
|
|
17
|
-
|
|
17
|
+
Scaffolds pin matching SDK/App releases and declare operations in one v2 registry.
|
|
18
|
+
Query published releases with `npm view @synopackageland/cli version`,
|
|
19
|
+
`npm view @synopackageland/templates version` and `npm view @synopackageland/sdk version`;
|
|
20
|
+
keep the installed dependency tree and generated pins consistent.
|
|
18
21
|
|
|
19
22
|
For Apps with data folders or gateway listeners, read [reference/install.md](reference/install.md). Default to an App-named dedicated DSM data share and installer-selected ports. Existing-folder access, port number format/range and required HTTPS origins use localized wizard validation before Next; detected port conflicts are nonblocking inline warnings, and an unavailable DSM port inventory does not block installation; upgrades retain port selections.
|
|
20
23
|
|
|
@@ -4,6 +4,8 @@ The CLI converts schema-2 declarations to an SPK. The SDK owns Compose planning,
|
|
|
4
4
|
identity gateway and lifecycle control. There is no separate wrapper container
|
|
5
5
|
or SSO Server. Upstream files stay byte-for-byte unchanged, including comments.
|
|
6
6
|
|
|
7
|
+
`<sdk-version>` is a placeholder, not manifest syntax. `synopkgland init` copies compatible SDK pins from the locally installed templates. For a manual configuration, query `npm view @synopackageland/sdk version`, replace the placeholder with that exact release, and keep all App SDK declarations (including Go, Rust and frontend dependencies) aligned. Run `synopkgland check` with an up-to-date CLI before building.
|
|
8
|
+
|
|
7
9
|
```yaml
|
|
8
10
|
schema: 2
|
|
9
11
|
package: MediaApp
|
|
@@ -39,7 +41,7 @@ architecture-specific native payloads for token/account adapters. All lifecycle
|
|
|
39
41
|
scripts run as the package account; containers are managed by Container Manager.
|
|
40
42
|
|
|
41
43
|
For external access, pin both `compose.sdk` and `identity_gateway.sdk` to
|
|
42
|
-
the
|
|
44
|
+
the same release with external access support and use the gateway's
|
|
43
45
|
[`external_access` policy and DSM settings entry](identity-gateway.md#external-access).
|
|
44
46
|
Declare required HTTPS origins through `install.settings`; wizard validation checks the selected HTTPS port before Next. See [install.md](install.md).
|
|
45
47
|
Manual URL configuration does not require Connect. The SDK resolves the public
|
|
@@ -260,7 +262,7 @@ declared availability readiness, LAN isolation/egress, protected grant lifecycle
|
|
|
260
262
|
ACLs, two-user visibility and clean install/upgrade/reboot/stop/uninstall before
|
|
261
263
|
calling the package supported on a NAS. No NAS is accessed by the build gate.
|
|
262
264
|
|
|
263
|
-
The unified Compose contract uses SDK defaults from
|
|
265
|
+
The unified Compose contract uses SDK defaults from locally installed templates and a matching CLI. Templates patches can ship independently; npm install/update resolves them, and SDK defaults come from the installed templates. SDK minor upgrades do not require a CLI release when they declare supported executor manifest format 1; the resolved SDK owns the release mapping and verified payload digests. The CLI does not fetch templates at runtime. The legacy packaging route and bridge publish mode are removed.
|
|
264
266
|
|
|
265
267
|
Primary override files, and each included override set, must share a directory. Cross-directory override bases are rejected before loader I/O. Included implicit .env files are confined, inventoried and preserved; symlinks are rejected.
|
|
266
268
|
|
|
@@ -45,6 +45,8 @@ rootOps 與 delegate 已共用管理員 PasswordConfirm 核准的 protected exec
|
|
|
45
45
|
|
|
46
46
|
backend 寫 `runtime: python|node|rust`(`runtime: go` 等同 `kind: go`)。CGI 是 SDK 的 Go runtime(`bridge/cmd/runtime`),它驗證 DSM session、entry 與 `permissions.json` 後,以套件帳號(不是 root)每個請求啟動一次 App。App 放在 ui 以外的目錄,打包成 `target/app/`,build 寫入 `bridge.json`(spec/bridge/v1)並把它與 `permissions.json` 的 sha256 編進 runtime。
|
|
47
47
|
|
|
48
|
+
`<sdk-version>` is a placeholder, not manifest syntax. `synopkgland init` copies compatible SDK pins from the locally installed templates. For a manual configuration, query `npm view @synopackageland/sdk version`, replace the placeholder with that exact release, and keep all App SDK declarations (including Go, Rust and frontend dependencies) aligned. Run `synopkgland check` with an up-to-date CLI before building.
|
|
49
|
+
|
|
48
50
|
```yaml
|
|
49
51
|
backend: {runtime: python, dir: app, entry: main.py, sdk: <sdk-version>}
|
|
50
52
|
backend: {runtime: node, dir: app, entry: main.mjs, sdk: <sdk-version>, node: {package: Node.js_v22}}
|
package/skills/reference/ctl.md
CHANGED
|
@@ -157,7 +157,7 @@ direction, including hidden routes. The only infrastructure exceptions are the
|
|
|
157
157
|
fixed describe and identity ceremony methods. SDK capability metadata comes from
|
|
158
158
|
the SDK's own hidden catalog and can be explicitly overridden in the App spec.
|
|
159
159
|
Never hand-edit generated operation descriptions or add them to a skill manually.
|
|
160
|
-
|
|
160
|
+
Use the SDK pins in the project generated by `synopkgland init`; query published releases with `npm view @synopackageland/sdk version`, `npm view @synopackageland/templates version` and `npm view @synopackageland/cli version`.
|
|
161
161
|
|
|
162
162
|
For installed Apps, use `ctl tools <app> --host <profile>` and
|
|
163
163
|
`ctl tool <app> <method> --input <file|-> --host <profile>`. These require the
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Upstream-authenticated paths
|
|
4
4
|
|
|
5
|
-
Build with
|
|
5
|
+
Build with matching SDK and CLI releases. Use `upstream_auth_paths` for client API
|
|
6
6
|
paths that use upstream authentication.
|
|
7
7
|
|
|
8
8
|
Keep browser routes behind `entry: admin-only` or `entry: app-privilege`; list
|
|
@@ -22,9 +22,11 @@ See `docs/app-entry.md` for the complete contract.
|
|
|
22
22
|
|
|
23
23
|
## External access
|
|
24
24
|
|
|
25
|
-
Use
|
|
25
|
+
Use an SDK with matching gateway sources. Add this to the existing
|
|
26
26
|
complete gateway declaration; keep the App's upstream, listener and auth policy:
|
|
27
27
|
|
|
28
|
+
`<sdk-version>` is a placeholder, not manifest syntax. `synopkgland init` copies compatible SDK pins from the locally installed templates. For a manual configuration, query `npm view @synopackageland/sdk version`, replace the placeholder with that exact release, and keep all App SDK declarations (including Go, Rust and frontend dependencies) aligned. Run `synopkgland check` with an up-to-date CLI before building.
|
|
29
|
+
|
|
28
30
|
```yaml
|
|
29
31
|
identity_gateway:
|
|
30
32
|
sdk: <sdk-version>
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# Native installation settings
|
|
2
2
|
|
|
3
|
-
Use
|
|
3
|
+
Use matching CLI, SDK/App and templates releases, preserving the pins generated by `synopkgland init`. Configure installation through the manifest and generated wizard; do not add App ACL writers, root hooks or independent port state.
|
|
4
|
+
|
|
5
|
+
`<sdk-version>` is a placeholder, not manifest syntax. `synopkgland init` copies compatible SDK pins from the locally installed templates. For a manual configuration, query `npm view @synopackageland/sdk version`, replace the placeholder with that exact release, and keep all App SDK declarations (including Go, Rust and frontend dependencies) aligned. Run `synopkgland check` with an up-to-date CLI before building.
|
|
4
6
|
|
|
5
7
|
```yaml
|
|
6
8
|
install:
|
|
@@ -139,9 +139,9 @@ by these settings.
|
|
|
139
139
|
|
|
140
140
|
Native daemon Apps may opt in with `daemon.nofile: 32768`. The value must be an
|
|
141
141
|
integer from 1024 to 1048576; omission keeps the legacy controller path. This
|
|
142
|
-
requires DSM 7.0-40761 or later and
|
|
143
|
-
|
|
144
|
-
|
|
142
|
+
requires DSM 7.0-40761 or later and an SDK with file descriptor budget support,
|
|
143
|
+
including any explicit Go App or gateway SDK pin. Check and build reject
|
|
144
|
+
unsupported pins; build also verifies matching controller sources.
|
|
145
145
|
|
|
146
146
|
The CLI generates only `conf/systemd/pkg-<package>-daemon.service`. DSM acquires
|
|
147
147
|
this fixed system unit directly; it needs no `systemd-user-unit` resource
|