These modules have no .capt source. The compiler holds their declarations
and adds them when a module imports them with use. Importing any other
unknown path is an error (CAP-RESOLVE-003).
| Module | use brings |
Where it is documented |
|---|---|---|
Std::Text |
the procedure split text:on: |
JSON and number text |
Std::Json |
the module value Json |
JSON and number text |
Std::EcmaNumber |
the module value EcmaNumber |
JSON and number text |
Host::Debian |
effects on SshHost |
below |
Provider::Aws |
provider frontiers, types and effects | below |
Platform::Gump |
the module value Gump |
below |
Net, Package, Service |
nothing | below |
Bosun::Tasks |
Bosun's task steps: run named:program:args:, cargoTest named:args:, requireTool named:, checkArtifact, inspectCrate, publishCrate, projectPath of: |
Part 8 |
Forge::Tasks |
Forge's build tasks over opaque handles that only the Forge host can create | Part 8 |
Mate::Machine |
Mate's verb-noun machine commands (show, start, stop, restart, create, delete, edit, set, fetch) |
Part 8 |
The last three belong to the tools that run Captain programs, and their
effects are implemented by those tools' hosts, not by captain run.
Declaration surfaces
Host::Debian, Provider::Aws and Platform::Gump describe operations that
the language is designed to express: configuring a Debian host, creating
cloud resources, forming a Gump cluster. The source of the prelude calls them
"aspirational": they are exactly the declarations the conformance programs in
the repository's corpus/ directory exercise, no more. Programs that use
them check, and their effects appear in captain inspect and captain plan,
which makes them useful for showing what a plan of such an operation looks
like. The command-line runtime does not implement them:
- a
Host::Debianeffect fails at run time with "a declaration without a definition", because the SSH transport carries onlyexec,shellandinstallFileText; - a
Provider::Awseffect fails the same way: nothing incaptain runimplements theAwsAccountfrontier; Platform::Gump's members check, but a procedure that uses them does not build (CAP-BUILD-001, "not compilable in a v0.1 code unit").
For real work on a Debian host today, use exec inside an SSH block or the
Tool:: modules (System and tool modules).
Host::Debian
Every effect is homed on SshHost, so it is called inside
on host: server using: #Ssh do: [ ... ].
| Effect | Gives |
|---|---|
download url: Url sha256: Digest |
Artifact |
unpack artifact: Artifact into: Path atomically: bool |
nothing |
copy from: Path to: Path [owner: Text] [mode: FileMode] |
nothing |
service name: Text ensure: Symbol |
nothing |
package install: List[Text] |
nothing |
package remove: List[Text] |
nothing |
packageRepository add: RepositoryRef |
nothing |
Provider::Aws
use Provider::Aws. brings the value Aws (a ProviderRef), the frontiers
AwsAccount, AwsFleet and AwsStorage, the opaque types Network,
DatabaseNode (dataVolume: VolumeRef, publicAddress: Address),
ProviderNode, VolumeRef and Snapshot, and the receipt subjects Drain,
Fence and Termination. Its effects are homed on AwsAccount:
| Effect | Gives |
|---|---|
createNetwork region: Symbol cidr: Cidr |
Network |
createServer network: Network architecture: Symbol memoryAtLeast: Bytes |
Server |
provision node:, quiesce node:, resume node:, start node: (a DatabaseNode) |
nothing |
verify health: DatabaseNode |
nothing |
snapshot volume: VolumeRef |
Snapshot |
restore snapshot: Snapshot to: VolumeRef |
nothing |
attach volume: VolumeRef exclusivelyTo: DatabaseNode |
nothing |
preserve volume: VolumeRef |
nothing |
fence node: DatabaseNode |
Receipt[Fence] |
move address: Address to: DatabaseNode fencedBy: Receipt[Fence] |
nothing |
retire node: DatabaseNode fencedBy: Receipt[Fence] |
nothing |
fence node: and the two effects that demand its receipt show how receipts
make an order of operations checkable: retire cannot be called without
evidence that the node was fenced.
Secrets, receipts and grants
explains receipts.
Platform::Gump
| Written | Gives |
|---|---|
(Gump signedRepository) |
RepositoryRef, for packageRepository add: |
Gump initializeOn: Server recoverySecret: Secret |
GumpForest |
forest deployCapsule: Path providerCredential: Secret |
nothing |
The Gump:: source modules
(Worker, app and Gump modules)
are the working path for Gump today.
Net, Package and Service
These three paths exist so that use Net., use Package. and
use Service. resolve; they add no names.
Example
captain plan renders what an operation would do without doing any of it.
Here it shows a Host::Debian operation as two steps on the SSH host, each
waiting for the host binding:
module Example::Debian.
use Host::Debian.
export prepare at: Address -> Text [
server := observe serverAt: at.
on host: server using: #Ssh do: [
package install: #( "ca-certificates", "curl" ).
service name: "ssh" ensure: #Running.
].
ret "prepared".
].$ captain build debian.capt -o debian.capb
built debian.capb ([..] bytes, sha256 [..])
$ captain plan debian.capb prepare at=203.0.113.10
captain plan v1
program sha256 [..]
entry `prepare at:`
at: "203.0.113.10"#address
args sha256 [..]
node 1: `observe serverAt:` on LocalMachine
serverAt: "203.0.113.10"#address
bounds: no timeout declared
node 2: `package install:` on SshHost host «result of node 1»
install: #( "ca-certificates", "curl" )
after: node 1
bounds: no timeout declared
node 3: `service name:ensure:` on SshHost host «result of node 1»
name: "ssh"
ensure: #Running
after: node 1
bounds: no timeout declared
...