Skip to content

Commit

Permalink
Remove rfcs contents and add redirect notice (#116)
Browse files Browse the repository at this point in the history
Co-authored-by: Tim Hitchener <[email protected]>
  • Loading branch information
arjun024 and thitch97 authored Jul 6, 2021
1 parent c04a6ea commit e1555fd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 169 deletions.
23 changes: 0 additions & 23 deletions rfcs/0000-template.md

This file was deleted.

39 changes: 2 additions & 37 deletions rfcs/0001-start-command.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,2 @@
# Writing a Yarn Start Command

## Proposal

As part of the re-architecture of the Node.js metabuildpack outlined
[here](https://github.com/paketo-buildpacks/nodejs/blob/main/rfcs/0001-buildpacks-architecture.md),
there is need for a `yarn-start` buildpack with the single responsibility of
setting a start command which uses `tini` and `yarn`.


## Motivation

Moving toward this single-responsibility architecture has a few advantages:

* It enables greater modularity within the Node.js language family.

* It sets the foundation for interoperability between buildpacks across
language families.

* Using `tini` allows for more optimal process management within the container.

`tini` is a process manager for containers which manages zombie processes and
performs signal forwarding. Using an app start command with `tini` ensures
that containers may be stopped gracefully once started.

## Integration

The buildpack will provide no dependencies and will require `node`, `tini`,
`yarn` and `node_modules` during the launch phase.

## Implementation (Optional)

Detection will pass once a `yarn.lock` file is present in the app's source
code, assuming all other buildplan requirements have been met.

If detection is passed, the buildpack will set a start command using `tini` and
`yarn`. An example of a start command could be: `tini -g -- yarn start`.
This page has moved. The new location is:
https://github.com/paketo-buildpacks/rfcs/blob/main/text/nodejs/0010-yarn-start-command.md
111 changes: 2 additions & 109 deletions rfcs/0002-reimplement-start-command.md
Original file line number Diff line number Diff line change
@@ -1,109 +1,2 @@
# Reimplement Yarn Start Command

## Proposal

The buildpack will no longer call `yarn start` directly, but instead will
reimplement the behavior of `yarn start` directly.

## Motivation

We've seen flakey issues with process signal handling once we implemented [RFC
0001](0001-start-command.md). Specifically, on some container managers, it
appears that `tini` is not waiting for the entire process group to exit before
exiting itself. This means that our tests that make assertions that log lines
appear in the output during process shutdown are unreliable.

Furthermore, the maintainers of the `yarn` CLI have [openly
stated](https://github.com/yarnpkg/yarn/issues/4667#issuecomment-628241114)
that this issue is considered resolved if you upgrade to `yarn` v2, which the
buildpack has not. There is currently no backport of this functionality to v1
and may never be.

Given all of this, it seems to make more sense now to just take on the cost of
reimplementing the behavior of `yarn start` and removing the complexity of
using `yarn` and `tini` together.

## Implementation

The buildpack will still require `node` and `node_modules` during the `launch`
phase, but will no longer need to require `yarn` or `tini`.

Detection will continue to pass once a `yarn.lock` file is present in the app's
source code, assuming all other buildplan requirements have been met.

If detection is passed, the buildpack will set a start command, optionally also
running the prestart and poststart commands using using the contents of the
`package.json` as follows:

* If `package.json` contains `scripts.start`, `scripts.prestart`, and
`scripts.poststart` fields, the start command will be `<prestart command> &&
<start command> && <poststart command>`. For example, given the following
`package.json`,

```json
{
"scripts": {
"poststart": "echo 'Done starting'",
"prestart": "echo 'Starting'",
"start": "node index.js"
}
}
```

The start command will be `echo 'Starting' && node index.js && echo 'Done starting'`.

* If `package.json` contains `scripts.start` and `scripts.prestart` fields, but
does not contain a `scripts.poststart` field, the start command will be
`<prestart command> && <start command>`. For example, given the following
`package.json`,

```json
{
"scripts": {
"prestart": "echo 'Starting'",
"start": "node index.js"
}
}
```

The start command will be `echo 'Starting' && node index.js`.

* If `package.json` contains `scripts.start` and `scripts.poststart` fields,
but does not contain a `scripts.prestart` field, the start command will be
`<start command> && <poststart command>`. For example, given the following
`package.json`,

```json
{
"scripts": {
"poststart": "echo 'Done starting'",
"start": "node index.js"
}
}
```

The start command will be `node index.js && echo 'Done starting'`.

* If `package.json` contains a `scripts.start`, but does not contain either a
`scripts.prestart` or `scripts.poststart` field, the start command will be
`<start command>`. For example, given the following `package.json`,

```json
{
"scripts": {
"start": "node index.js"
}
}
```

The start command will be `node index.js`.

* If `package.json` does not contain `scripts.start`, `scripts.prestart`, or
`scripts.poststart` fields, the start command will be `node server.js`. For
example, given the following `package.json`,

```json
{}
```

The start command will be `node server.js`.
This page has moved. The new location is:
https://github.com/paketo-buildpacks/rfcs/blob/main/text/nodejs/0012-reimplement-yarn-start-command.md

0 comments on commit e1555fd

Please sign in to comment.