mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 12:11:56 +00:00
Copy changes for 040 release (#2874)
* update 040 changelog * remove post_up from 036-alpha6 * backend copy updates * beta.4 * beta.5 * fix spelling --------- Co-authored-by: Aiden McClelland <me@drbonez.dev>
This commit is contained in:
@@ -25,18 +25,11 @@ export class CommandController<Manifest extends T.SDKManifest> extends Drop {
|
||||
static of<Manifest extends T.SDKManifest>() {
|
||||
return async (
|
||||
effects: T.Effects,
|
||||
subcontainer:
|
||||
| {
|
||||
imageId: keyof Manifest["images"] & T.ImageId
|
||||
sharedRun?: boolean
|
||||
}
|
||||
| SubContainer<Manifest>,
|
||||
subcontainer: SubContainer<Manifest>,
|
||||
command: T.CommandType,
|
||||
options: {
|
||||
subcontainerName?: string
|
||||
// Defaults to the DEFAULT_SIGTERM_TIMEOUT = 30_000ms
|
||||
sigtermTimeout?: number
|
||||
mounts: Mounts<Manifest> | null
|
||||
runAsInit?: boolean
|
||||
env?:
|
||||
| {
|
||||
@@ -60,26 +53,15 @@ export class CommandController<Manifest extends T.SDKManifest> extends Drop {
|
||||
commands = imageMeta.entrypoint ?? []
|
||||
commands.concat(...(command.overridCmd ?? imageMeta.cmd ?? []))
|
||||
} else commands = splitCommand(command)
|
||||
const subc =
|
||||
subcontainer instanceof SubContainer
|
||||
? subcontainer
|
||||
: await SubContainer.of(
|
||||
effects,
|
||||
subcontainer,
|
||||
null,
|
||||
options?.subcontainerName || commands.join(" "),
|
||||
)
|
||||
|
||||
try {
|
||||
if (options.mounts) await subc.mount(options.mounts)
|
||||
|
||||
let childProcess: cp.ChildProcess
|
||||
if (options.runAsInit) {
|
||||
childProcess = await subc.launch(commands, {
|
||||
childProcess = await subcontainer.launch(commands, {
|
||||
env: options.env,
|
||||
})
|
||||
} else {
|
||||
childProcess = await subc.spawn(commands, {
|
||||
childProcess = await subcontainer.spawn(commands, {
|
||||
env: options.env,
|
||||
stdio: options.onStdout || options.onStderr ? "pipe" : "inherit",
|
||||
})
|
||||
@@ -116,12 +98,12 @@ export class CommandController<Manifest extends T.SDKManifest> extends Drop {
|
||||
return new CommandController(
|
||||
answer,
|
||||
state,
|
||||
subc,
|
||||
subcontainer,
|
||||
childProcess,
|
||||
options.sigtermTimeout,
|
||||
)
|
||||
} catch (e) {
|
||||
await subc.destroy()
|
||||
await subcontainer.destroy()
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,16 +23,9 @@ export class Daemon<Manifest extends T.SDKManifest> {
|
||||
static of<Manifest extends T.SDKManifest>() {
|
||||
return async <A extends string>(
|
||||
effects: T.Effects,
|
||||
subcontainer:
|
||||
| {
|
||||
imageId: keyof Manifest["images"] & T.ImageId
|
||||
sharedRun?: boolean
|
||||
}
|
||||
| SubContainer<Manifest>,
|
||||
subcontainer: SubContainer<Manifest>,
|
||||
command: T.CommandType,
|
||||
options: {
|
||||
subcontainerName?: string
|
||||
mounts: Mounts<Manifest> | null
|
||||
env?:
|
||||
| {
|
||||
[variable: string]: string
|
||||
|
||||
@@ -57,19 +57,7 @@ type DaemonsParams<
|
||||
/** The command line command to start the daemon */
|
||||
command: T.CommandType
|
||||
/** Information about the subcontainer in which the daemon runs */
|
||||
subcontainer:
|
||||
| {
|
||||
/** The ID of the image. Must be one of the image IDs declared in the manifest */
|
||||
imageId: keyof Manifest["images"] & T.ImageId
|
||||
/**
|
||||
* Whether or not to share the `/run` directory with the parent container.
|
||||
* This is useful if you are trying to connect to a service that exposes a unix domain socket or auth cookie via the `/run` directory
|
||||
*/
|
||||
sharedRun?: boolean
|
||||
}
|
||||
| SubContainer<Manifest>
|
||||
/** For mounting the necessary volumes. Syntax: sdk.Mounts.of().addVolume() */
|
||||
mounts: Mounts<Manifest>
|
||||
subcontainer: SubContainer<Manifest>
|
||||
env?: Record<string, string>
|
||||
ready: Ready
|
||||
/** An array of IDs of prior daemons whose successful initializations are required before this daemon will initialize */
|
||||
@@ -164,7 +152,6 @@ export class Daemons<Manifest extends T.SDKManifest, Ids extends string>
|
||||
options.command,
|
||||
{
|
||||
...options,
|
||||
subcontainerName: id,
|
||||
},
|
||||
)
|
||||
const healthDaemon = new HealthDaemon(
|
||||
|
||||
Reference in New Issue
Block a user