Skip to content

Commit

Permalink
Merge branch 'main' into jgmw-cli/plugin-support
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-Walker-GM authored May 19, 2023
2 parents c125518 + 553a06f commit 80a7d4c
Show file tree
Hide file tree
Showing 110 changed files with 2,297 additions and 1,976 deletions.
6 changes: 3 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const path = require('path')

const findUp = require('findup-sync')
const { findUp } = require('@redwoodjs/project-config')

// Framework Babel config is monorepo root ./babel.config.js
// `yarn lint` runs for each workspace, which needs findup for path to root
// `yarn lint` runs for each workspace, which needs findUp for path to root
const findBabelConfig = (cwd = process.cwd()) => {
const configPath = findUp('babel.config.js', { cwd })
const configPath = findUp('babel.config.js', cwd)
if (!configPath) {
throw new Error(`Eslint-parser could not find a "babel.config.js" file`)
}
Expand Down
40 changes: 40 additions & 0 deletions docs/docs/deploy/coherence.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
description: Serverful deploys on GCP or AWS via Coherence's full-lifecycle environment automation
---

# Deploy to Coherence

[Coherence](https://www.withcoherence.com/) delivers automated environments across the full software development lifecycle, without requiring you to glue together your own mess of open source tools to get a world-class develper experience for your team. Coherence is focused on serving startups, who are doing mission-critical work. With one simple configuration, Coherence offers:

- Cloud-hosted development environments, based on VSCode. Similar to Gitpod or GitHub CodeSpaces
- Production-ready CI/CD running in your own GCP/AWS account, including: database migration/seeding/snapshot loading, parallelized tests, container building and docker registry management
- Full-stack branch previews. Vercel/Netlify-like developer experience for arbitrary container apps, including dependencies such as CDN, redis, and database resources
- Staging and production environment management in your AWS/GCP accounts. Production runs in its own cloud account (AWS) or project (GCP). Integrated secrets management across all environment types with a developer-friendly UI

## Coherence Prerequisites

To deploy to Coherence, your Redwood project needs to be hosted on GitHub and you must have an [AWS](https://docs.withcoherence.com/docs/overview/aws-deep-dive) or [GCP](https://docs.withcoherence.com/docs/overview/gcp-deep-dive) account.

## Coherence Deploy

:::caution Prerender doesn't work with Coherence yet

You can see its current status and follow updates here on GitHub: https://github.com/redwoodjs/redwood/issues/8333.

But if you don't use prerender, carry on!

:::

If you want to deploy your Redwood project on Coherence, run the setup command:

```
yarn rw setup deploy coherence
```

The command will inspect your Prisma config to determine if you're using a supported database (at the moment, only `postgres` or `mysql` are supported on Coherence).

Then follow the [Coherence Redwood deploy docs](https://docs.withcoherence.com/docs/configuration/frameworks#redwood-js) for more information, including if you want to set up:
- a redis server
- database migration/seeding/snapshot loading
- cron jobs or async workers
- object storage using Google Cloud Storage or AWS's S3
1 change: 1 addition & 0 deletions docs/docs/deploy/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Redwood is designed for both serverless and traditional infrastructure deploymen

Currently, these are the officially supported deploy targets:
- Baremetal (physical server that you have SSH access to)
- [Coherence](https://www.withcoherence.com/)
- [Flightcontrol.dev](https://www.flightcontrol.dev?ref=redwood)
- [Edg.io](https://edg.io)
- [Netlify.com](https://www.netlify.com/)
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/forms.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ All of Redwood's form helpers need the `register` function to do what they do. B

### Using `formMethods`

There's some functions that `useForm` returns that it'd be nice to have access to.
There are some functions that `useForm` returns that it'd be nice to have access to.
For example, `useForm` returns a function `reset`, which resets the form's fields.
To access it, you have to call `useForm` yourself.
But you still need to pass `useForm`'s return to the `<FormProvider>` so that Redwood's helpers can register themselves:
Expand Down
10 changes: 8 additions & 2 deletions docs/docs/graphql.md
Original file line number Diff line number Diff line change
Expand Up @@ -1452,9 +1452,9 @@ The [GraphQL Playground](https://www.graphql-yoga.com/docs/features/graphiql) is
> Because both introspection and the playground share possibly sensitive information about your data model, your data, your queries and mutations, best practices for deploying a GraphQL Server call to disable these in production, RedwoodJS **, by default, only enables introspection and the playground when running in development**. That is when `process.env.NODE_ENV === 'development'`.
However, there may be cases where you want to enable introspection. You can enable introspection by setting the `allowIntrospection` option to `true`.
However, there may be cases where you want to enable introspection as well as the GraphQL PLaygrouns. You can enable introspection by setting the `allowIntrospection` option to `true` and enable GraphiQL by setting `allowGraphiQL` to `true`.
Here is an example of `createGraphQLHandler` function with the `allowIntrospection` option set to `true`:
Here is an example of `createGraphQLHandler` function with the `allowIntrospection` and `allowGraphiQL` options set to `true`:
```ts {8}
export const handler = createGraphQLHandler({
authDecoder,
Expand All @@ -1464,6 +1464,7 @@ export const handler = createGraphQLHandler({
sdls,
services,
allowIntrospection: true, // 👈 enable introspection in all environments
allowGraphiQL: true, // 👈 enable GraphiQL Playground in all environments
onException: () => {
// Disconnect from your database with an unhandled exception.
db.$disconnect()
Expand All @@ -1475,8 +1476,13 @@ export const handler = createGraphQLHandler({
Enabling introspection in production may pose a security risk, as it allows users to access information about your schema, queries, and mutations. Use this option with caution and make sure to secure your GraphQL API properly.
The may be cases where one wants to allow introspection, but not GraphiQL.
Or, you may want to enable GraphiQL, but not allow introspection; for example, to try out known queries, but not to share the entire set of possible operations and types.
:::
### GraphQL Armor Configuration
[GraphQL Armor](https://escape.tech/graphql-armor/) is a middleware that adds a security layer the RedwoodJS GraphQL endpoint configured with sensible defaults.
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/how-to/dbauth-passwordless.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export const schema = gql`
deleteUser(id: Int!): User! @requireAuth
generateToken(email: String!): userTokenResponse! @skipAuth
}
`
```

### 4. Modify the auth function

Expand Down Expand Up @@ -620,7 +620,7 @@ You should see the changes and it should look like this!
![image](https://user-images.githubusercontent.com/638764/220204883-800829ab-e037-41e1-a2da-d47923c4d20c.png)
### 7. Updating the routes
### 9. Updating the routes
The last thing we need to to do is update the routes to use the new page.
```jsx title="/web/src/Routes.js"
Expand Down
10 changes: 5 additions & 5 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,18 @@
]
},
"dependencies": {
"@docusaurus/core": "2.4.0",
"@docusaurus/plugin-content-docs": "2.4.0",
"@docusaurus/preset-classic": "2.4.0",
"@docusaurus/theme-common": "2.4.0",
"@docusaurus/core": "2.4.1",
"@docusaurus/plugin-content-docs": "2.4.1",
"@docusaurus/preset-classic": "2.4.1",
"@docusaurus/theme-common": "2.4.1",
"@mdx-js/react": "1.6.22",
"clsx": "1.2.1",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-player": "2.12.0"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "2.4.0",
"@docusaurus/module-type-aliases": "2.4.1",
"@tsconfig/docusaurus": "1.0.7",
"typescript": "5.0.4"
}
Expand Down
5 changes: 5 additions & 0 deletions docs/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ module.exports = {
items: [
{ type: 'doc', label: 'Introduction', id: 'deploy/introduction' },
{ type: 'doc', label: 'Baremetal', id: 'deploy/baremetal' },
{
type: 'doc',
label: 'GCP or AWS via Coherence',
id: 'deploy/coherence',
},
{
type: 'doc',
label: 'AWS via Flightcontrol',
Expand Down
Loading

0 comments on commit 80a7d4c

Please sign in to comment.