Skip to content

Commit 23a030d

Browse files
committed
docs: update docs, add sops
Closes #139 Signed-off-by: flakey5 <[email protected]>
1 parent 95e02b5 commit 23a030d

File tree

12 files changed

+265
-38
lines changed

12 files changed

+265
-38
lines changed

CONTRIBUTING.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,9 @@ The steps below will give you a general idea of how to prepare your local enviro
108108
npm run test:e2e
109109
```
110110
111-
10. Once you're happy with your changes, add and commit them to your branch, then push the branch to your fork.
111+
10. To run the worker locally, see [Dev Setup](./docs/dev-setup.md).
112+
113+
11. Once you're happy with your changes, add and commit them to your branch, then push the branch to your fork.
112114

113115
```bash
114116
git add .
@@ -119,7 +121,7 @@ The steps below will give you a general idea of how to prepare your local enviro
119121
> [!IMPORTANT]\
120122
> Before committing and opening a Pull Request, please go first through our [Commit](#commit-guidelines) and [Pull Request](#pull-request-policy) guidelines outlined below.
121123

122-
11. Create a Pull Request.
124+
12. Create a Pull Request.
123125

124126
### CLI Commands
125127

docs/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Documentation
2+
3+
Documentation for the Release Worker.

docs/architecture.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Architecture
2+
3+
Documentation on the architecture of the worker (i.e. how it works, how it fits
4+
into Node.js' infrastructure, etc.).
5+
6+
## Network Request Flow
7+
8+
How a request flows through Node.js' infrastructure as a whole
9+
10+
## Worker Request Flow
11+
12+
How the Release Worker routes requests
13+

docs/debugging.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Debugging
2+
3+
Steps to aid with debugging the Release Worker's production environment.
4+
5+
## Steps
6+
7+
- Check [Sentry](https://nodejs-org.sentry.io/issues/?project=4506191181774848). All errors should be reported here.
8+
9+
- If a local reproduction is found, Cloudflare has an implementation of [Chrome's DevTools](https://developers.cloudflare.com/workers/observability/dev-tools/).
10+
11+
- Cloudflare provides basic stats on the worker's Cloudflare dash page [here](https://dash.cloudflare.com/07be8d2fbc940503ca1be344714cb0d1/workers/services/view/dist-worker/production).

docs/deploy.md

Lines changed: 0 additions & 19 deletions
This file was deleted.

docs/deploying.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Deploying the Worker
2+
3+
Guide on how to deploy the Release Worker.
4+
5+
## Staging Deployments
6+
7+
The Release Worker is automatically deployed to its staging environment when a
8+
new commit is pushed to the `main` branch through the [Deploy Worker](https://github.com/nodejs/release-cloudflare-worker/actions/workflows/deploy.yml) action.
9+
10+
## Production Deployments
11+
12+
The Release Worker is deployed to its production environment by a Collaborator
13+
manually running the [Deploy Worker](https://github.com/nodejs/release-cloudflare-worker/actions/workflows/deploy.yml) action.

docs/dev-setup.md

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,43 @@
11
# Dev Setup
22

3-
Guide to setting up this worker for development.
3+
Documentation on how to run the Release Worker locally.
44

5-
## Have Node Installed
5+
## Steps
66

7-
Node needs to be installed for the thing that serves Node downloads (latest LTS/even numbered major recommended)
7+
### 1. Prepare environment
88

9-
## Install Dependencies
9+
Read and follow the [Getting Started](../CONTRIBUTING.md) guide to get your
10+
local environment setup.
1011

11-
Run `npm install`
12+
### 2. Setup your Cloudflare account
1213

13-
## Testing
14+
Currently we run the worker in [remote mode](https://developers.cloudflare.com/workers/testing/local-development/#develop-using-remote-resources-and-bindings) as there isn't a nice way to
15+
locally populate an R2 bucket. This means that, to run the Release Worker
16+
locally, you must have a Cloudflare account that has an R2 bucket named
17+
`dist-prod`. You will also need to populate the bucket yourself.
1418

15-
To run unit tests, `npm run test:unit`. To run e2e (end-to-end) tests, `npm run test:e2e`.
19+
Both of these will hopefully change in the future to make running the Release
20+
Worker easier.
1621

17-
See the [/test](../tests/) folder for more info on testing.
22+
### 3. Create secrets for directory listings
1823

19-
## Running Locally
24+
This step is optional but recommended.
2025

21-
Spin up a Workerd instance on your machine that serves this worker
26+
The Release Worker uses R2's S3 API for directory listings. In order for
27+
directory listings to work, you need to make an R2 API key for your `dist-prod`
28+
bucket and provide it to the worker.
2229

23-
### Login to Cloudflare Dash From Wrangler CLI
30+
Generating the API key can be done through the Cloudflare dashboard
31+
[here](https://dash.cloudflare.com/?account=/r2/api-tokens).
2432

25-
Run `wrangler login`
33+
Then, make a `.dev.vars` file in the root of this repository with the following:
2634

27-
### R2 Bucket
35+
```
36+
S3_ACCESS_KEY_ID=<your access key id>
37+
S3_ACCESS_KEY_SECRET=<your access key secret>
38+
```
2839

29-
Create a R2 bucket named `dist-prod`. This is the bucket that the worker read from. It will either need to have a copy of Node's dist folder in it or something mimicing the folder there.
40+
### 4. Run the worker
3041

31-
### Starting the Local Server
32-
33-
Run `npm start`. This starts a Workerd instance in remote mode.
42+
Start the worker locally with `npm start`. You may be prompted to log into
43+
your Cloudflare account.

docs/r2.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# R2
2+
3+
## What is it?
4+
5+
[R2](https://developers.cloudflare.com/r2/) is Cloudflare's blog storage
6+
provider.
7+
8+
## Noteworthy points
9+
10+
### Directories
11+
12+
R2 stores files flatly, meaning a directory does not exist in R2.
13+
14+
However, R2 allows characters such as slashes (/) in an object's name.
15+
For directories we can then specify a prefix (like `nodejs/release/`) and R2
16+
will only return objects that has a name that starts with that prefix.
17+
18+
## How are we using it?
19+
20+
R2 holds the entire contents of the release assets served by the worker.
21+
22+
### Bindings API
23+
24+
R2 allows integration with Workers through their [bindings API](https://developers.cloudflare.com/r2/api/workers/workers-api-usage/). We use this when fetching files.
25+
26+
### S3 API
27+
28+
Due to some performance issues we were seeing with R2's `list` binding command,
29+
we opted to use R2's S3 API for listing directories.
30+
31+
### Buckets
32+
33+
We have two R2 buckets:
34+
35+
- `dist-staging` - Holds staged releases. This bucket is private and should not
36+
be publicly accessible.
37+
38+
- `dist-prod` - Holds released versions of Node.js. Everything in this bucket
39+
should be considered publicly accessible.
40+
41+
(see [Release Process](./release-process.md) for more information on how we use
42+
these buckets)

docs/release-process.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Release Process
2+
3+
Documentation on the general order of events that happen when releasing a new
4+
version of Node.js
5+
6+
> [!NOTE]
7+
> This focuses on the flow of release assets (binaries, doc files). This may
8+
> not include the full process for releases (i.e. getting necessary approvals).
9+
10+
## Release types
11+
12+
### Mainline releases
13+
14+
Mainline releases refer to the main release branch of Node.js
15+
16+
### Nightly releases
17+
18+
Node.js has multiple release branches that are promoted nightly.
19+
20+
- `nightly` - Nightly builds from the `main` Node.js branch
21+
- `v8-canary` - Builds with the latest V8 canary
22+
- `rc` - Release candidates
23+
- `test` - Test builds
24+
25+
<details>
26+
<summary><b>Deprecated release branches</b></summary>
27+
28+
These branches no longer receive new releases.
29+
30+
- `chakracore-nightly` - Chakracore nightly builds
31+
- `chakracore-rc` - Chakracore release candidates
32+
- `chakracore-release` - Chakracore releases
33+
34+
</details>
35+
36+
## Release flow
37+
38+
### 1. Release CI is triggered
39+
40+
New builds are scheduled on the release CI (https://ci-release.nodejs.org).
41+
These builds compile Node.js on the various platforms and compile the docs.
42+
43+
Upon a build completing successfully, the build's output (binaries, doc files)
44+
will then be uploaded to the origin server and the `dist-staging` bucket in
45+
Node.js' Cloudflare account.
46+
47+
The release assets synced to the origin server are under
48+
`/home/staging/nodejs/` path. The release assets synced to the
49+
`dist-staging` bucket are under the `/nodejs/` [_prefix_](./r2.md#directories).
50+
51+
### 2. Release promotion
52+
53+
When a release is ready to be released, it is promoted. For mainline releases,
54+
this is done by the releaser running the [`release.sh`](https://github.com/nodejs/node/tree/main/tools/release.sh)
55+
script in the Node.js repository. For nightly releases, this is done once a day.
56+
57+
On the origin server, the release's assets are copied from
58+
`/home/staging/nodejs/` to `/home/dist/nodejs/`.
59+
60+
For R2, the release's assets are copied from the `dist-staging` bucket to the
61+
`dist-prod` bucket.

docs/sops/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Standard Operating Procedures
2+
3+
Documents detailing standardized processes for the Release Worker.

0 commit comments

Comments
 (0)