Extends EventEmitter2

A Navy instance

Parameters

name

The name of the current Navy.

Type: string

normalisedName

The normalised name of the current Navy (name without whitespaces).

Type: string

getState

Returns the current State for this Navy.

Returns Promise<State?>

saveState

Saves a new State for this Navy.

Parameters

Returns Promise<void>

registerCommand

Registers a custom CLI command with the given name and callback function. Any command registered can be run using navy run [name].

Parameters

registerMiddleware

Registers a middleware reducer function. See Writing Plugins.

Parameters

isInitialised

Returns whether this Navy is initialised and ready to launch services.

Returns Promise<boolean>

initialise

Initialises this Navy with the given State.

Parameters

Returns Promise<void>

delete

Deletes the state for this Navy. It won't be possible to interact with this Navy after calling this function unless you re-initialise it.

Returns Promise<void>

launch

Launches the given services for this Navy.

Parameters

Returns Promise<void>

reconfigure

Relaunches (reconfigures) all of the services running in this Navy. This will pick up any changes to the compose configuration.

Parameters

Returns Promise<void>

destroy

Destroys all of the services in this Navy and deletes the state.

Returns Promise<void>

ps

Returns a list of launched services for this Navy.

Returns Promise<ServiceList>

start

Starts the given services.

Parameters

Returns Promise<void>

stop

Stops the given services.

Parameters

Returns Promise<void>

restart

Restarts the given services.

Parameters

Returns Promise<void>

kill

Forcefully stops the given services.

Parameters

Returns Promise<void>

rm

Removes the given services. Requires the services to be stopped first.

Parameters

Returns Promise<void>

update

Makes sure the images for the given services are up to date, and restarts any running services with new images.

Parameters

Returns Promise<void>

useTag

Locks down the given service to the given docker image tag.

Parameters

Returns Promise<void>

resetTag

Resets the version of the given service if useTag was used.

Parameters

Returns Promise<void>

waitForHealthy

Waits for the given services to be healthy. Resolves when all services are healthy.

Parameters

Returns Promise<boolean>

externalIP

Returns the external IP for accessing Docker and running services.

Returns Promise<string>

port

Returns the external port for the given service and internal private port.

Parameters

Returns Promise<number?>

url

Returns the URL for the given service which can be used to access it if it exposes a HTTP server.

Parameters

Returns Promise<string?>

getLaunchedServiceNames

Returns an array of the names of the launched services for this Navy.

Returns Promise<Array<string>>

getAvailableServiceNames

Returns an array of the names of all of the possible services for this Navy.

Returns Promise<Array<string>>

getNavy

Returns a Navy instance from the given Navy name.

Parameters

Returns Navy

getLaunchedNavies

Returns an array of Navy instances which are currently imported and launched.

Returns Promise<Array<Navy>>

getLaunchedNavyNames

Returns an array of names of Navies which are currently imported and launched.

Returns Promise<Array<string>>

State

A "state" object of the current services, and other internal Navy state. This can be used to hang "state" off services which can then be used by middleware at runtime to modify the runtime configuration.

Accessing internal properties on state (properties other than "services") is not supported and backwards compatibility is not guaranteed.

Type: {driver: string?, configProvider: string?, path: string?, npmPackage: string?, services: Object?}

Properties