Skip to content

Commit

Permalink
Add more content related to process types (#737)
Browse files Browse the repository at this point in the history
Signed-off-by: Hanan Younes <hanan.algazaley@gmail.com>
  • Loading branch information
hyounes4560 committed Jun 25, 2024
1 parent 9fd960c commit c83bed6
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,39 @@ One of the benefits of buildpacks is that they are multi-process - an image can

<!--more-->

A `process type` is a named process definition, contributed by a buildpack at build-time and executed by the launcher at run-time.
Buildpacks declare process types during the build phase by writing entries into `<layers>/launch.toml`.

## Key Points

For each process, the buildpack:

* MUST specify a `type`, an identifier for the process, which:
* MUST NOT be identical to other process types provided by the same buildpack.
* MUST only contain numbers, letters, and the characters `.`, `_`, and `-`.
* MUST specify a `command` list such that:
* The first element of `command` is a path to an executable or the file name of an executable in `$PATH`.
* Any remaining elements of `command` are arguments that are always passed directly to the executable [^command-args].
* MAY specify an `args` list to be passed directly to the specified executable, after arguments specified in `command`.
* The `args` list is a default list of arguments that may be overridden by the user [^command-args].
* MAY specify a `default` boolean that indicates that the process type should be selected as the [buildpack-provided default](https://github.com/buildpacks/spec/blob/main/platform.md#outputs-4) during the export phase.
* MAY specify a `working-dir` for the process. The `working-dir` defaults to the application directory if not specified.

## Implementation Steps

Processes are added to the `launch.toml` file in the `<layers>/<layer>` directory as follows:

```toml
[[processes]]
type = "<process type>"
command = ["<command>"]
args = ["<arguments>"]
default = false
working-dir = "<working directory>"
```

### Examples

Let's see how this works. We will specify a process type that allows a debugger to attach to our application.

To enable running the debug process, we'll need to have our buildpack define a "process type" for the worker.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The [buildpacks `exec.d` interface](https://github.com/buildpacks/spec/blob/main

2. Script Behavior:
* **Inputs**
*A third open file descriptor. File descriptors are integers used by a process to uniquely identify opened files; pre-opened file descriptors are usually 0 for stdin, 1 for stdout and 2 for stderr. The third open file descriptor is inherited from the calling process.
* A third open file descriptor. File descriptors are integers used by a process to uniquely identify opened files; pre-opened file descriptors are usually `0` for `stdin`, `1` for `stdout` and `2` for `stderr`. The third open file descriptor is inherited from the calling process.
* **Outputs**
* Valid TOML describing environment variables in the form of key=value pairs. These variables are added to the application's runtime environment. The content should be written to file descriptor 3 (see examples for how to do this).
* Exit Code: The scripts should exit with a status code of `0` to indicate success. A non-zero exit code will indicate an error and prevent the application from launching.
Expand Down

0 comments on commit c83bed6

Please sign in to comment.