Skip to content

Commit

Permalink
Merge branch 'feat/vite-ssr' of github.com:dac09/redwood into feat/vi…
Browse files Browse the repository at this point in the history
…te-ssr

* 'feat/vite-ssr' of github.com:dac09/redwood:
  chore(build): Avoid prebuilding api side, instead use an esbuild plugin (redwoodjs#7672)
  chore(deps): update dependency @clerk/clerk-react to v4.14.2 (redwoodjs#8016)
  chore(deps): update dependency @azure/msal-browser to v2.35.0 (redwoodjs#8009)
  chore(deps): update dependency @supabase/supabase-js to v2.14.0 (redwoodjs#8010)
  fix(deps): update typescript-eslint monorepo to v5.57.1 (redwoodjs#8008)
  fix(deps): update dependency core-js to v3.30.0 (redwoodjs#8007)
  chore(deps): update dependency @playwright/test to v1.32.2 (redwoodjs#8005)
  fix(deps): update dependency @fastify/static to v6.10.0 (redwoodjs#7999)
  chore(deps): update dependency dependency-cruiser to v12.11.1 (redwoodjs#7998)
  Update docs to reference creating an ED25519 key instead of RSA (redwoodjs#8013)
  chore(deps): update dependency @types/react to v18.0.33 (redwoodjs#7996)
  chore(deps): update dependency @replayio/playwright to v0.3.28 (redwoodjs#8006)
  chore(deps): update dependency esbuild to v0.17.15 (redwoodjs#7994)
  chore(deps): update mheap/github-action-required-labels action to v4 (redwoodjs#7997)
  chore(ci): Update node version for telemetry check (redwoodjs#8004)
  • Loading branch information
dac09 committed Apr 6, 2023
2 parents 5231615 + 78b5534 commit c2e6c8b
Show file tree
Hide file tree
Showing 60 changed files with 978 additions and 1,467 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
node-version: [16, 18]
node-version: [16.20.0, 18]
fail-fast: true
name: 🔭 Telemetry check / ${{ matrix.os }} / node ${{ matrix.node-version }} latest
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -360,7 +360,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
node-version: [16, 18]
node-version: [16.20.0, 18]
name: 🔭 Telemetry check / ${{ matrix.os }} / node ${{ matrix.node-version }} latest
runs-on: ${{ matrix.os }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/require-release-label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
name: 🏷 Require release label
runs-on: ubuntu-latest
steps:
- uses: mheap/github-action-required-labels@v3
- uses: mheap/github-action-required-labels@v4
with:
mode: exactly
count: 1
Expand Down
52 changes: 26 additions & 26 deletions docs/docs/intro-to-servers.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ You can have multiple public keys from multiple development machines on the serv

### Public/Private Keypairs

You may already have a public/private keypair! Check in `~/.ssh` and look for two files with the same name before the extension, one with `.pub` on the end (`id_rsa` and `id_rsa.pub`, for example). If you don't remember actually putting these files in the directory, then they were probably generated by a program like `ssh-keygen`, and SSH is already using them!
You may already have a public/private keypair! Check in `~/.ssh` and look for two files with the same name before the extension, one with `.pub` on the end (`id_ed25519` and `id_ed25519.pub`, for example). If you don't remember actually putting these files in the directory, then they were probably generated by a program like `ssh-keygen`, and SSH is already using them!

To see which of your keys SSH is already aware of, you can run this command to list them:

Expand All @@ -233,49 +233,49 @@ ssh-add -L
You should get zero or more lines containing public SSH keys, something like this:

```
ssh-rsa AAAAB3NzaC1yc2EAAAADAQAB<REDACTED>3Edk1OE6BU6hK2EZchm= rob@computer.local
ssh-ed25519 AAAAB3NzaC1yc2EAAAADAQAB<REDACTED>CU90x/khqD1sDW= rob@computer.local
```

If I compare that to the content of my `~/.ssh/id_rsa.pub` file I can see that they match! Great, so SSH is already using our public key when it tries to connect. But what if you don't have a public/private keypair?
If I compare that to the content of my `~/.ssh/id_ed25519.pub` file I can see that they match! Great, so SSH is already using our public key when it tries to connect. But what if you don't have a public/private keypair?

### Generating a Public/Private Keypair

There's a simple command to generate a new keypair:

```
ssh-keygen -t rsa -r 4096
ssh-keygen -t ed25519
```

This tells the program to generate a key using the RSA algorithm and to make it 4096 bytes long. There are [newer algorithms](https://goteleport.com/blog/comparing-ssh-keys/) available, but not all of them are supported everywhere. The linked article goes into depth into the various algorithms and their pros and cons.
This tells the program to generate a key using the ED25519 algorithm. There are [many algorithms](https://goteleport.com/blog/comparing-ssh-keys/) available, but not all of them are supported everywhere. The linked article goes into depth into the various algorithms and their pros and cons.

You will be prompted for a couple of questions:

```
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/rob/.ssh/id_rsa):
Generating public/private ed25519 key pair.
Enter file in which to save the key (/Users/rob/.ssh/id_ed25519):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
```

If you don't have any keys, go ahead and use the default name (`id_rsa`) by just hitting ENTER.
If you don't have any keys, go ahead and use the default name `id_ed25519` by just hitting ENTER.

A Passphrase is an additional line of security on your key. However, it also adds some inconvenience around using your public key: you'll need to enter the passpharse each time your private key is accessed. Which is great for security, but kind of defeats the purpose of sharing your public key with the server to make access easier. As long as you protect your private key, you shouldn't need to worry about adding a passphrase. Press ENTER (twice) to create your keypair without a passphrase.

```
Your identification has been saved in id_rsa
Your public key has been saved in id_rsa.pub
Your identification has been saved in id_ed25519
Your public key has been saved in id_ed25519.pub
The key fingerprint is:
SHA256:g9tcaULSzcMLEoRREugBXEFotYdCicFZ4beRZRcTeMw rob@trion.local
SHA256:6Qg7RQRGp1AtfVIOucEt1HtZWkYMU1LZYBVwBsXwTWQ rob@computer.local
The key's randomart image is:
+---[RSA 4096]----+
|*+OO**+o+=o |
|oB+ +.++.E. |
|.o = =o = = |
| o o o= . + |
| .. S = |
| + = |
| . o |
| |
+--[ED25519 256]--+
| .B&@O+ .E +==|
| o=*= .** . o .o|
| . o . . . .|
| .o o . o ..|
| o . A * + .|
| = + = + |
| o . * . |
| . o |
| |
+----[SHA256]-----+
```
Expand All @@ -286,7 +286,7 @@ From this [Super User answer](https://superuser.com/a/22541):

> Validation is normally done by a comparison of meaningless strings (i.e. the hexadecimal representation of the key fingerprint), which humans are pretty slow and inaccurate at comparing. Randomart replaces this with structured images that are faster and easier to compare.
I suppose the idea is that if humans ever needed to compare public keys they could use the randomart version and know pretty quickly whether they're the same (instead of comparing 4096 bytes by eye!)
I suppose the idea is that if humans ever needed to compare public keys they could use the randomart version and know pretty quickly whether they're the same (instead of comparing a bunch of random number and letters by eye!)

:::

Expand All @@ -301,7 +301,7 @@ ssh-add -L
Do you see your new public key listed? If not, we just have to let `ssh-agent` know where it is and to start using it (note that you give the path to the private key):

```
ssh-add ~/.ssh/id_rsa
ssh-add ~/.ssh/id_ed25519
```

Now running `ssh-add -L` should list our key.
Expand All @@ -311,7 +311,7 @@ Now running `ssh-add -L` should list our key.
I've had cases where my key was unknown to `ssh-agent` after a computer restart. I added the following to the `~/.zshrc` file on my computer (not the server) so that the key is added every time I start a new terminal session:

```
ssh-add ~/.ssh/id_rsa
ssh-add ~/.ssh/id_ed25519
```

:::
Expand All @@ -321,15 +321,15 @@ ssh-add ~/.ssh/id_rsa
So SSH is now presenting the key to the server, but the server doesn't know what to do with it. We'll now copy our *public* key to the server so that it allows connections from it. Write your public key to the terminal so that you can copy it:

```
cat ~/.ssh/id_rsa.pub
cat ~/.ssh/id_ed25519.pub
```

:::info

On MacOS you can copy the key into your clipboard with this two-part command:

```
cat ~/.ssh/id_rsa.pub | pbcopy
cat ~/.ssh/id_ed25519.pub | pbcopy
```

:::
Expand All @@ -344,7 +344,7 @@ Now just paste your key into this file on a new line. It helps to add a comment

```
# Rob Cameron (optimus-prime)
ssh-rsa AAAAB3NzaC1yc2EAAAADAQAB<REDACTED>3Edk1OE6BU6hK2EZchm= rob@computer.local
ssh-ed25519 AAAAB3NzaC1yc2EAAAADAQAB<REDACTED>CU90x/khqD1sDW= rob@computer.local
```

Save the file and exit. Now, disconnect from the SSH session with `exit` and reconnect, but this time you shouldn't need a password or private key (if you were using `-i` you can leave that off) and simply connect with:
Expand Down
52 changes: 26 additions & 26 deletions docs/versioned_docs/version-4.0/intro-to-servers.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ You can have multiple public keys from multiple development machines on the serv

### Public/Private Keypairs

You may already have a public/private keypair! Check in `~/.ssh` and look for two files with the same name before the extension, one with `.pub` on the end (`id_rsa` and `id_rsa.pub`, for example). If you don't remember actually putting these files in the directory, then they were probably generated by a program like `ssh-keygen`, and SSH is already using them!
You may already have a public/private keypair! Check in `~/.ssh` and look for two files with the same name before the extension, one with `.pub` on the end (`id_ed25519` and `id_ed25519.pub`, for example). If you don't remember actually putting these files in the directory, then they were probably generated by a program like `ssh-keygen`, and SSH is already using them!

To see which of your keys SSH is already aware of, you can run this command to list them:

Expand All @@ -233,49 +233,49 @@ ssh-add -L
You should get zero or more lines containing public SSH keys, something like this:

```
ssh-rsa AAAAB3NzaC1yc2EAAAADAQAB<REDACTED>3Edk1OE6BU6hK2EZchm= rob@computer.local
ssh-ed25519 AAAAB3NzaC1yc2EAAAADAQAB<REDACTED>CU90x/khqD1sDW= rob@computer.local
```

If I compare that to the content of my `~/.ssh/id_rsa.pub` file I can see that they match! Great, so SSH is already using our public key when it tries to connect. But what if you don't have a public/private keypair?
If I compare that to the content of my `~/.ssh/id_ed25519.pub` file I can see that they match! Great, so SSH is already using our public key when it tries to connect. But what if you don't have a public/private keypair?

### Generating a Public/Private Keypair

There's a simple command to generate a new keypair:

```
ssh-keygen -t rsa -r 4096
ssh-keygen -t ed25519
```

This tells the program to generate a key using the RSA algorithm and to make it 4096 bytes long. There are [newer algorithms](https://goteleport.com/blog/comparing-ssh-keys/) available, but not all of them are supported everywhere. The linked article goes into depth into the various algorithms and their pros and cons.
This tells the program to generate a key using the ED25519 algorithm. There are [many algorithms](https://goteleport.com/blog/comparing-ssh-keys/) available, but not all of them are supported everywhere. The linked article goes into depth into the various algorithms and their pros and cons.

You will be prompted for a couple of questions:

```
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/rob/.ssh/id_rsa):
Generating public/private ed25519 key pair.
Enter file in which to save the key (/Users/rob/.ssh/id_ed25519):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
```

If you don't have any keys, go ahead and use the default name (`id_rsa`) by just hitting ENTER.
If you don't have any keys, go ahead and use the default name `id_ed25519` by just hitting ENTER.

A Passphrase is an additional line of security on your key. However, it also adds some inconvenience around using your public key: you'll need to enter the passpharse each time your private key is accessed. Which is great for security, but kind of defeats the purpose of sharing your public key with the server to make access easier. As long as you protect your private key, you shouldn't need to worry about adding a passphrase. Press ENTER (twice) to create your keypair without a passphrase.

```
Your identification has been saved in id_rsa
Your public key has been saved in id_rsa.pub
Your identification has been saved in id_ed25519
Your public key has been saved in id_ed25519.pub
The key fingerprint is:
SHA256:g9tcaULSzcMLEoRREugBXEFotYdCicFZ4beRZRcTeMw rob@trion.local
SHA256:6Qg7RQRGp1AtfVIOucEt1HtZWkYMU1LZYBVwBsXwTWQ rob@computer.local
The key's randomart image is:
+---[RSA 4096]----+
|*+OO**+o+=o |
|oB+ +.++.E. |
|.o = =o = = |
| o o o= . + |
| .. S = |
| + = |
| . o |
| |
+--[ED25519 256]--+
| .B&@O+ .E +==|
| o=*= .** . o .o|
| . o . . . .|
| .o o . o ..|
| o . A * + .|
| = + = + |
| o . * . |
| . o |
| |
+----[SHA256]-----+
```
Expand All @@ -286,7 +286,7 @@ From this [Super User answer](https://superuser.com/a/22541):

> Validation is normally done by a comparison of meaningless strings (i.e. the hexadecimal representation of the key fingerprint), which humans are pretty slow and inaccurate at comparing. Randomart replaces this with structured images that are faster and easier to compare.
I suppose the idea is that if humans ever needed to compare public keys they could use the randomart version and know pretty quickly whether they're the same (instead of comparing 4096 bytes by eye!)
I suppose the idea is that if humans ever needed to compare public keys they could use the randomart version and know pretty quickly whether they're the same (instead of comparing a bunch of random number and letters by eye!)

:::

Expand All @@ -301,7 +301,7 @@ ssh-add -L
Do you see your new public key listed? If not, we just have to let `ssh-agent` know where it is and to start using it (note that you give the path to the private key):

```
ssh-add ~/.ssh/id_rsa
ssh-add ~/.ssh/id_ed25519
```

Now running `ssh-add -L` should list our key.
Expand All @@ -311,7 +311,7 @@ Now running `ssh-add -L` should list our key.
I've had cases where my key was unknown to `ssh-agent` after a computer restart. I added the following to the `~/.zshrc` file on my computer (not the server) so that the key is added every time I start a new terminal session:

```
ssh-add ~/.ssh/id_rsa
ssh-add ~/.ssh/id_ed25519
```

:::
Expand All @@ -321,15 +321,15 @@ ssh-add ~/.ssh/id_rsa
So SSH is now presenting the key to the server, but the server doesn't know what to do with it. We'll now copy our *public* key to the server so that it allows connections from it. Write your public key to the terminal so that you can copy it:

```
cat ~/.ssh/id_rsa.pub
cat ~/.ssh/id_ed25519.pub
```

:::info

On MacOS you can copy the key into your clipboard with this two-part command:

```
cat ~/.ssh/id_rsa.pub | pbcopy
cat ~/.ssh/id_ed25519.pub | pbcopy
```

:::
Expand All @@ -344,7 +344,7 @@ Now just paste your key into this file on a new line. It helps to add a comment

```
# Rob Cameron (optimus-prime)
ssh-rsa AAAAB3NzaC1yc2EAAAADAQAB<REDACTED>3Edk1OE6BU6hK2EZchm= rob@computer.local
ssh-ed25519 AAAAB3NzaC1yc2EAAAADAQAB<REDACTED>CU90x/khqD1sDW= rob@computer.local
```

Save the file and exit. Now, disconnect from the SSH session with `exit` and reconnect, but this time you shouldn't need a password or private key (if you were using `-i` you can leave that off) and simply connect with:
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
"@faker-js/faker": "7.6.0",
"@npmcli/arborist": "6.2.6",
"@nrwl/nx-cloud": "15.3.5",
"@playwright/test": "1.32.1",
"@replayio/playwright": "0.3.27",
"@playwright/test": "1.32.2",
"@replayio/playwright": "0.3.28",
"@testing-library/jest-dom": "5.16.5",
"@testing-library/react": "14.0.0",
"@testing-library/user-event": "14.4.3",
Expand All @@ -68,7 +68,7 @@
"babel-plugin-auto-import": "1.1.0",
"babel-plugin-remove-code": "0.0.6",
"boxen": "5.1.2",
"core-js": "3.29.1",
"core-js": "3.30.0",
"cypress": "12.9.0",
"cypress-wait-until": "1.7.2",
"eslint": "8.37.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/api-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@
"@babel/plugin-transform-runtime": "7.21.0",
"@babel/runtime-corejs3": "7.21.0",
"@fastify/http-proxy": "9.0.0",
"@fastify/static": "6.9.0",
"@fastify/static": "6.10.0",
"@fastify/url-data": "5.3.1",
"ansi-colors": "4.1.3",
"chalk": "4.1.2",
"chokidar": "3.5.3",
"core-js": "3.29.1",
"core-js": "3.30.0",
"fast-json-parse": "1.0.3",
"fastify": "4.15.0",
"fastify-raw-body": "4.2.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/api-server/src/watch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ const validate = async () => {
}
}

const rebuildApiServer = () => {
const rebuildApiServer = async () => {
try {
// Shutdown API server
killApiServer()

const buildTs = Date.now()
process.stdout.write(c.dim(c.italic('Building... ')))
buildApi()
await buildApi()
console.log(c.dim(c.italic('Took ' + (Date.now() - buildTs) + ' ms')))

const forkOpts = {
Expand Down
2 changes: 1 addition & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"@babel/runtime-corejs3": "7.21.0",
"@prisma/client": "4.12.0",
"@whatwg-node/fetch": "0.8.4",
"core-js": "3.29.1",
"core-js": "3.30.0",
"humanize-string": "2.1.0",
"jsonwebtoken": "9.0.0",
"pascalcase": "1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-providers/auth0/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
},
"dependencies": {
"@babel/runtime-corejs3": "7.21.0",
"core-js": "3.29.1",
"core-js": "3.30.0",
"jsonwebtoken": "9.0.0",
"jwks-rsa": "3.0.1"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-providers/auth0/setup/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"dependencies": {
"@babel/runtime-corejs3": "7.21.0",
"@redwoodjs/cli-helpers": "0.0.0-experimental-streaming.4",
"core-js": "3.29.1"
"core-js": "3.30.0"
},
"devDependencies": {
"@babel/cli": "7.21.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/auth-providers/auth0/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
"dependencies": {
"@babel/runtime-corejs3": "7.21.0",
"@redwoodjs/auth": "0.0.0-experimental-streaming.4",
"core-js": "3.29.1"
"core-js": "3.30.0"
},
"devDependencies": {
"@auth0/auth0-spa-js": "2.0.4",
"@babel/cli": "7.21.0",
"@babel/core": "7.21.3",
"@types/react": "18.0.31",
"@types/react": "18.0.33",
"jest": "29.5.0",
"react": "18.2.0",
"typescript": "5.0.3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
},
"dependencies": {
"@babel/runtime-corejs3": "7.21.0",
"core-js": "3.29.1",
"core-js": "3.30.0",
"jsonwebtoken": "9.0.0",
"jwks-rsa": "3.0.1"
},
Expand Down
Loading

0 comments on commit c2e6c8b

Please sign in to comment.