Compare commits

..

18 Commits

Author SHA1 Message Date
github-actions[bot]
551298b568 chore: update versions (#2900)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @nhost/dashboard@1.30.0

### Minor Changes

- 50441a8: feat: add ui for project autoscaler settings and run services
autoscaler settings

## @nhost/docs@2.18.0

### Minor Changes

-   c4aa159: feat: added advanced TLS document

### Patch Changes

-   91f0465: feat: added turnstile guide

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-09-27 15:01:34 +01:00
David BM
50441a84cb feat (dashboard): add autoscaler ui (#2872)
### **User description**
Resolves #2854


___

### **PR Type**
Enhancement


___

### **Description**
This PR introduces autoscaler UI functionality to the dashboard:

- Added new AutoscalerFormSection component for configuring autoscaler
settings
- Integrated autoscaler settings into ResourcesForm and ServiceForm
components
- Updated GraphQL queries and fragments to include autoscaler fields
- Modified validation schemas to accommodate autoscaler configurations
- Added new InfoOutlinedIcon component for improved UI feedback
- Updated types in graphql.ts to support new autoscaler and Grafana
features
- Implemented debounced handlers for form inputs to improve performance
- Added changeset for the new feature
- Made minor styling adjustments for consistency across components


___



### **Changes walkthrough** 📝
<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Documentation</strong></td><td><details><summary>2
files</summary><table>
<tr>
  <td>
    <details>
<summary><strong>next-env.d.ts</strong><dd><code>Update TypeScript
configuration URL</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

dashboard/next-env.d.ts

- Updated the URL for TypeScript configuration information



</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2872/files#diff-987cb886800df332c01f9cc3bdda1d903e619d92610bfdf08be35525bb280cd2">+1/-1</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>                    

<tr>
  <td>
    <details>
<summary><strong>thirty-ravens-applaud.md</strong><dd><code>Add
changeset for autoscaler UI</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; </dd></summary>
<hr>

.changeset/thirty-ravens-applaud.md

- Added changeset for the new autoscaler UI feature



</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2872/files#diff-f362e0efe6fe43cacc0b43340eb2a27bd9b49091536e45a22500e8752c5ea2aa">+5/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>                    

</table></details></td></tr><tr><td><strong>Enhancement</strong></td><td><details><summary>14
files</summary><table>
<tr>
  <td>
    <details>
<summary><strong>InfoOutlinedIcon.tsx</strong><dd><code>Add
InfoOutlinedIcon component</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; </dd></summary>
<hr>


dashboard/src/components/ui/v2/icons/InfoOutlinedIcon/InfoOutlinedIcon.tsx

<li>Added a new InfoOutlinedIcon component<br> <li> Implemented the icon
using SVG paths<br> <li> Set up proper component naming and export<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2872/files#diff-14bd3b1512123ee2900b3aacbcceb35cba9d43dc1cd847f9c7188519234a49cb">+30/-0</a>&nbsp;
&nbsp; </td>

</tr>                    

<tr>
  <td>
    <details>
<summary><strong>index.ts</strong><dd><code>Export InfoOutlinedIcon
component</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

dashboard/src/components/ui/v2/icons/InfoOutlinedIcon/index.ts

- Added export for InfoOutlinedIcon component



</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2872/files#diff-fbaf8132a386acdf834271af1efecd14f60b07f30b9906a710a6fee73e007da5">+1/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>                    

<tr>
  <td>
    <details>
<summary><strong>ResourcesForm.tsx</strong><dd><code>Integrate
autoscaler settings in ResourcesForm</code>&nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>


dashboard/src/features/projects/resources/settings/components/ResourcesForm/ResourcesForm.tsx

<li>Added autoscaler configuration to resource settings<br> <li> Updated
form initialization and submission to include autoscaler
<br>settings<br> <li> Modified form reset to include autoscaler
fields<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2872/files#diff-6d00a7b503dbd4b76f86d3949458d7f0bd62622cf17c523e0d668e3b459b67b5">+64/-26</a>&nbsp;
</td>

</tr>                    

<tr>
  <td>
    <details>
<summary><strong>ServiceResourcesFormFragment.tsx</strong><dd><code>Add
autoscaler UI to ServiceResourcesFormFragment</code>&nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>


dashboard/src/features/projects/resources/settings/components/ServiceResourcesFormFragment/ServiceResourcesFormFragment.tsx

<li>Added autoscaler UI elements including switch and max replicas
input<br> <li> Implemented debounced handlers for replica and max
replica changes<br> <li> Updated layout to accommodate new autoscaler
settings<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2872/files#diff-101690b5bda069581f2bf13bfd9559484984f0c137349daff49c3901b8235fb3">+89/-45</a>&nbsp;
</td>

</tr>                    

<tr>
  <td>
    <details>

<summary><strong>resourceSettingsValidationSchema.ts</strong><dd><code>Update
validation schema for autoscaler</code>&nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>


dashboard/src/features/projects/resources/settings/utils/resourceSettingsValidationSchema/resourceSettingsValidationSchema.ts

<li>Updated validation schema to include autoscaler settings<br> <li>
Modified ratio validation to consider autoscaler activation<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2872/files#diff-12c309ecfbe9c5393770e8eb678047701de3e7e0813972266014fa10a2add287">+8/-2</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>                    

<tr>
  <td>
    <details>
<summary><strong>ServiceForm.tsx</strong><dd><code>Integrate autoscaler
in ServiceForm</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

dashboard/src/features/services/components/ServiceForm/ServiceForm.tsx

<li>Added autoscaler configuration to service form submission<br> <li>
Included AutoscalerFormSection component in the form<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2872/files#diff-d62640c5c152c7b50a3a53deefcb29c6ed1fa685e15511863c09784497139c49">+8/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>                    

<tr>
  <td>
    <details>
<summary><strong>ServiceFormTypes.ts</strong><dd><code>Add autoscaler to
ServiceFormTypes</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>


dashboard/src/features/services/components/ServiceForm/ServiceFormTypes.ts

<li>Added autoscaler field to the validation schema<br> <li> Set up
validation rules for autoscaler maxReplicas<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2872/files#diff-70dc64b40f78adad0ce3db0f56cddfe824f3eb2d116b2ea6411518546810f3af">+6/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>                    

<tr>
  <td>
    <details>
<summary><strong>AutoscalerFormSection.tsx</strong><dd><code>Create
AutoscalerFormSection component</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>


dashboard/src/features/services/components/ServiceForm/components/AutoscalerFormSection/AutoscalerFormSection.tsx

<li>Implemented new AutoscalerFormSection component<br> <li> Added UI
for enabling/disabling autoscaler and setting max replicas<br> <li>
Integrated with form context for data management<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2872/files#diff-9c4cd6fb8cee6545ad4bba24cc91660a00d5d951315c9580f57c18f8d46be696">+87/-0</a>&nbsp;
&nbsp; </td>

</tr>                    

<tr>
  <td>
    <details>
<summary><strong>index.ts</strong><dd><code>Export AutoscalerFormSection
component</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; </dd></summary>
<hr>


dashboard/src/features/services/components/ServiceForm/components/AutoscalerFormSection/index.ts

- Added export for AutoscalerFormSection component



</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2872/files#diff-e5e0fc7b69cda7ec41d221c2d2eb31236da9f75940cd245f9bf5edf8a7438c38">+1/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>                    

<tr>
  <td>
    <details>
<summary><strong>ServicesList.tsx</strong><dd><code>Include autoscaler
in ServicesList</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

dashboard/src/features/services/components/ServicesList/ServicesList.tsx

<li>Added autoscaler field to service configuration<br> <li> Updated
styling classes for consistency<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2872/files#diff-efb3008c23436b2db5bb94de15e91c78cf76ef6481ecb02eb542cf660ba98653">+9/-8</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>                    

<tr>
  <td>
    <details>
<summary><strong>graphql.ts</strong><dd><code>Update GraphQL types for
autoscaler and Grafana</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

dashboard/src/utils/__generated__/graphql.ts

<li>Updated GraphQL types to include autoscaler configurations<br> <li>
Added new types for Grafana alerting and contacts<br> <li> Modified
existing types to accommodate autoscaler fields<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2872/files#diff-fbd5db84b560b1c91675004448c6c7fa0dcbfb28b9eb05d53b03e6cb7b83ebac">+293/-6</a>&nbsp;
</td>

</tr>                    

<tr>
  <td>
    <details>
<summary><strong>getResources.gql</strong><dd><code>Update
ServiceResources GraphQL fragment</code>&nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

dashboard/src/features/projects/resources/settings/gql/getResources.gql

- Added autoscaler fields to the ServiceResources fragment



</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2872/files#diff-68fa86be385f712ad875b055ed1403ec2086642aa31030bb2826615a136dd0ad">+12/-0</a>&nbsp;
&nbsp; </td>

</tr>                    

<tr>
  <td>
    <details>
<summary><strong>getRunService.graphql</strong><dd><code>Update
getRunService GraphQL query</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

dashboard/src/gql/services/getRunService.graphql

- Added autoscaler field to the getRunService query



</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2872/files#diff-2e51dd3f3ee7a2bafdb9c754e57ce461cdf2b2ef754edc7d99120fa859e6c1d2">+3/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>                    

<tr>
  <td>
    <details>
<summary><strong>getRunServices.graphql</strong><dd><code>Update
RunServiceConfig GraphQL fragment</code>&nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

dashboard/src/gql/services/getRunServices.graphql

- Added autoscaler field to the RunServiceConfig fragment



</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2872/files#diff-bddccfbe4a76e754eff4aff107d8780424c0f3606c781a8e6e3a5c9c099b7c57">+3/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>                    

</table></details></td></tr><tr><td><strong>Formatting</strong></td><td><details><summary>1
files</summary><table>
<tr>
  <td>
    <details>
<summary><strong>index.tsx</strong><dd><code>Update styling in services
page</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

dashboard/src/pages/[workspaceSlug]/[appSlug]/services/index.tsx

- Minor styling adjustment for consistency



</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2872/files#diff-e418070dbf550b4e92ae18e7f29bdd757d923b69e128cebe70f2fd3a47fcabd9">+1/-1</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>                    
</table></details></td></tr></tr></tbody></table>

___

> 💡 **PR-Agent usage**: Comment `/help "your question"` on any pull
request to receive relevant information

---------

Co-authored-by: Hassan Ben Jobrane <hsanbenjobrane@gmail.com>
2024-09-27 14:43:45 +01:00
David Barroso
c4aa159f1f feat (docs): added advanced TLS document (#2899)
### **PR Type**
Enhancement, Documentation


___

### **Description**
- Added a new comprehensive guide on advanced TLS configuration,
including TLS Client Authentication
- Updated the networking guide to include GRPC support and configuration
- Added a new 'platform/tls' page to the documentation structure
- Included a detailed step-by-step guide for setting up TLS Client
Authentication
- Provided examples of TLS configuration and usage with curl commands
- Updated the list of supported service types to include 'grpc'


___



### **Changes walkthrough** 📝
<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Documentation</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>breezy-fans-kiss.md</strong><dd><code>Add changeset for
TLS documentation</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

.changeset/breezy-fans-kiss.md

<li>Added a new changeset file for documenting the addition of an
advanced <br>TLS document<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2899/files#diff-bf8f8eb1d2664b9b181786b0f66cd6d70ba166236be705d4bfc24f13f7c5726a">+5/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>                    

<tr>
  <td>
    <details>
<summary><strong>mint.json</strong><dd><code>Add TLS page to
documentation structure</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; </dd></summary>
<hr>

docs/mint.json

- Added a new page 'platform/tls' to the Platform group



</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2899/files#diff-c91a604899dfef4b2494c317f4fd39a7f22b79986095f580399347293d534deb">+2/-1</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>                    

<tr>
  <td>
    <details>
<summary><strong>tls.mdx</strong><dd><code>Add comprehensive TLS
configuration guide</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
</dd></summary>
<hr>

docs/platform/tls.mdx

<li>Added a new document explaining advanced TLS configuration<br> <li>
Included sections on TLS Client Authentication with setup guide<br> <li>
Provided examples of configuration and usage<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2899/files#diff-f55226dfd5f3fa0b171c0761a8fe569b9faaf2320c761b29c33dde88dc42a2a5">+185/-0</a>&nbsp;
</td>

</tr>                    
</table></td></tr><tr><td><strong>Enhancement</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>networking.mdx</strong><dd><code>Update networking
guide with GRPC support</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
</dd></summary>
<hr>

docs/guides/run/networking.mdx

<li>Updated the supported service types to include 'grpc'<br> <li> Added
a new section on GRPC support with configuration example<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2899/files#diff-fb3f7f794126de1897c7c9db46fdef956df40aaf971fe76713b06735148e1219">+19/-1</a>&nbsp;
&nbsp; </td>

</tr>                    
</table></td></tr></tr></tbody></table>

___

> 💡 **PR-Agent usage**: Comment `/help "your question"` on any pull
request to receive relevant information
2024-09-27 12:53:38 +02:00
David Barroso
91f0465cbc feat (docs): added turnstile guide (#2896)
### **PR Type**
Enhancement, Documentation


___

### **Description**
- Added a comprehensive guide on integrating Cloudflare's Turnstile for
bot protection in the Auth API
- Guide includes:
  - Overview of Turnstile and its benefits
  - Step-by-step integration process
  - Configuration examples for Nhost projects
  - Code snippets for frontend implementation
- Updated navigation in mint.json to include the new bot protection
guide
- Enhances security documentation for Nhost users


___



### **Changes walkthrough** 📝
<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Documentation</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>bot-protection.mdx</strong><dd><code>New Bot Protection
Guide Using Cloudflare Turnstile</code>&nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; </dd></summary>
<hr>

docs/guides/auth/bot-protection.mdx

<li>Added new guide for integrating Cloudflare's Turnstile for bot
<br>protection<br> <li> Includes overview, benefits, and step-by-step
integration instructions<br> <li> Provides code examples and
configuration details<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2896/files#diff-138cec6e6b432e18aaad258bb16e7e8b08c926b9850943600e6cba0fde8cec91">+76/-0</a>&nbsp;
&nbsp; </td>

</tr>                    
</table></td></tr><tr><td><strong>Configuration
changes</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>mint.json</strong><dd><code>Update Navigation to
Include Bot Protection Guide</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

docs/mint.json

<li>Added "guides/auth/bot-protection" to the authentication guides
<br>section<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2896/files#diff-c91a604899dfef4b2494c317f4fd39a7f22b79986095f580399347293d534deb">+1/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>                    
</table></td></tr></tr></tbody></table>

___

> 💡 **PR-Agent usage**: Comment `/help "your question"` on any pull
request to receive relevant information
2024-09-27 11:58:51 +02:00
Hassan Ben Jobrane
6f61262045 fix: unlink nhost-js dependency from sveltekit example (#2898) 2024-09-26 10:28:57 +01:00
github-actions[bot]
257815d519 chore: update versions (#2888)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @nhost/hasura-auth-js@2.6.0

### Minor Changes

- 55d8bb5: feat: support custom headers in sign-up and deanonymize
requests

## @nhost/react@3.6.0

### Minor Changes

- 55d8bb5: feat: add `requestOptions` to `signUpEmailPassword` to allow
passing extra headers with the signup request

### Patch Changes

-   @nhost/nhost-js@3.1.10

## @nhost/apollo@7.1.7

### Patch Changes

-   @nhost/nhost-js@3.1.10

## @nhost/react-apollo@13.0.0

### Patch Changes

-   Updated dependencies [55d8bb5]
    -   @nhost/react@3.6.0
    -   @nhost/apollo@7.1.7

## @nhost/react-urql@10.0.0

### Patch Changes

-   Updated dependencies [55d8bb5]
    -   @nhost/react@3.6.0

## @nhost/nextjs@2.1.22

### Patch Changes

-   Updated dependencies [55d8bb5]
    -   @nhost/react@3.6.0

## @nhost/nhost-js@3.1.10

### Patch Changes

-   Updated dependencies [55d8bb5]
    -   @nhost/hasura-auth-js@2.6.0

## @nhost/vue@2.6.7

### Patch Changes

-   @nhost/nhost-js@3.1.10

## @nhost/dashboard@1.29.0

### Minor Changes

-   55d8bb5: feat: integrate turnstile for signup verification
-   2a2e54c: fix: update docs url in run services form tooltip
- 18f942f: fix: display long error messages in error toast without
overflow

### Patch Changes

-   @nhost/react-apollo@13.0.0
-   @nhost/nextjs@2.1.22

## @nhost-examples/cli@0.3.12

### Patch Changes

-   @nhost/nhost-js@3.1.10

## @nhost-examples/codegen-react-apollo@0.4.13

### Patch Changes

-   Updated dependencies [55d8bb5]
    -   @nhost/react@3.6.0
    -   @nhost/react-apollo@13.0.0

## @nhost-examples/codegen-react-query@0.4.13

### Patch Changes

-   Updated dependencies [55d8bb5]
    -   @nhost/react@3.6.0

## @nhost-examples/codegen-react-urql@0.3.13

### Patch Changes

-   Updated dependencies [55d8bb5]
    -   @nhost/react@3.6.0
    -   @nhost/react-urql@10.0.0

## @nhost-examples/multi-tenant-one-to-many@2.2.13

### Patch Changes

-   @nhost/nhost-js@3.1.10

## @nhost-examples/nextjs@0.3.13

### Patch Changes

-   Updated dependencies [55d8bb5]
    -   @nhost/react@3.6.0
    -   @nhost/react-apollo@13.0.0
    -   @nhost/nextjs@2.1.22

## @nhost-examples/node-storage@0.2.12

### Patch Changes

-   @nhost/nhost-js@3.1.10

## @nhost-examples/nextjs-server-components@0.4.14

### Patch Changes

-   @nhost/nhost-js@3.1.10

## @nhost-examples/react-apollo@1.0.2

### Patch Changes

-   Updated dependencies [55d8bb5]
    -   @nhost/react@3.6.0
    -   @nhost/react-apollo@13.0.0

## @nhost-examples/react-gqty@1.2.13

### Patch Changes

-   Updated dependencies [55d8bb5]
    -   @nhost/react@3.6.0

## @nhost-examples/react-native@0.0.6

### Patch Changes

-   Updated dependencies [55d8bb5]
    -   @nhost/react@3.6.0
    -   @nhost/react-apollo@13.0.0

## @nhost-examples/vue-apollo@0.6.13

### Patch Changes

-   @nhost/nhost-js@3.1.10
-   @nhost/apollo@7.1.7
-   @nhost/vue@2.6.7

## @nhost-examples/vue-quickstart@0.2.13

### Patch Changes

-   @nhost/apollo@7.1.7
-   @nhost/vue@2.6.7

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-09-25 16:23:50 +01:00
Hassan Ben Jobrane
55d8bb5a89 feat: turnstile (#2895)
### **PR Type**
Enhancement


___

### **Description**
- Integrated Cloudflare Turnstile for signup verification in the
dashboard
- Added support for custom headers in authentication requests
- Updated signup page to include Turnstile component and handle
verification
- Modified authentication machine and fetch utilities to support extra
headers
- Added Turnstile site key to environment variables
- Included react-turnstile package as a new dependency


___



### **Changes walkthrough** 📝
<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>signup.tsx</strong><dd><code>Integrate Turnstile for
signup verification</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

dashboard/src/pages/signup.tsx

<li>Integrated Turnstile for signup verification<br> <li> Added state
management for Turnstile response<br> <li> Updated signUpEmailPassword
function to include Turnstile response in <br>headers<br> <li> Added
Turnstile component to the signup form<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2895/files#diff-fc2b5989e3bbafda1d3d8b2317d24c39ef2b8cec0c4dc410170fa2da13464f68">+29/-5</a>&nbsp;
&nbsp; </td>

</tr>                    

<tr>
  <td>
    <details>
<summary><strong>machine.ts</strong><dd><code>Add header support for
authentication requests</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

packages/hasura-auth-js/src/machines/authentication/machine.ts

<li>Modified postRequest function to accept headers parameter<br> <li>
Updated signUpEmailPassword action to include headers in the request<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2895/files#diff-a8fdfee087ad5a72ea0a64667e2a0c7f25baa84eaaf73ebfee3f5a5a1b7584d1">+18/-9</a>&nbsp;
&nbsp; </td>

</tr>                    

<tr>
  <td>
    <details>
<summary><strong>options.ts</strong><dd><code>Add headers option to
registration interface</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

packages/hasura-auth-js/src/types/options.ts

- Added headers property to RegistrationOptions interface



</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2895/files#diff-087479bfe46a1294bc277b5497fbd3f7638853290b8f521ed5e5cb374786812f">+5/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>                    

<tr>
  <td>
    <details>
<summary><strong>fetch.ts</strong><dd><code>Enhance fetch utilities with
extra headers support</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; </dd></summary>
<hr>

packages/hasura-auth-js/src/utils/fetch.ts

<li>Modified fetchWrapper function to accept and merge extra headers<br>
<li> Updated postFetch function to include extraHeaders parameter<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2895/files#diff-b1af9daf6c51514d5d514540f2318d87e926c5e8a57079b6e2c258b98a1163a2">+13/-4</a>&nbsp;
&nbsp; </td>

</tr>                    
</table></td></tr><tr><td><strong>Configuration
changes</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>.env.example</strong><dd><code>Add Turnstile site key
to environment variables</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

dashboard/.env.example

- Added NEXT_PUBLIC_TURNSTILE_SITE_KEY variable



</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2895/files#diff-b47cf46119af2f0298d96e5657e53e57161833e8b02d87526ac5c1ed9393d477">+1/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>                    
</table></td></tr><tr><td><strong>Dependencies</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>package.json</strong><dd><code>Add Turnstile React
component dependency</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; </dd></summary>
<hr>

dashboard/package.json

- Added @marsidev/react-turnstile dependency



</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2895/files#diff-2d8d55c799cd71f1b35e831f075f8178ed1734c4820a2ad548b4dd24d6938d7c">+1/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>                    
</table></td></tr></tr></tbody></table>

___

> 💡 **PR-Agent usage**: Comment `/help "your question"` on any pull
request to receive relevant information
2024-09-25 16:01:40 +01:00
David BM
18f942f464 fix (dashboard): long error message in error toast overflow (#2892) 2024-09-23 13:42:41 -04:00
David BM
2a2e54c4d8 fix (dashboard): update url to docs in run services tooltip (#2886) 2024-09-21 11:16:21 -04:00
github-actions[bot]
6a735523b4 chore: update versions (#2880)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @nhost/nextjs@2.1.21

### Patch Changes

- 52a38fe: chore: update dependencies to address security
vulnerabilities

## @nhost/dashboard@1.28.2

### Patch Changes

- 52a38fe: chore: update dependencies to address security
vulnerabilities
-   Updated dependencies [52a38fe]
    -   @nhost/nextjs@2.1.21

## @nhost/docs@2.17.2

### Patch Changes

-   52a38fe: chore: added pg_ivm extension

## @nhost-examples/codegen-react-apollo@0.4.12

### Patch Changes

- 52a38fe: chore: update dependencies to address security
vulnerabilities

## @nhost-examples/codegen-react-query@0.4.12

### Patch Changes

- 52a38fe: chore: update dependencies to address security
vulnerabilities

## @nhost-examples/codegen-react-urql@0.3.12

### Patch Changes

- 52a38fe: chore: update dependencies to address security
vulnerabilities

## @nhost-examples/multi-tenant-one-to-many@2.2.12

### Patch Changes

- 52a38fe: chore: update dependencies to address security
vulnerabilities

## @nhost-examples/nextjs@0.3.12

### Patch Changes

- 52a38fe: chore: update dependencies to address security
vulnerabilities
-   Updated dependencies [52a38fe]
    -   @nhost/nextjs@2.1.21

## @nhost-examples/nextjs-server-components@0.4.13

### Patch Changes

- 52a38fe: chore: update dependencies to address security
vulnerabilities

## @nhost-examples/sveltekit@0.4.1

### Patch Changes

- 52a38fe: chore: update dependencies to address security
vulnerabilities

## @nhost-examples/react-apollo@1.0.1

### Patch Changes

- 4d6b722: fix: add check for elevated permission before deleting a
security key
- 3dcbacf: fix: add elevated permission check before adding a security
key
- 52a38fe: chore: update dependencies to address security
vulnerabilities

## @nhost-examples/react-gqty@1.2.12

### Patch Changes

- 52a38fe: chore: update dependencies to address security
vulnerabilities

## @nhost-examples/vue-apollo@0.6.12

### Patch Changes

- 52a38fe: chore: update dependencies to address security
vulnerabilities

## @nhost-examples/vue-quickstart@0.2.12

### Patch Changes

- 52a38fe: chore: update dependencies to address security
vulnerabilities

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-09-19 12:23:04 +01:00
Hassan Ben Jobrane
4d6b7228d9 fix(react-apollo): add elevated permission check before deleting a security key (#2883)
### **PR Type**
Enhancement, Bug fix


___

### **Description**
- Enhanced security key management by adding elevated permission checks:
- Implemented `elevatePermission` function to centralize permission
elevation logic
  - Added permission check before deleting a security key
- Modified `onSubmit` function to use `elevatePermission` before adding
a key
- Refactored code structure for improved readability and
maintainability:
  - Moved `removeKey` mutation definition earlier in the component
  - Simplified conditional logic in `onSubmit` function
- Added a changeset file to document the bug fix for elevated permission
check


___



### **Changes walkthrough** 📝
<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>security-keys.tsx</strong><dd><code>Enhance security
key management with permission checks</code>&nbsp; &nbsp; &nbsp;
</dd></summary>
<hr>

examples/react-apollo/src/components/profile/security-keys.tsx

<li>Added <code>elevatePermission</code> function to handle permission
elevation logic<br> <li> Modified <code>onSubmit</code> function to use
<code>elevatePermission</code> before adding a <br>key<br> <li> Added
permission check before deleting a security key<br> <li> Refactored code
structure for better readability and maintainability<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2883/files#diff-20c5d7ececb3f500fc179a36ec957b0744197e88ca47d050e29b401967781be3">+43/-31</a>&nbsp;
</td>

</tr>                    
</table></td></tr><tr><td><strong>Documentation</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>lucky-mirrors-relate.md</strong><dd><code>Add changeset
for security key deletion fix</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
</dd></summary>
<hr>

.changeset/lucky-mirrors-relate.md

<li>Added a changeset file to document the bug fix for elevated
permission <br>check<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2883/files#diff-3a2d1f6a2da0ea9311d8ad2c20128f3d06defc1e24ae9c8a2f0d71f82246cb79">+5/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>                    
</table></td></tr></tr></tbody></table>

___

> 💡 **PR-Agent usage**:
>Comment `/help` on the PR to get a list of all available PR-Agent tools
and their descriptions
2024-09-19 11:56:55 +01:00
Hassan Ben Jobrane
3dcbacf188 fix(react-apollo): add elevation check before adding security key (#2882)
### **PR Type**
Enhancement


___

### **Description**
- Implemented an elevation check before adding a security key when there
are existing keys
- Added new imports from '@nhost/react': `useElevateSecurityKeyEmail`
and `useUserEmail`
- Integrated `elevated` and `elevateEmailSecurityKey` from the
`useElevateSecurityKeyEmail` hook
- Added error handling for the elevation process
- Updated the `onSubmit` function to include the elevation check and
process
- Improved security by requiring elevation for adding subsequent
security keys


___



### **Changes walkthrough** 📝
<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>security-keys.tsx</strong><dd><code>Add elevation check
for security key addition</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

examples/react-apollo/src/components/profile/security-keys.tsx

<li>Added import for <code>useElevateSecurityKeyEmail</code> and
<code>useUserEmail</code> from <br>'@nhost/react'<br> <li> Implemented
elevation check before adding a security key<br> <li> Added error
handling for elevation process<br> <li> Integrated <code>elevated</code>
and <code>elevateEmailSecurityKey</code> from
<br><code>useElevateSecurityKeyEmail</code> hook<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2882/files#diff-20c5d7ececb3f500fc179a36ec957b0744197e88ca47d050e29b401967781be3">+24/-2</a>&nbsp;
&nbsp; </td>

</tr>                    
</table></td></tr></tr></tbody></table>

___

> 💡 **PR-Agent usage**:
>Comment `/help` on the PR to get a list of all available PR-Agent tools
and their descriptions
2024-09-19 11:14:56 +01:00
David Barroso
5c2269ef92 chore (docs): place the grafana files in the right place (#2881)
### **PR Type**
Enhancement, Documentation


___

### **Description**
- Added a comprehensive set of Grafana configuration files and
dashboards for enhanced observability of Nhost projects.
- Introduced new dashboards for Functions metrics, GraphQL metrics,
Ingress metrics, and overall Project metrics.
- Implemented Grafana setup scripts and configuration files for data
sources, contact points, and notification policies.
- Created Nhost-specific alerting rules for critical issues such as high
CPU usage, low disk space, and high error rates.
- Improved documentation by adding detailed comments and descriptions in
configuration files.
- Enhanced customization options by using environment variables and
templates in various configuration files.


___



### **Changes walkthrough** 📝
<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Configuration
changes</strong></td><td><details><summary>6 files</summary><table>
<tr>
  <td>
    <details>
<summary><strong>setup_config.sh</strong><dd><code>Add Grafana setup
configuration script</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

observability/grafana/setup_config.sh

<li>Added a new shell script to set up Grafana configuration<br> <li>
Script creates necessary directories and generates datasources
<br>configuration<br> <li> Uses environment variables and templates for
dynamic configuration<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2881/files#diff-8c8a7932243229ff1b184b232685f85e894dc85cd13fbc7e6203de6826f05f19">+12/-1</a>&nbsp;
&nbsp; </td>

</tr>                    

<tr>
  <td>
    <details>
<summary><strong>contact_points.yaml</strong><dd><code>Add Grafana
contact points configuration</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; </dd></summary>
<hr>

observability/grafana/contact_points.yaml

<li>Added a new YAML file for Grafana contact points configuration<br>
<li> Includes settings for email, Pagerduty, Discord, Slack, and webhook
<br>notifications<br> <li> Uses templating for dynamic configuration
based on user settings<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2881/files#diff-9262f9a9442457b302afbed9a64604007bec161fb8eed794f3e75a79a3e24a8a">+59/-1</a>&nbsp;
&nbsp; </td>

</tr>                    

<tr>
  <td>
    <details>
<summary><strong>dashboards_providers.yaml</strong><dd><code>Add Grafana
dashboard providers configuration</code>&nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

observability/grafana/dashboards_providers.yaml

<li>Added a new YAML file for Grafana dashboard providers
configuration<br> <li> Configures the source of dashboards to be loaded
into Grafana<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2881/files#diff-bfdc9ab104d266e0cdc3153476252536d83aeb13905c423c95f1fc9a4a135cdf">+11/-1</a>&nbsp;
&nbsp; </td>

</tr>                    

<tr>
  <td>
    <details>
<summary><strong>datasources.yaml.tmpl</strong><dd><code>Add Grafana
data sources configuration template</code>&nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

observability/grafana/datasources.yaml.tmpl

<li>Added a new YAML template file for Grafana data sources
configuration<br> <li> Configures Prometheus as the default data source
for Grafana<br> <li> Uses environment variables for dynamic
configuration<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2881/files#diff-07d3ef0d2277f144efb00f0e400cbdcb0a1474c9059dfa1ae281bf2388c0992c">+18/-1</a>&nbsp;
&nbsp; </td>

</tr>                    

<tr>
  <td>
    <details>
<summary><strong>grafana.ini</strong><dd><code>Add Grafana main
configuration file</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

observability/grafana/grafana.ini

<li>Added a new INI file for Grafana main configuration<br> <li>
Includes settings for analytics, logging, paths, and server options<br>
<li> Configures SMTP if provided in the environment<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2881/files#diff-144fcadb330865a0b6bcbedd327d5f5b3d72c458a7805c2449f7d8bb568e13f5">+24/-1</a>&nbsp;
&nbsp; </td>

</tr>                    

<tr>
  <td>
    <details>
<summary><strong>notification_policies.yaml</strong><dd><code>Add
Grafana notification policies configuration</code>&nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

observability/grafana/notification_policies.yaml

<li>Added a new YAML file for Grafana notification policies<br> <li>
Configures the default receiver for alerts<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2881/files#diff-b79528bf44b485a4e87a327f2b82b78b6b409e06a6077eb9f6c5eea24653193d">+8/-1</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>                    

</table></details></td></tr><tr><td><strong>Enhancement</strong></td><td><details><summary>5
files</summary><table>
<tr>
  <td>
    <details>
<summary><strong>dashboard_functions_metrics.json</strong><dd><code>Add
Grafana dashboard for Functions metrics</code>&nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; </dd></summary>
<hr>

observability/grafana/dashboard_functions_metrics.json

<li>Added a new JSON file for Grafana dashboard configuration<br> <li>
Dashboard focuses on Functions metrics including invocations, response
<br>times, and errors<br> <li> Includes various panels and
visualizations for comprehensive <br>monitoring<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2881/files#diff-b2815589932503d2d05f9027d550d28f3d2a774106d0f3dec61db8678b12c385">+1280/-1</a></td>

</tr>                    

<tr>
  <td>
    <details>
<summary><strong>dashboard_graphql.json</strong><dd><code>Add Grafana
dashboard for GraphQL metrics</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; </dd></summary>
<hr>

observability/grafana/dashboard_graphql.json

<li>Added a new JSON file for Grafana dashboard configuration<br> <li>
Dashboard focuses on GraphQL metrics including resource utilization
<br>and request rates<br> <li> Includes panels for CPU, memory, and
GraphQL-specific metrics<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2881/files#diff-4f591ab80bee38969fd64c20c4ddab89df3d810d41144089fa23bc1d59a89d4d">+696/-1</a>&nbsp;
</td>

</tr>                    

<tr>
  <td>
    <details>
<summary><strong>dashboard_ingress_metrics.json</strong><dd><code>Add
Grafana dashboard for Ingress metrics</code>&nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; </dd></summary>
<hr>

observability/grafana/dashboard_ingress_metrics.json

<li>Added a new JSON file for Grafana dashboard configuration<br> <li>
Dashboard focuses on Ingress metrics including requests, response
<br>status, and errors<br> <li> Includes panels for various
ingress-related metrics and visualizations<br> <br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2881/files#diff-058aae47dde92553225c557b839f7359ad1deefe341f9a119f63b6875352bb55">+777/-1</a>&nbsp;
</td>

</tr>                    

<tr>
  <td>
    <details>
<summary><strong>dashboard_project_metrics.json</strong><dd><code>Add
Grafana dashboard for Project-wide metrics</code>&nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

observability/grafana/dashboard_project_metrics.json

<li>Added a new JSON file for Grafana dashboard configuration<br> <li>
Dashboard provides an overview of project-wide metrics<br> <li> Includes
panels for CPU, memory, network, and service-specific metrics<br> <br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2881/files#diff-1db1a1e7d7715e17415ec82d96997af4bb235de0f752711e2a6c27420067bb54">+2038/-1</a></td>

</tr>                    

<tr>
  <td>
    <details>
<summary><strong>rules_nhost.yaml</strong><dd><code>Add Nhost-specific
Grafana alerting rules</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
</dd></summary>
<hr>

observability/grafana/rules_nhost.yaml

<li>Added a new YAML file for Grafana alerting rules<br> <li> Includes
rules for high CPU usage, low disk space, low memory, OOM <br>kills, and
high error rates<br> <li> Rules are customized for Nhost services and
include detailed <br>annotations<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2881/files#diff-27165812186176e21d13a35136e43511b837700a599d3a00c61a1f6b36c55af2">+370/-1</a>&nbsp;
</td>

</tr>                    
</table></details></td></tr></tr></tbody></table>

___

> 💡 **PR-Agent usage**:
>Comment `/help` on the PR to get a list of all available PR-Agent tools
and their descriptions
2024-09-18 15:36:32 +02:00
David Barroso
52a38feca7 chore (docs): added pg_ivm extension (#2879)
### **PR Type**
Enhancement, Documentation


___

### **Description**
- Added documentation for the pg_ivm (Incremental View Maintenance)
PostgreSQL extension
- Included a new section in the database extensions guide explaining
pg_ivm's purpose and benefits
- Provided SQL commands for installing and uninstalling the pg_ivm
extension
- Added a link to the pg_ivm GitHub repository for further reference
- Created a changeset file to track the documentation update


___



### **Changes walkthrough** 📝
<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Documentation</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>rare-wolves-tease.md</strong><dd><code>Add changeset
for pg_ivm extension documentation</code>&nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

.changeset/rare-wolves-tease.md

<li>Added a new changeset file for documenting the addition of pg_ivm
<br>extension<br> <li> Specified a patch update for '@nhost/docs'<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2879/files#diff-da3e674eeabc0ad81e3cc5534f4c3a67cf1c6ecae9fbed354e5cc0e4d069493b">+5/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>                    

<tr>
  <td>
    <details>
<summary><strong>extensions.mdx</strong><dd><code>Add documentation for
pg_ivm extension</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; </dd></summary>
<hr>

docs/guides/database/extensions.mdx

<li>Added a new section for the pg_ivm extension<br> <li> Provided an
overview of Incremental View Maintenance (IVM)<br> <li> Included
installation and uninstallation SQL commands<br> <li> Added a link to
the pg_ivm GitHub repository<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2879/files#diff-7a41fa45d84db83a8c01a76ddb42ad614022ad94a4c3a6aa321f5b9a5300da8c">+26/-0</a>&nbsp;
&nbsp; </td>

</tr>                    
</table></td></tr></tr></tbody></table>

___

> 💡 **PR-Agent usage**:
>Comment `/help` on the PR to get a list of all available PR-Agent tools
and their descriptions

---------

Co-authored-by: Hassan Ben Jobrane <hsanbenjobrane@gmail.com>
2024-09-18 14:49:37 +02:00
github-actions[bot]
f218058c89 chore: update versions (#2869)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @nhost/dashboard@1.28.1

### Patch Changes

-   9735fa2: chore: remove broken link

## @nhost/docs@2.17.1

### Patch Changes

-   db2f44d: fix: update rate-limit to reflect reality
- dda0c67: chore: udpate metrics documentation with managed
configuration

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-09-18 11:40:25 +01:00
David Barroso
dda0c67fa4 chore (docs): udpate metrics documentation with managed configuration (#2871)
### **PR Type**
Enhancement, Documentation


___

### **Description**
- Enhanced metrics documentation with detailed information on Grafana
configuration, contact points, SMTP settings, and alerting.
- Added new configuration files for Grafana, including setup for
datasources, dashboards, contact points, and alerting rules.
- Updated existing dashboard configurations to use the "nhost"
datasource and improve legend formatting.
- Introduced a setup script to automate Grafana configuration
generation.
- Restructured documentation navigation for better organization of
metrics-related content.
- Added README with instructions for contributing new Grafana
dashboards.
- Implemented comprehensive alerting rules for various system metrics
and error conditions.


___



### **Changes walkthrough** 📝
<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Configuration
changes</strong></td><td><details><summary>11 files</summary><table>
<tr>
  <td>
    <details>
<summary><strong>setup_config.sh</strong><dd><code>Add Grafana
configuration setup script</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

observability/setup_config.sh

<li>New script to set up Grafana configuration<br> <li> Creates
datasources directory<br> <li> Retrieves token and app ID<br> <li>
Generates datasources.yaml file<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2871/files#diff-020b65994838bf8f896b973c08c3d1f32fb26df56981eee8feec396adddc0fa6">+11/-0</a>&nbsp;
&nbsp; </td>

</tr>                    

<tr>
  <td>
    <details>
<summary><strong>contact_points.yaml</strong><dd><code>Add Grafana
contact points configuration</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; </dd></summary>
<hr>

observability/contact_points.yaml

<li>New file for configuring Grafana contact points<br> <li> Includes
settings for email, PagerDuty, Discord, Slack, and webhook
<br>notifications<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2871/files#diff-9b849dd13ecd160bb71d0dbd99677bbc8cd455950a49d2a2c5e0faa12d84de62">+58/-0</a>&nbsp;
&nbsp; </td>

</tr>                    

<tr>
  <td>
    <details>

<summary><strong>dashboard_functions_metrics.json</strong><dd><code>Update
Functions dashboard configuration</code>&nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

observability/dashboard_functions_metrics.json

<li>Updated datasource UID from "prometheus" to "nhost"<br> <li>
Modified legend format to use print statements<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2871/files#diff-43ed0168e8291fdeb852ae00ee52f832e6e54b38d7957ad59fb3f3d2bcfa9bb0">+41/-39</a>&nbsp;
</td>

</tr>                    

<tr>
  <td>
    <details>
<summary><strong>dashboard_graphql.json</strong><dd><code>Update GraphQL
dashboard configuration</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

observability/dashboard_graphql.json

<li>Updated datasource UID from "prometheus" to "nhost"<br> <li>
Modified legend format to use print statements<br> <li> Added "nhost"
tag to dashboard<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2871/files#diff-da87c05a307528ead905fc17fb6d75eb31b44769d06714c66233f489cbdbb1f2">+24/-22</a>&nbsp;
</td>

</tr>                    

<tr>
  <td>
    <details>

<summary><strong>dashboard_ingress_metrics.json</strong><dd><code>Update
Ingress Metrics dashboard configuration</code>&nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

observability/dashboard_ingress_metrics.json

<li>Removed __inputs, __elements, and __requires sections<br> <li>
Updated datasource UID from "prometheus" to "nhost"<br> <li> Modified
legend format to use print statements<br> <li> Added "nhost" tag to
dashboard<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2871/files#diff-de5c4d7cc3aa858822d9243161b50924d04e290013eb4a738f19bc07a79b1ed7">+25/-54</a>&nbsp;
</td>

</tr>                    

<tr>
  <td>
    <details>

<summary><strong>dashboard_project_metrics.json</strong><dd><code>Update
Project Metrics dashboard configuration</code>&nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

observability/dashboard_project_metrics.json

<li>Removed __inputs, __elements, and __requires sections<br> <li>
Updated datasource UID from "${DS_PROMETHEUS}" to "nhost"<br> <li>
Modified legend format to use print statements<br> <li> Updated
schemaVersion and removed templating list<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2871/files#diff-18cfde5980fad509ab3a14485f1ce3e7f89540854f30a9d932a630c7003065f6">+98/-157</a></td>

</tr>                    

<tr>
  <td>
    <details>
<summary><strong>dashboards_providers.yaml</strong><dd><code>Add Grafana
dashboard providers configuration</code>&nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

observability/dashboards_providers.yaml

<li>New file for configuring Grafana dashboard providers<br> <li> Sets
up file-based dashboard provisioning<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2871/files#diff-c6d162b6c4666e2ee121c37b0d5cffc1b760ed68446e65d5556f083e241765b9">+10/-0</a>&nbsp;
&nbsp; </td>

</tr>                    

<tr>
  <td>
    <details>
<summary><strong>datasources.yaml.tmpl</strong><dd><code>Add Grafana
datasource configuration template</code>&nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

observability/datasources.yaml.tmpl

<li>New template file for Grafana datasource configuration<br> <li> Sets
up Prometheus datasource with custom query parameters and
<br>authorization<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2871/files#diff-883ff1a7b6c26d41604cfb7fbe7444c568f9379d408a140f0e88047b1768468e">+17/-0</a>&nbsp;
&nbsp; </td>

</tr>                    

<tr>
  <td>
    <details>
<summary><strong>grafana.ini</strong><dd><code>Add Grafana main
configuration file</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

observability/grafana.ini

<li>New configuration file for Grafana<br> <li> Includes settings for
analytics, logging, paths, and server<br> <li> Conditional SMTP
configuration<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2871/files#diff-69effef5d34dd2b15f66a1ff7eb524de80e14e82b6ffd63ce3a9cf84fcfa2128">+23/-0</a>&nbsp;
&nbsp; </td>

</tr>                    

<tr>
  <td>
    <details>
<summary><strong>notification_policies.yaml</strong><dd><code>Add
Grafana notification policies configuration</code>&nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

observability/notification_policies.yaml

<li>New file for configuring Grafana notification policies<br> <li> Sets
up a default policy for the "Nhost Managed Contacts" receiver<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2871/files#diff-15f73217844e330f8cbf0b98becf9ba1712ded93168ec52ffd10ad7af58326e9">+7/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>                    

<tr>
  <td>
    <details>
<summary><strong>rules_nhost.yaml</strong><dd><code>Add Grafana alerting
rules configuration</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; </dd></summary>
<hr>

observability/rules_nhost.yaml

<li>New file for configuring Grafana alerting rules<br> <li> Includes
rules for high CPU usage, low disk space, low memory, OOM <br>kills, and
high error rates<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2871/files#diff-2be0d3f7ec2e1a61cf05bbac1c46b6e14a822af4797d27d2c0caaa5205de88ec">+369/-0</a>&nbsp;
</td>

</tr>                    

</table></details></td></tr><tr><td><strong>Documentation</strong></td><td><details><summary>3
files</summary><table>
<tr>
  <td>
    <details>
<summary><strong>mint.json</strong><dd><code>Restructure documentation
navigation</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

docs/mint.json

<li>Removed nested "Monitoring" group<br> <li> Moved "platform/metrics"
to main "Platform" group<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2871/files#diff-c91a604899dfef4b2494c317f4fd39a7f22b79986095f580399347293d534deb">+1/-5</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>                    

<tr>
  <td>
    <details>
<summary><strong>metrics.mdx</strong><dd><code>Enhance metrics
documentation with configuration details</code>&nbsp; </dd></summary>
<hr>

docs/platform/metrics.mdx

<li>Added info about Pro/Team/Enterprise feature<br> <li> Expanded
sections on accessing and configuring Grafana<br> <li> Added details
about contact points, SMTP, and alerting configuration<br> <li> Included
information about advanced configuration options<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2871/files#diff-433c57c7c7811809819b3683a23368324a93a9eac7a4ab121b54d16414452f6d">+124/-6</a>&nbsp;
</td>

</tr>                    

<tr>
  <td>
    <details>
<summary><strong>README.md</strong><dd><code>Add README for Grafana
dashboard contributions</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

observability/grafana/README.md

<li>New README file with instructions for contributing dashboards<br>
<li> Outlines steps to export and save dashboard files<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2871/files#diff-83ce6f1e076f43acbdcb8cfeac5c2caa0a1d87116c25c1cb063ae0b10b7b6885">+9/-1</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>                    
</table></details></td></tr></tr></tbody></table>

___

> 💡 **PR-Agent usage**:
>Comment `/help` on the PR to get a list of all available PR-Agent tools
and their descriptions
2024-09-17 09:43:44 +02:00
David Barroso
db2f44d7c0 fix (docs): update rate-limit to reflect reality (#2870)
### **PR Type**
Documentation


___

### **Description**
- Updated the rate limit for email sending endpoints in the
documentation
- Changed the limit from 50 per hour to 10 per hour for projects without
custom SMTP settings
- This change reflects the actual rate limit implemented in the system
- No other changes were made to the rate limits table or surrounding
text


___



### **Changes walkthrough** 📝
<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Documentation</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>rate-limits.mdx</strong><dd><code>Update email rate
limit in documentation</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; </dd></summary>
<hr>

docs/platform/rate-limits.mdx

<li>Updated the rate limit for email sending endpoints from 50/hour to
<br>10/hour for projects without custom SMTP settings<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2870/files#diff-d6c7ab75a347c1217107fdcf841312df268708bc7d319f528ea67c7280f00284">+1/-1</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>                    
</table></td></tr></tr></tbody></table>

___

> 💡 **PR-Agent usage**:
>Comment `/help` on the PR to get a list of all available PR-Agent tools
and their descriptions

---------

Co-authored-by: Hassan Ben Jobrane <hsanbenjobrane@gmail.com>
2024-09-13 12:19:08 +02:00
David Barroso
9735fa238b chore (dashboard): remove broken link (#2868)
### **PR Type**
Enhancement, Documentation


___

### **Description**
- Removed a broken "Learn More" link from the DataBrowserSidebar
component in the dashboard
- Added a changeset file to document the removal of the broken link
- Introduced a new GitHub Actions workflow for AI-powered pull request
reviews
- The new workflow uses the PR Agent action with specific configurations
for OpenAI and Anthropic models
- Updated the project structure to improve documentation and automate
code review processes


___



### **Changes walkthrough** 📝
<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>DataBrowserSidebar.tsx</strong><dd><code>Remove "Learn
More" link from DataBrowserSidebar</code>&nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>


dashboard/src/features/database/dataGrid/components/DataBrowserSidebar/DataBrowserSidebar.tsx

<li>Removed a "Learn More" link with an arrow icon<br> <li> The link was
pointing to GitHub integration documentation<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2868/files#diff-6c0c7b86959eb51f0ef884074e8a72725ee505a5759ca4a95126e96f26062e3b">+0/-9</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>                    

<tr>
  <td>
    <details>
<summary><strong>gen_ai_review.yaml</strong><dd><code>Add AI-powered PR
review workflow</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

.github/workflows/gen_ai_review.yaml

<li>Added a new GitHub Actions workflow for AI-powered PR reviews<br>
<li> Configures the PR Agent action with specific settings and
secrets<br> <li> Sets up triggers for pull request events and issue
comments<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2868/files#diff-d1e4c772e0acb5ce4891df2dd94ba58ffaf6393e8f75493ec7e10cbce1c4992c">+28/-0</a>&nbsp;
&nbsp; </td>

</tr>                    
</table></td></tr><tr><td><strong>Documentation</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>tricky-colts-beg.md</strong><dd><code>Add changeset for
broken link removal</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

.changeset/tricky-colts-beg.md

<li>Added a new changeset file for @nhost/dashboard<br> <li> Describes
the change as removing a broken link<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2868/files#diff-6564a7547695ab3d9be88cc4977a814f3123f60b2bb10effeb8904997710a950">+5/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>                    
</table></td></tr></tr></tbody></table>

___

> 💡 **PR-Agent usage**:
>Comment `/help` on the PR to get a list of all available PR-Agent tools
and their descriptions

---------

Co-authored-by: Hassan Ben Jobrane <hsanbenjobrane@gmail.com>
2024-09-11 19:09:10 +02:00
109 changed files with 3230 additions and 1354 deletions

28
.github/workflows/gen_ai_review.yaml vendored Normal file
View File

@@ -0,0 +1,28 @@
---
name: "gen: AI review"
on:
pull_request:
types: [opened, reopened, ready_for_review]
issue_comment:
jobs:
pr_agent_job:
if: ${{ github.event.sender.type != 'Bot' }}
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
issues: write
pull-requests: write
contents: write
name: Run pr agent on every pull request, respond to user comments
steps:
- name: PR Agent action step
id: pragent
uses: Codium-ai/pr-agent@v0.24
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OPENAI_KEY: ${{ secrets.OPENAI_API_KEY }}
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
config.max_model_tokens: 100000
config.model: "anthropic/claude-3-5-sonnet-20240620"
config.model_turbo: "anthropic/claude-3-5-sonnet-20240620"
ignore.glob: "['pnpm-lock.yaml','**/pnpm-lock.yaml']"

View File

@@ -2,5 +2,5 @@
// $schema provides code completion hints to IDEs.
"$schema": "https://github.com/IBM/audit-ci/raw/main/docs/schema.json",
"moderate": true,
"allowlist": ["vue-template-compiler", "micromatch"]
"allowlist": ["vue-template-compiler", "micromatch", "path-to-regexp"]
}

View File

@@ -24,3 +24,4 @@ NEXT_PUBLIC_ZENDESK_USER_EMAIL=
CODEGEN_GRAPHQL_URL=https://local.graphql.nhost.run/v1
CODEGEN_HASURA_ADMIN_SECRET=nhost-admin-secret
NEXT_PUBLIC_TURNSTILE_SITE_KEY=FIXME

View File

@@ -1,5 +1,38 @@
# @nhost/dashboard
## 1.30.0
### Minor Changes
- 50441a8: feat: add ui for project autoscaler settings and run services autoscaler settings
## 1.29.0
### Minor Changes
- 55d8bb5: feat: integrate turnstile for signup verification
- 2a2e54c: fix: update docs url in run services form tooltip
- 18f942f: fix: display long error messages in error toast without overflow
### Patch Changes
- @nhost/react-apollo@13.0.0
- @nhost/nextjs@2.1.22
## 1.28.2
### Patch Changes
- 52a38fe: chore: update dependencies to address security vulnerabilities
- Updated dependencies [52a38fe]
- @nhost/nextjs@2.1.21
## 1.28.1
### Patch Changes
- 9735fa2: chore: remove broken link
## 1.28.0
### Minor Changes

View File

@@ -39,22 +39,6 @@ test('should create and delete a run service', async () => {
await page.getByPlaceholder(/service name/i).click();
await page.getByPlaceholder(/service name/i).fill('test');
const sliderRail = page.locator(
'.space-y-4 > .MuiSlider-root > .MuiSlider-rail',
);
// Get the bounding box of the slider rail to determine where to click
const box = await sliderRail.boundingBox();
if (box) {
// Calculate the position to click (start of the rail)
const x = box.x + 1; // A little offset to ensure click inside the rail
const y = box.y + box.height / 2; // Middle of the rail height-wise
// Perform the click
await page.mouse.click(x, y);
}
await page.getByRole('button', { name: /create/i }).click();
await expect(

View File

@@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />
// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information.

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/dashboard",
"version": "1.28.0",
"version": "1.30.0",
"private": true,
"scripts": {
"preinstall": "npx only-allow pnpm",
@@ -35,6 +35,7 @@
"@heroicons/react": "^1.0.6",
"@hookform/resolvers": "^3.3.4",
"@iarna/toml": "^2.2.5",
"@marsidev/react-turnstile": "^1.0.2",
"@mui/base": "5.0.0-beta.31",
"@mui/material": "^5.15.14",
"@mui/system": "^5.15.14",
@@ -65,7 +66,7 @@
"graphql-ws": "^5.16.0",
"just-kebab-case": "^4.2.0",
"lodash.debounce": "^4.0.8",
"next": "^14.1.4",
"next": "^14.2.10",
"next-seo": "^6.5.0",
"node-pg-format": "^1.3.5",
"pluralize": "^8.0.0",
@@ -165,7 +166,7 @@
"tailwindcss": "^3.4.3",
"ts-node": "^10.9.2",
"tsconfig-paths-webpack-plugin": "^4.1.0",
"vite": "^5.2.7",
"vite": "^5.4.6",
"vite-tsconfig-paths": "^4.3.2",
"vitest": "^0.32.4"
},

View File

@@ -112,18 +112,24 @@ export default function ErrorToast({
bounce: 0.1,
}}
>
<div className="flex w-full flex-row items-center justify-between space-x-4">
<button onClick={close} type="button" aria-label="Close">
<div className="flex w-full flex-row items-center justify-between gap-4">
<button
className="flex-shrink-0"
onClick={close}
type="button"
aria-label="Close"
>
<XIcon className="h-4 w-4 text-white" />
</button>
<span>
<span className="flex-grow overflow-hidden break-words">
{msg ?? 'An unkown error has occured, please try again later!'}
</span>
<button
type="button"
onClick={() => setShowInfo(!showInfo)}
className="flex flex-row items-center justify-center space-x-2 text-white"
className="flex flex-shrink-0 flex-row items-center justify-center space-x-2 text-white"
aria-label="Show error details"
>
<span>Info</span>
{showInfo ? (

View File

@@ -0,0 +1,45 @@
import type { IconProps } from '@/components/ui/v2/icons';
import { SvgIcon } from '@/components/ui/v2/icons/SvgIcon';
import type { ForwardedRef } from 'react';
import { forwardRef } from 'react';
function InfoOutlinedIcon(props: IconProps, ref: ForwardedRef<SVGSVGElement>) {
return (
<SvgIcon
width="24"
height="24"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
aria-label="Info"
stroke="currentColor"
ref={ref}
{...props}
>
<path
fill="none"
d="M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
fill="none"
d="M12 16V12"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
fill="none"
d="M12 8H12.01"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
/>
</SvgIcon>
);
}
InfoOutlinedIcon.displayName = 'NhostInfoOutlinedIcon';
export default forwardRef(InfoOutlinedIcon);

View File

@@ -0,0 +1 @@
export { default as InfoOutlinedIcon } from './InfoOutlinedIcon';

View File

@@ -12,7 +12,6 @@ import { Chip } from '@/components/ui/v2/Chip';
import { Divider } from '@/components/ui/v2/Divider';
import { Dropdown } from '@/components/ui/v2/Dropdown';
import { IconButton } from '@/components/ui/v2/IconButton';
import { ArrowRightIcon } from '@/components/ui/v2/icons/ArrowRightIcon';
import { DotsHorizontalIcon } from '@/components/ui/v2/icons/DotsHorizontalIcon';
import { LockIcon } from '@/components/ui/v2/icons/LockIcon';
import { PencilIcon } from '@/components/ui/v2/icons/PencilIcon';
@@ -20,7 +19,6 @@ import { PlusIcon } from '@/components/ui/v2/icons/PlusIcon';
import { TerminalIcon } from '@/components/ui/v2/icons/TerminalIcon';
import { TrashIcon } from '@/components/ui/v2/icons/TrashIcon';
import { UsersIcon } from '@/components/ui/v2/icons/UsersIcon';
import { Link } from '@/components/ui/v2/Link';
import { List } from '@/components/ui/v2/List';
import { ListItem } from '@/components/ui/v2/ListItem';
import { Option } from '@/components/ui/v2/Option';
@@ -312,15 +310,6 @@ function DataBrowserSidebarContent({
Your project is connected to GitHub. Please use the CLI to make
schema changes.
</Text>
<Link
href="https://docs.nhost.io/platform/github-integration"
target="_blank"
rel="noopener noreferrer"
underline="hover"
className="grid items-center justify-start grid-flow-col gap-1"
>
Learn More <ArrowRightIcon />
</Link>
</Box>
)}
{!isSelectedSchemaLocked && (

View File

@@ -14,6 +14,7 @@ import {
fireEvent,
render,
screen,
waitFor,
waitForElementToBeRemoved,
within,
} from '@/tests/testUtils';
@@ -78,7 +79,7 @@ test('should show the sliders if the switch is enabled', async () => {
await user.click(screen.getByRole('checkbox'));
expect(screen.queryByText(/enable this feature/i)).not.toBeInTheDocument();
expect(screen.getAllByRole('slider')).toHaveLength(12);
expect(screen.getAllByRole('slider')).toHaveLength(9);
});
test('should not show an empty state message if there is data available', async () => {
@@ -89,7 +90,7 @@ test('should not show an empty state message if there is data available', async
).toBeInTheDocument();
expect(screen.queryByText(/enable this feature/i)).not.toBeInTheDocument();
expect(screen.getAllByRole('slider')).toHaveLength(12);
expect(screen.getAllByRole('slider')).toHaveLength(9);
expect(screen.getByText(/^vcpus:/i)).toHaveTextContent(/vcpus: 8/i);
expect(screen.getByText(/^memory:/i)).toHaveTextContent(/memory: 16384 mib/i);
});
@@ -267,7 +268,7 @@ test('should display a red button when custom resources are disabled', async ()
await screen.findByRole('slider', { name: /total available vcpu/i }),
).toBeInTheDocument();
await user.click(screen.getByRole('checkbox'));
await user.click(screen.getAllByRole('checkbox')[0]);
expect(screen.getByText(/enable this feature/i)).toBeInTheDocument();
expect(screen.getByText(/approximate cost:/i)).toHaveTextContent(
@@ -297,7 +298,8 @@ test('should hide the pricing information when custom resource allocation is dis
await screen.findByRole('slider', { name: /total available vcpu/i }),
).toBeInTheDocument();
await user.click(screen.getByRole('checkbox'));
await user.click(screen.getAllByRole('checkbox')[0]);
await user.click(screen.getByRole('button', { name: /save/i }));
expect(await screen.findByRole('dialog')).toBeInTheDocument();
@@ -333,6 +335,8 @@ test('should show a warning message when resources are overallocated', async ()
});
test('should change pricing based on selected replicas', async () => {
const user = userEvent.setup();
render(<ResourcesForm />);
expect(
@@ -343,23 +347,31 @@ test('should change pricing based on selected replicas', async () => {
/approximate cost: \$425\.00\/mo/i,
);
changeSliderValue(
screen.getByRole('slider', { name: /hasura graphql replicas/i }),
2,
const hasuraReplicasInput = screen.getAllByPlaceholderText('Replicas')[0];
await user.click(hasuraReplicasInput);
await user.clear(hasuraReplicasInput);
await user.type(hasuraReplicasInput, '2');
await new Promise((resolve) => {
setTimeout(resolve, 1000);
});
await waitFor(() =>
expect(screen.getByText(/approximate cost:/i)).toHaveTextContent(
/approximate cost: \$525\.00\/mo/i,
),
);
expect(screen.getByText(/approximate cost:/i)).toHaveTextContent(
/approximate cost: \$525\.00\/mo/i,
);
await user.click(hasuraReplicasInput);
await user.clear(hasuraReplicasInput);
await user.type(hasuraReplicasInput, '1');
changeSliderValue(
screen.getByRole('slider', { name: /hasura graphql replicas/i }),
1,
);
expect(screen.getByText(/approximate cost:/i)).toHaveTextContent(
/approximate cost: \$425\.00\/mo/i,
);
await waitFor(() => {
expect(screen.getByText(/approximate cost:/i)).toHaveTextContent(
/approximate cost: \$425\.00\/mo/i,
);
});
});
test('should validate if vCPU and Memory match the 1:2 ratio if more than 1 replica is selected', async () => {
@@ -378,10 +390,10 @@ test('should validate if vCPU and Memory match the 1:2 ratio if more than 1 repl
20 * RESOURCE_VCPU_MULTIPLIER,
);
changeSliderValue(
screen.getByRole('slider', { name: /storage replicas/i }),
2,
);
const storageReplicasInput = screen.getAllByPlaceholderText('Replicas')[2];
await user.click(storageReplicasInput);
await user.clear(storageReplicasInput);
await user.type(storageReplicasInput, '2');
changeSliderValue(
screen.getByRole('slider', { name: /storage vcpu/i }),
@@ -402,12 +414,13 @@ test('should validate if vCPU and Memory match the 1:2 ratio if more than 1 repl
),
).toBeInTheDocument();
const validationErrorMessage = screen.getByLabelText(
/vcpu and memory for this service must match the 1:2 ratio if more than one replica is selected\./i,
);
expect(validationErrorMessage).toBeInTheDocument();
expect(validationErrorMessage).toHaveStyle({ color: '#f13154' });
await waitFor(() => {
const validationErrorMessage = screen.getByText(
/vCPU and Memory for this service must follow a 1:2 ratio when more than one replica is selected or when the autoscaler is activated\./i,
);
expect(validationErrorMessage).toBeInTheDocument();
expect(validationErrorMessage).toHaveStyle({ color: '#f13154' });
});
});
test('should take replicas into account when confirming the resources', async () => {
@@ -436,11 +449,11 @@ test('should take replicas into account when confirming the resources', async ()
4 * RESOURCE_MEMORY_MULTIPLIER,
);
// setting up hasura
changeSliderValue(
screen.getByRole('slider', { name: /hasura graphql replicas/i }),
3,
);
const hasuraReplicasInput = screen.getAllByPlaceholderText('Replicas')[0];
await user.click(hasuraReplicasInput);
await user.clear(hasuraReplicasInput);
await user.type(hasuraReplicasInput, '3');
changeSliderValue(
screen.getByRole('slider', { name: /hasura graphql vcpu/i }),
2.5 * RESOURCE_VCPU_MULTIPLIER,
@@ -450,8 +463,12 @@ test('should take replicas into account when confirming the resources', async ()
5 * RESOURCE_MEMORY_MULTIPLIER,
);
const authReplicasInput = screen.getAllByPlaceholderText('Replicas')[1];
// setting up auth
changeSliderValue(screen.getByRole('slider', { name: /auth replicas/i }), 2);
await user.click(authReplicasInput);
await user.clear(authReplicasInput);
await user.type(authReplicasInput, '2');
changeSliderValue(
screen.getByRole('slider', { name: /auth vcpu/i }),
1.5 * RESOURCE_VCPU_MULTIPLIER,
@@ -461,11 +478,12 @@ test('should take replicas into account when confirming the resources', async ()
3 * RESOURCE_MEMORY_MULTIPLIER,
);
const storageReplicasInput = screen.getAllByPlaceholderText('Replicas')[2];
// setting up storage
changeSliderValue(
screen.getByRole('slider', { name: /storage replicas/i }),
4,
);
await user.click(storageReplicasInput);
await user.clear(storageReplicasInput);
await user.type(storageReplicasInput, '4');
changeSliderValue(
screen.getByRole('slider', { name: /storage vcpu/i }),
2.5 * RESOURCE_VCPU_MULTIPLIER,

View File

@@ -37,12 +37,14 @@ function getInitialServiceResources(
data: GetResourcesQuery,
service: Exclude<keyof GetResourcesQuery['config'], '__typename'>,
) {
const { compute, replicas } = data?.config?.[service]?.resources || {};
const { compute, replicas, autoscaler } =
data?.config?.[service]?.resources || {};
return {
replicas,
vcpu: compute?.cpu || 0,
memory: compute?.memory || 0,
autoscale: autoscaler || null,
};
}
@@ -100,21 +102,29 @@ export default function ResourcesForm() {
replicas: initialDatabaseResources.replicas || 1,
vcpu: initialDatabaseResources.vcpu || 1000,
memory: initialDatabaseResources.memory || 2048,
autoscale: !!initialDatabaseResources.autoscale || false,
maxReplicas: initialDatabaseResources.autoscale?.maxReplicas || 10,
},
hasura: {
replicas: initialHasuraResources.replicas || 1,
vcpu: initialHasuraResources.vcpu || 500,
memory: initialHasuraResources.memory || 1536,
autoscale: !!initialHasuraResources.autoscale || false,
maxReplicas: initialHasuraResources.autoscale?.maxReplicas || 10,
},
auth: {
replicas: initialAuthResources.replicas || 1,
vcpu: initialAuthResources.vcpu || 250,
memory: initialAuthResources.memory || 256,
autoscale: !!initialAuthResources.autoscale || false,
maxReplicas: initialAuthResources.autoscale?.maxReplicas || 10,
},
storage: {
replicas: initialStorageResources.replicas || 1,
vcpu: initialStorageResources.vcpu || 250,
memory: initialStorageResources.memory || 256,
autoscale: !!initialStorageResources.autoscale || false,
maxReplicas: initialStorageResources.autoscale?.maxReplicas || 10,
},
},
resolver: yupResolver(resourceSettingsValidationSchema),
@@ -181,6 +191,11 @@ export default function ResourcesForm() {
memory: formValues.database.memory,
},
replicas: formValues.database.replicas,
autoscaler: formValues.database.autoscale
? {
maxReplicas: formValues.database.maxReplicas,
}
: null,
}
: null,
},
@@ -192,6 +207,11 @@ export default function ResourcesForm() {
memory: formValues.hasura.memory,
},
replicas: formValues.hasura.replicas,
autoscaler: formValues.hasura.autoscale
? {
maxReplicas: formValues.hasura.maxReplicas,
}
: null,
}
: null,
},
@@ -203,6 +223,11 @@ export default function ResourcesForm() {
memory: formValues.auth.memory,
},
replicas: formValues.auth.replicas,
autoscaler: formValues.auth.autoscale
? {
maxReplicas: formValues.auth.maxReplicas,
}
: null,
}
: null,
},
@@ -214,6 +239,11 @@ export default function ResourcesForm() {
memory: formValues.storage.memory,
},
replicas: formValues.storage.replicas,
autoscaler: formValues.storage.autoscale
? {
maxReplicas: formValues.storage.maxReplicas,
}
: null,
}
: null,
},
@@ -253,21 +283,29 @@ export default function ResourcesForm() {
totalAvailableMemory: 4096,
database: {
replicas: 1,
maxReplicas: 1,
autoscale: false,
vcpu: 1000,
memory: 2048,
},
hasura: {
replicas: 1,
maxReplicas: 1,
autoscale: false,
vcpu: 500,
memory: 1536,
},
auth: {
replicas: 1,
maxReplicas: 1,
autoscale: false,
vcpu: 250,
memory: 256,
},
storage: {
replicas: 1,
maxReplicas: 1,
autoscale: false,
vcpu: 250,
memory: 256,
},

View File

@@ -1,24 +1,30 @@
import { ControlledSwitch } from '@/components/form/ControlledSwitch';
import { Box } from '@/components/ui/v2/Box';
import { ExclamationIcon } from '@/components/ui/v2/icons/ExclamationIcon';
import { InfoOutlinedIcon } from '@/components/ui/v2/icons/InfoOutlinedIcon';
import { Input } from '@/components/ui/v2/Input';
import { Slider } from '@/components/ui/v2/Slider';
import { Text } from '@/components/ui/v2/Text';
import { Link } from '@/components/ui/v2/Link';
import { Tooltip } from '@/components/ui/v2/Tooltip';
import { prettifyMemory } from '@/features/projects/resources/settings/utils/prettifyMemory';
import { prettifyVCPU } from '@/features/projects/resources/settings/utils/prettifyVCPU';
import type { ResourceSettingsFormValues } from '@/features/projects/resources/settings/utils/resourceSettingsValidationSchema';
import { Alert } from '@/components/ui/v2/Alert';
import {
MAX_SERVICE_MEMORY,
MAX_SERVICE_REPLICAS,
MAX_SERVICE_VCPU,
MIN_SERVICE_MEMORY,
MIN_SERVICE_REPLICAS,
MIN_SERVICE_VCPU,
} from '@/features/projects/resources/settings/utils/resourceSettingsValidationSchema';
import {
RESOURCE_MEMORY_LOCKED_STEP,
RESOURCE_MEMORY_STEP,
RESOURCE_VCPU_STEP,
} from '@/utils/constants/common';
import debounce from 'lodash.debounce';
import { useFormContext, useWatch } from 'react-hook-form';
import { ArrowSquareOutIcon } from '@/components/ui/v2/icons/ArrowSquareOutIcon';
export interface ServiceResourcesFormFragmentProps {
/**
@@ -52,10 +58,14 @@ export default function ServiceResourcesFormFragment({
setValue,
trigger: triggerValidation,
formState,
register,
} = useFormContext<ResourceSettingsFormValues>();
const formValues = useWatch<ResourceSettingsFormValues>();
const serviceValues = formValues[serviceKey];
const isRatioLocked = serviceValues.replicas > 1 || serviceValues.autoscale;
const resourceMemoryStep = isRatioLocked ? RESOURCE_MEMORY_LOCKED_STEP : RESOURCE_MEMORY_STEP;
// Total allocated CPU for all resources
const totalAllocatedVCPU = Object.keys(formValues)
.filter(
@@ -83,15 +93,27 @@ export default function ServiceResourcesFormFragment({
formValues.totalAvailableMemory - totalAllocatedMemory;
const allowedMemory = remainingMemory + serviceValues.memory;
function handleReplicaChange(value: string) {
// Debounce revalidation to prevent excessive re-renders
const handleReplicaChange = debounce((value: string) => {
const updatedReplicas = parseInt(value, 10);
if (updatedReplicas < MIN_SERVICE_REPLICAS) {
return;
}
setValue(`${serviceKey}.replicas`, updatedReplicas, { shouldDirty: true });
triggerValidation(`${serviceKey}.replicas`);
triggerValidation(`${serviceKey}.replicas`)
triggerValidation(`${serviceKey}.memory`);
}, 500);
const handleMaxReplicasChange = debounce((value: string) => {
const updatedMaxReplicas = parseInt(value, 10);
setValue(`${serviceKey}.maxReplicas`, updatedMaxReplicas, {
shouldDirty: true,
});
triggerValidation(`${serviceKey}.maxReplicas`);
triggerValidation(`${serviceKey}.memory`);
}, 500);
const handleSwitchChange = () => {
triggerValidation(`${serviceKey}.memory`);
}
function handleVCPUChange(value: string) {
@@ -103,9 +125,13 @@ export default function ServiceResourcesFormFragment({
setValue(`${serviceKey}.vcpu`, updatedVCPU, { shouldDirty: true });
if (isRatioLocked) {
setValue(`${serviceKey}.memory`, updatedVCPU * 2.048, { shouldDirty: true });
}
// trigger validation for "replicas" field
if (!disableReplicas) {
triggerValidation(`${serviceKey}.replicas`);
triggerValidation(`${serviceKey}.memory`);
}
}
@@ -118,9 +144,13 @@ export default function ServiceResourcesFormFragment({
setValue(`${serviceKey}.memory`, updatedMemory, { shouldDirty: true });
if (isRatioLocked) {
setValue(`${serviceKey}.vcpu`, updatedMemory / 2.048, { shouldDirty: true });
}
// trigger validation for "replicas" field
if (!disableReplicas) {
triggerValidation(`${serviceKey}.replicas`);
triggerValidation(`${serviceKey}.memory`);
}
}
@@ -135,7 +165,7 @@ export default function ServiceResourcesFormFragment({
</Box>
<Box className="grid grid-flow-row gap-2">
<Box className="grid grid-flow-col items-center justify-between gap-2">
<Box className="grid items-center justify-between grid-flow-col gap-2">
<Text>
Allocated vCPUs:{' '}
<span className="font-medium">
@@ -165,7 +195,7 @@ export default function ServiceResourcesFormFragment({
</Box>
<Box className="grid grid-flow-row gap-2">
<Box className="grid grid-flow-col items-center justify-between gap-2">
<Box className="grid items-center justify-between grid-flow-col gap-2">
<Text>
Allocated Memory:{' '}
<span className="font-medium">
@@ -187,53 +217,112 @@ export default function ServiceResourcesFormFragment({
value={serviceValues.memory}
onChange={(_event, value) => handleMemoryChange(value.toString())}
max={MAX_SERVICE_MEMORY}
step={RESOURCE_MEMORY_STEP}
step={resourceMemoryStep}
allowed={allowedMemory}
aria-label={`${title} Memory`}
marks
/>
{formState.errors[serviceKey]?.memory?.message ? (
<Alert severity="error">
{formState.errors[serviceKey]?.memory?.message}
</Alert>
) : null}
</Box>
{!disableReplicas && (
<Box className="grid grid-flow-row gap-2">
<Box className="grid grid-flow-col items-center justify-start gap-2">
<Text
color={
formState.errors?.[serviceKey]?.replicas?.message
? 'error'
: 'primary'
}
aria-errormessage={`${serviceKey}-replicas-error-tooltip`}
>
Replicas:{' '}
<span className="font-medium">{serviceValues.replicas}</span>
</Text>
{formState.errors?.[serviceKey]?.replicas?.message ? (
<Tooltip
title={formState.errors[serviceKey].replicas.message}
id={`${serviceKey}-replicas-error-tooltip`}
>
<ExclamationIcon
color="error"
className="h-4 w-4"
aria-hidden="false"
/>
</Tooltip>
) : null}
<Box className="flex flex-col justify-between gap-4 lg:flex-row">
<Box className="flex flex-col gap-4 lg:flex-row lg:gap-8">
<Box className="flex flex-row items-center gap-2">
{formState.errors?.[serviceKey]?.replicas?.message ? (
<Tooltip
title={formState.errors[serviceKey]?.replicas?.message}
id={`${serviceKey}-replicas-error-tooltip`}
>
<ExclamationIcon
color="error"
className="w-4 h-4"
aria-hidden="false"
/>
</Tooltip>
) : null}
<Text className="w-28 lg:w-auto">Replicas</Text>
<Input
{...register(`${serviceKey}.replicas`)}
onChange={(event) => handleReplicaChange(event.target.value)}
type="number"
id={`${serviceKey}.replicas`}
data-testid={`${serviceKey}.replicas`}
placeholder="Replicas"
className="max-w-28"
hideEmptyHelperText
error={!!formState.errors?.[serviceKey]?.replicas}
fullWidth
autoComplete="off"
/>
</Box>
<Box className="flex flex-row items-center gap-2">
{formState.errors?.[serviceKey]?.maxReplicas?.message ? (
<Tooltip
title={formState.errors[serviceKey]?.maxReplicas?.message}
id={`${serviceKey}-maxReplicas-error-tooltip`}
>
<ExclamationIcon
color="error"
className="w-4 h-4"
aria-hidden="false"
/>
</Tooltip>
) : null}
<Text className="w-28 text-nowrap lg:w-auto">Max Replicas</Text>
<Input
{...register(`${serviceKey}.maxReplicas`)}
onChange={(event) =>
handleMaxReplicasChange(event.target.value)
}
type="number"
id={`${serviceKey}.maxReplicas`}
placeholder="10"
disabled={!formValues[serviceKey].autoscale}
className="max-w-28"
hideEmptyHelperText
error={!!formState.errors?.[serviceKey]?.maxReplicas}
fullWidth
autoComplete="off"
/>
</Box>
</Box>
<Box className="flex flex-row items-center gap-3">
<ControlledSwitch
{...register(`${serviceKey}.autoscale`)}
onChange={handleSwitchChange}
/>
<Text>Autoscaler</Text>
<Tooltip
title={`Enable autoscaler to automatically provision extra ${title} replicas when needed.`}
>
<InfoOutlinedIcon className="w-4 h-4 text-black" />
</Tooltip>
</Box>
<Slider
value={serviceValues.replicas}
onChange={(_event, value) => handleReplicaChange(value.toString())}
min={0}
max={MAX_SERVICE_REPLICAS}
step={1}
aria-label={`${title} Replicas`}
marks
/>
</Box>
)}
{
!disableReplicas && (
<Text>
Learn more about{' '}
<Link
href="https://docs.nhost.io/platform/service-replicas"
target="_blank"
rel="noopener noreferrer"
underline="hover"
className="font-medium"
>
Service Replicas
<ArrowSquareOutIcon className="w-4 h-4 ml-1" />
</Link>
</Text>
)
}
</Box>
);
}

View File

@@ -2,6 +2,7 @@ import { Alert } from '@/components/ui/v2/Alert';
import { Box } from '@/components/ui/v2/Box';
import { ArrowRightIcon } from '@/components/ui/v2/icons/ArrowRightIcon';
import { Slider, sliderClasses } from '@/components/ui/v2/Slider';
import { calculateBillableResources } from '@/features/projects/resources/settings/utils/calculateBillableResources';
import { Text } from '@/components/ui/v2/Text';
import { useIsPlatform } from '@/features/projects/common/hooks/useIsPlatform';
import { useProPlan } from '@/features/projects/common/hooks/useProPlan';
@@ -46,6 +47,7 @@ export default function TotalResourcesFormFragment({
error: proPlanError,
loading: proPlanLoading,
} = useProPlan();
const { setValue } = useFormContext<ResourceSettingsFormValues>();
const formValues = useWatch<ResourceSettingsFormValues>();
@@ -65,9 +67,38 @@ export default function TotalResourcesFormFragment({
(formValues.totalAvailableVCPU / RESOURCE_VCPU_MULTIPLIER) *
RESOURCE_VCPU_PRICE;
const updatedPrice = isPlatform
? priceForTotalAvailableVCPU + proPlan.price
: 0;
const billableResources = calculateBillableResources(
{
replicas: formValues.database?.replicas,
vcpu: formValues.database?.vcpu,
},
{
replicas: formValues.hasura?.replicas,
vcpu: formValues.hasura?.vcpu,
},
{
replicas: formValues.auth?.replicas,
vcpu: formValues.auth?.vcpu,
},
{
replicas: formValues.storage?.replicas,
vcpu: formValues.storage?.vcpu,
},
);
const computeUpdatedPrice = () => {
if (!isPlatform) {
return 0;
}
return (
Math.max(
priceForTotalAvailableVCPU,
(billableResources.vcpu / RESOURCE_VCPU_MULTIPLIER) *
RESOURCE_VCPU_PRICE,
) + proPlan.price
);
};
const { vcpu: allocatedVCPU, memory: allocatedMemory } =
getAllocatedResources(formValues);
@@ -114,14 +145,14 @@ export default function TotalResourcesFormFragment({
Total available compute for your project:
</Text>
{initialPrice !== updatedPrice && (
{initialPrice !== computeUpdatedPrice() && (
<Text className="flex flex-row items-center justify-end gap-2">
<Text component="span" color="secondary">
${initialPrice.toFixed(2)}/mo
</Text>
<ArrowRightIcon />
<Text component="span" className="font-medium">
${updatedPrice.toFixed(2)}/mo
${computeUpdatedPrice().toFixed(2)}/mo
</Text>
</Text>
)}

View File

@@ -6,6 +6,9 @@ fragment ServiceResources on ConfigConfig {
memory
}
replicas
autoscaler {
maxReplicas
}
}
}
hasura {
@@ -15,6 +18,9 @@ fragment ServiceResources on ConfigConfig {
memory
}
replicas
autoscaler {
maxReplicas
}
}
}
postgres {
@@ -24,6 +30,9 @@ fragment ServiceResources on ConfigConfig {
memory
}
replicas
autoscaler {
maxReplicas
}
}
}
storage {
@@ -33,6 +42,9 @@ fragment ServiceResources on ConfigConfig {
memory
}
replicas
autoscaler {
maxReplicas
}
}
}
}

View File

@@ -81,23 +81,13 @@ const serviceValidationSchema = Yup.object({
.label('Replicas')
.required()
.min(1)
.max(MAX_SERVICE_REPLICAS)
.test(
'is-matching-ratio',
`vCPU and Memory for this service must match the 1:${RESOURCE_VCPU_MEMORY_RATIO} ratio if more than one replica is selected.`,
(replicas: number, { parent }) => {
if (replicas === 1) {
return true;
}
return (
parent.memory /
RESOURCE_MEMORY_MULTIPLIER /
(parent.vcpu / RESOURCE_VCPU_MULTIPLIER) ===
RESOURCE_VCPU_MEMORY_RATIO
);
},
),
.max(MAX_SERVICE_REPLICAS),
maxReplicas: Yup.number()
.label('Max Replicas')
.required()
.min(MIN_SERVICE_REPLICAS)
.max(MAX_SERVICE_REPLICAS),
autoscale: Yup.boolean().label('Autoscale').required(),
vcpu: Yup.number()
.label('vCPUs')
.required()
@@ -106,7 +96,23 @@ const serviceValidationSchema = Yup.object({
memory: Yup.number()
.required()
.min(MIN_SERVICE_MEMORY)
.max(MAX_SERVICE_MEMORY),
.max(MAX_SERVICE_MEMORY)
.test(
'is-matching-ratio',
`vCPU and Memory for this service must follow a 1:${RESOURCE_VCPU_MEMORY_RATIO} ratio when more than one replica is selected or when the autoscaler is activated.`,
(memory: number, { parent }) => {
if (parent.replicas === 1 && !parent.autoscale) {
return true;
}
return (
memory /
RESOURCE_MEMORY_MULTIPLIER /
(parent.vcpu / RESOURCE_VCPU_MULTIPLIER) ===
RESOURCE_VCPU_MEMORY_RATIO
);
},
),
});
export const resourceSettingsValidationSchema = Yup.object({

View File

@@ -78,6 +78,7 @@ export default function ServiceForm({
memory: 128,
},
replicas: 1,
autoscaler: null,
},
reValidateMode: 'onSubmit',
resolver: yupResolver(validationSchema),
@@ -123,6 +124,11 @@ export default function ServiceForm({
capacity: item.capacity,
})),
replicas: sanitizedValues.replicas,
autoscaler: sanitizedValues.autoscaler
? {
maxReplicas: sanitizedValues.autoscaler?.maxReplicas,
}
: null,
},
environment: sanitizedValues.environment.map((item) => ({
name: item.name,
@@ -316,7 +322,7 @@ export default function ServiceForm({
<Tooltip title="Name of the service, must be unique per project.">
<InfoIcon
aria-label="Info"
className="h-4 w-4"
className="w-4 h-4"
color="primary"
/>
</Tooltip>
@@ -356,7 +362,7 @@ export default function ServiceForm({
>
<InfoIcon
aria-label="Info"
className="h-4 w-4"
className="w-4 h-4"
color="primary"
/>
</Tooltip>
@@ -387,7 +393,7 @@ export default function ServiceForm({
<Tooltip title="Command to run when to start the service. This is optional as the image may already have a baked-in command.">
<InfoIcon
aria-label="Info"
className="h-4 w-4"
className="w-4 h-4"
color="primary"
/>
</Tooltip>
@@ -435,7 +441,7 @@ export default function ServiceForm({
{createServiceFormError && (
<Alert
severity="error"
className="grid grid-flow-col items-center justify-between px-4 py-3"
className="grid items-center justify-between grid-flow-col px-4 py-3"
>
<span className="text-left">
<strong>Error:</strong> {createServiceFormError.message}

View File

@@ -25,6 +25,12 @@ export const validationSchema = Yup.object({
memory: Yup.number().min(MIN_SERVICES_MEM).max(MAX_SERVICES_MEM).required(),
}),
replicas: Yup.number().min(0).max(MAX_SERVICE_REPLICAS).required(),
autoscaler: Yup.object()
.shape({
maxReplicas: Yup.number().min(0).max(MAX_SERVICE_REPLICAS),
})
.nullable()
.default(undefined),
ports: Yup.array().of(
Yup.object().shape({
port: Yup.number().required(),

View File

@@ -70,7 +70,7 @@ export default function ComputeFormSection({
<a
target="_blank"
rel="noopener noreferrer"
href="https://docs.nhost.io/run/resources"
href="https://docs.nhost.io/guides/run/resources"
className="underline"
>
resources

View File

@@ -38,7 +38,8 @@ export default function PortsFormSection() {
const showURL = (index: number) =>
formValues.subdomain &&
formValues.ports[index]?.type === PortTypes.HTTP &&
(formValues.ports[index]?.type === PortTypes.HTTP ||
formValues.ports[index]?.type === PortTypes.GRPC) &&
formValues.ports[index]?.publish;
return (
@@ -106,7 +107,7 @@ export default function PortsFormSection() {
},
}}
>
{['http', 'tcp', 'udp']?.map((portType) => (
{['http', 'tcp', 'udp', 'grpc']?.map((portType) => (
<Option key={portType} value={portType}>
{portType}
</Option>

View File

@@ -2,4 +2,5 @@ export enum PortTypes {
HTTP = 'http',
TCP = 'tcp',
UDP = 'udp',
GRPC = 'grpc',
}

View File

@@ -1,16 +1,32 @@
import { Box } from '@/components/ui/v2/Box';
import { InfoIcon } from '@/components/ui/v2/icons/InfoIcon';
import { Slider } from '@/components/ui/v2/Slider';
import { InfoOutlinedIcon } from '@/components/ui/v2/icons/InfoOutlinedIcon';
import { Input } from '@/components/ui/v2/Input';
import { Switch } from '@/components/ui/v2/Switch';
import { Text } from '@/components/ui/v2/Text';
import { Tooltip } from '@/components/ui/v2/Tooltip';
import { MAX_SERVICE_REPLICAS } from '@/features/projects/resources/settings/utils/resourceSettingsValidationSchema';
import type { ServiceFormValues } from '@/features/services/components/ServiceForm/ServiceFormTypes';
import { useState } from 'react';
import { useFormContext, useWatch } from 'react-hook-form';
export default function ReplicasFormSection() {
const { setValue } = useFormContext<ServiceFormValues>();
const {
register,
setValue,
trigger: triggerValidation,
} = useFormContext<ServiceFormValues>();
const { replicas, autoscaler } = useWatch<ServiceFormValues>();
const [autoscalerEnabled, setAutoscalerEnabled] = useState(!!autoscaler);
const { replicas } = useWatch<ServiceFormValues>();
const toggleAutoscalerEnabled = async (enabled: boolean) => {
setAutoscalerEnabled(enabled);
if (!enabled) {
setValue('autoscaler', null);
} else {
setValue('autoscaler.maxReplicas', 10);
}
};
const handleReplicasChange = (value: string) => {
const updatedReplicas = parseInt(value, 10);
@@ -20,42 +36,85 @@ export default function ReplicasFormSection() {
// TODO Trigger revalidate storage
};
const handleMaxReplicasChange = (value: string) => {
const updatedReplicas = parseInt(value, 10);
setValue('autoscaler.maxReplicas', updatedReplicas, { shouldDirty: true });
triggerValidation('autoscaler.maxReplicas');
};
return (
<Box className="space-y-4 rounded border-1 p-4">
<Box className="p-4 space-y-4 rounded border-1">
<Box className="flex flex-row items-center space-x-2">
<Text variant="h4" className="font-semibold">
Replicas ({replicas})
</Text>
<Tooltip
title={
<span>
Number of replicas for the service. Multiple replicas can process
requests/work in parallel. You can set replicas to 0 to pause the
service. Refer to{' '}
<Text className="text-white">
Learn more about{' '}
<a
target="_blank"
rel="noopener noreferrer"
href="https://docs.nhost.io/run/resources"
href="https://docs.nhost.io/platform/service-replicas"
className="underline"
>
resources
</a>{' '}
for more information.
</span>
Service Replicas
</a>
</Text>
}
>
<InfoIcon aria-label="Info" className="h-4 w-4" color="primary" />
<InfoIcon aria-label="Info" className="w-4 h-4" color="primary" />
</Tooltip>
</Box>
<Slider
value={replicas}
onChange={(_event, value) => handleReplicasChange(value.toString())}
min={0}
max={MAX_SERVICE_REPLICAS}
step={1}
aria-label="Replicas"
marks
/>
<Box className="flex flex-col justify-between gap-4 lg:flex-row">
<Box className="flex flex-col gap-4 lg:flex-row lg:gap-8">
<Box className="flex flex-row items-center gap-2">
<Text className="w-28 lg:w-auto">Replicas</Text>
<Input
{...register('replicas')}
onChange={(event) => handleReplicasChange(event.target.value)}
type="number"
id="replicas"
placeholder="Replicas"
className="max-w-28"
hideEmptyHelperText
fullWidth
onWheel={(e) => (e.target as HTMLInputElement).blur()}
autoComplete="off"
/>
</Box>
<Box className="flex flex-row items-center gap-2">
<Text className="w-28 text-nowrap lg:w-auto">Max Replicas</Text>
<Input
value={autoscaler?.maxReplicas}
onChange={(event) => handleMaxReplicasChange(event.target.value)}
type="number"
id="maxReplicas"
placeholder="10"
disabled={!autoscalerEnabled}
className="max-w-28"
hideEmptyHelperText
fullWidth
onWheel={(e) => (e.target as HTMLInputElement).blur()}
autoComplete="off"
/>
</Box>
</Box>
<Box className="flex flex-row items-center gap-3">
<Switch
checked={autoscalerEnabled}
onChange={(e) => toggleAutoscalerEnabled(e.target.checked)}
className="self-center"
/>
<Text>Autoscaler</Text>
<Tooltip title="Enable autoscaler to automatically provision extra run service replicas when needed.">
<InfoOutlinedIcon className="w-4 h-4 text-black" />
</Tooltip>
</Box>
</Box>
</Box>
);
}

View File

@@ -73,6 +73,7 @@ export default function ServicesList({
cpu: 62,
memory: 128,
},
autoscaler: service?.config?.resources?.autoscaler,
replicas: service.config?.resources?.replicas,
storage: service.config?.resources?.storage,
}}
@@ -197,4 +198,4 @@ export default function ServicesList({
))}
</Box>
);
}
}

View File

@@ -19,6 +19,9 @@ query getRunService($id: uuid!, $resolve: Boolean!) {
capacity
}
replicas
autoscaler {
maxReplicas
}
}
environment {
name

View File

@@ -15,6 +15,9 @@ fragment RunServiceConfig on ConfigRunServiceConfig {
capacity
}
replicas
autoscaler {
maxReplicas
}
}
environment {
name

View File

@@ -48,7 +48,7 @@ export default function ServicesPage() {
openDrawer({
title: (
<Box className="flex flex-row items-center space-x-2">
<CubeIcon className="h-5 w-5" />
<CubeIcon className="w-5 h-5" />
<Text>Create a new run service</Text>
</Box>
),
@@ -60,6 +60,7 @@ export default function ServicesPage() {
cpu: 62,
memory: 128,
},
autoscaler: parsedConfig?.resources?.autoscaler,
image: parsedConfig?.image?.image,
command: parsedConfig?.command?.join(' '),
ports: parsedConfig?.ports.map((item) => ({
@@ -104,7 +105,7 @@ export default function ServicesPage() {
openDrawer({
title: (
<Box className="flex flex-row items-center space-x-2">
<CubeIcon className="h-5 w-5" />
<CubeIcon className="w-5 h-5" />
<Text>Create a new service</Text>
</Box>
),
@@ -125,23 +126,23 @@ export default function ServicesPage() {
if (services.length === 0 && !loading) {
return (
<Container className="mx-auto max-w-9xl space-y-5 overflow-x-hidden">
<Container className="mx-auto space-y-5 overflow-x-hidden max-w-9xl">
<div className="flex flex-row place-content-end">
<Button
variant="contained"
color="primary"
onClick={openCreateServiceDialog}
startIcon={<PlusIcon className="h-4 w-4" />}
startIcon={<PlusIcon className="w-4 h-4" />}
disabled={!isPlatform}
>
Add service
</Button>
</div>
<Box className="flex flex-col items-center justify-center space-y-5 rounded-lg border px-48 py-12 shadow-sm">
<ServicesIcon className="h-10 w-10" />
<Box className="flex flex-col items-center justify-center px-48 py-12 space-y-5 border rounded-lg shadow-sm">
<ServicesIcon className="w-10 h-10" />
<div className="flex flex-col space-y-1">
<Text className="text-center font-medium" variant="h3">
<Text className="font-medium text-center" variant="h3">
No custom services are available
</Text>
<Text variant="subtitle1" className="text-center">
@@ -149,13 +150,13 @@ export default function ServicesPage() {
</Text>
</div>
{isPlatform ? (
<div className="flex flex-row place-content-between rounded-lg ">
<div className="flex flex-row rounded-lg place-content-between ">
<Button
variant="contained"
color="primary"
className="w-full"
onClick={openCreateServiceDialog}
startIcon={<PlusIcon className="h-4 w-4" />}
startIcon={<PlusIcon className="w-4 h-4" />}
>
Add service
</Button>
@@ -168,12 +169,12 @@ export default function ServicesPage() {
return (
<div className="flex flex-col">
<Box className="flex flex-row place-content-end border-b-1 p-4">
<Box className="flex flex-row p-4 place-content-end border-b-1">
<Button
variant="contained"
color="primary"
onClick={openCreateServiceDialog}
startIcon={<PlusIcon className="h-4 w-4" />}
startIcon={<PlusIcon className="w-4 h-4" />}
disabled={!isPlatform}
>
Add service

View File

@@ -10,6 +10,7 @@ import { Text } from '@/components/ui/v2/Text';
import { getToastStyleProps } from '@/utils/constants/settings';
import { nhost } from '@/utils/nhost';
import { yupResolver } from '@hookform/resolvers/yup';
import { Turnstile } from '@marsidev/react-turnstile';
import { styled } from '@mui/material';
import { useSignUpEmailPassword } from '@nhost/nextjs';
import { useRouter } from 'next/router';
@@ -39,6 +40,9 @@ export default function SignUpPage() {
const [loading, setLoading] = useState(false);
const router = useRouter();
// x-cf-turnstile-response
const [turnstileResponse, setTurnstileResponse] = useState(null);
const form = useForm<SignUpFormValues>({
reValidateMode: 'onSubmit',
defaultValues: {
@@ -66,11 +70,27 @@ export default function SignUpPage() {
password,
displayName,
}: SignUpFormValues) {
if (!turnstileResponse) {
toast.error(
'Please complete the signup verification challenge to continue.',
getToastStyleProps(),
);
return;
}
try {
const { needsEmailVerification } = await signUpEmailPassword(
email,
password,
{ displayName },
{
displayName,
},
{
headers: {
'x-cf-turnstile-response': turnstileResponse,
},
},
);
if (needsEmailVerification) {
@@ -94,7 +114,7 @@ export default function SignUpPage() {
Sign Up
</Text>
<Box className="grid grid-flow-row gap-4 rounded-md border bg-transparent p-6 lg:p-12">
<Box className="grid grid-flow-row gap-4 p-6 bg-transparent border rounded-md lg:p-12">
<Button
variant="borderless"
className="!bg-white !text-black hover:ring-2 hover:ring-white hover:ring-opacity-50 disabled:!text-black disabled:!text-opacity-60"
@@ -122,7 +142,7 @@ export default function SignUpPage() {
<div className="relative py-2">
<Text
className="absolute left-0 right-0 top-1/2 mx-auto w-12 -translate-y-1/2 bg-black px-2 text-center text-sm"
className="absolute left-0 right-0 w-12 px-2 mx-auto text-sm text-center -translate-y-1/2 bg-black top-1/2"
color="disabled"
>
OR
@@ -172,6 +192,12 @@ export default function SignUpPage() {
helperText={formState.errors.password?.message}
/>
<Turnstile
siteKey={process.env.NEXT_PUBLIC_TURNSTILE_SITE_KEY}
options={{ theme: 'dark', size: 'flexible' }}
onSuccess={setTurnstileResponse}
/>
<Button
variant="outlined"
color="secondary"
@@ -188,7 +214,7 @@ export default function SignUpPage() {
<Divider className="!my-2" />
<Text color="secondary" className="text-center text-sm">
<Text color="secondary" className="text-sm text-center">
By signing up, you agree to our{' '}
<NavLink
href="https://nhost.io/legal/terms-of-service"
@@ -212,7 +238,7 @@ export default function SignUpPage() {
</Text>
</Box>
<Text color="secondary" className="text-center text-base lg:text-lg">
<Text color="secondary" className="text-base text-center lg:text-lg">
Already have an account?{' '}
<NavLink href="/signin" color="white" className="font-medium">
Sign In

View File

@@ -1412,6 +1412,29 @@ export type ConfigGlobalUpdateInput = {
export type ConfigGrafana = {
__typename?: 'ConfigGrafana';
adminPassword: Scalars['String'];
alerting?: Maybe<ConfigGrafanaAlerting>;
contacts?: Maybe<ConfigGrafanaContacts>;
smtp?: Maybe<ConfigGrafanaSmtp>;
};
export type ConfigGrafanaAlerting = {
__typename?: 'ConfigGrafanaAlerting';
enabled?: Maybe<Scalars['Boolean']>;
};
export type ConfigGrafanaAlertingComparisonExp = {
_and?: InputMaybe<Array<ConfigGrafanaAlertingComparisonExp>>;
_not?: InputMaybe<ConfigGrafanaAlertingComparisonExp>;
_or?: InputMaybe<Array<ConfigGrafanaAlertingComparisonExp>>;
enabled?: InputMaybe<ConfigBooleanComparisonExp>;
};
export type ConfigGrafanaAlertingInsertInput = {
enabled?: InputMaybe<Scalars['Boolean']>;
};
export type ConfigGrafanaAlertingUpdateInput = {
enabled?: InputMaybe<Scalars['Boolean']>;
};
export type ConfigGrafanaComparisonExp = {
@@ -1419,14 +1442,255 @@ export type ConfigGrafanaComparisonExp = {
_not?: InputMaybe<ConfigGrafanaComparisonExp>;
_or?: InputMaybe<Array<ConfigGrafanaComparisonExp>>;
adminPassword?: InputMaybe<ConfigStringComparisonExp>;
alerting?: InputMaybe<ConfigGrafanaAlertingComparisonExp>;
contacts?: InputMaybe<ConfigGrafanaContactsComparisonExp>;
smtp?: InputMaybe<ConfigGrafanaSmtpComparisonExp>;
};
export type ConfigGrafanaContacts = {
__typename?: 'ConfigGrafanaContacts';
discord?: Maybe<Array<ConfigGrafanacontactsDiscord>>;
emails?: Maybe<Array<Scalars['String']>>;
pagerduty?: Maybe<Array<ConfigGrafanacontactsPagerduty>>;
slack?: Maybe<Array<ConfigGrafanacontactsSlack>>;
webhook?: Maybe<Array<ConfigGrafanacontactsWebhook>>;
};
export type ConfigGrafanaContactsComparisonExp = {
_and?: InputMaybe<Array<ConfigGrafanaContactsComparisonExp>>;
_not?: InputMaybe<ConfigGrafanaContactsComparisonExp>;
_or?: InputMaybe<Array<ConfigGrafanaContactsComparisonExp>>;
discord?: InputMaybe<ConfigGrafanacontactsDiscordComparisonExp>;
emails?: InputMaybe<ConfigStringComparisonExp>;
pagerduty?: InputMaybe<ConfigGrafanacontactsPagerdutyComparisonExp>;
slack?: InputMaybe<ConfigGrafanacontactsSlackComparisonExp>;
webhook?: InputMaybe<ConfigGrafanacontactsWebhookComparisonExp>;
};
export type ConfigGrafanaContactsInsertInput = {
discord?: InputMaybe<Array<ConfigGrafanacontactsDiscordInsertInput>>;
emails?: InputMaybe<Array<Scalars['String']>>;
pagerduty?: InputMaybe<Array<ConfigGrafanacontactsPagerdutyInsertInput>>;
slack?: InputMaybe<Array<ConfigGrafanacontactsSlackInsertInput>>;
webhook?: InputMaybe<Array<ConfigGrafanacontactsWebhookInsertInput>>;
};
export type ConfigGrafanaContactsUpdateInput = {
discord?: InputMaybe<Array<ConfigGrafanacontactsDiscordUpdateInput>>;
emails?: InputMaybe<Array<Scalars['String']>>;
pagerduty?: InputMaybe<Array<ConfigGrafanacontactsPagerdutyUpdateInput>>;
slack?: InputMaybe<Array<ConfigGrafanacontactsSlackUpdateInput>>;
webhook?: InputMaybe<Array<ConfigGrafanacontactsWebhookUpdateInput>>;
};
export type ConfigGrafanaInsertInput = {
adminPassword: Scalars['String'];
alerting?: InputMaybe<ConfigGrafanaAlertingInsertInput>;
contacts?: InputMaybe<ConfigGrafanaContactsInsertInput>;
smtp?: InputMaybe<ConfigGrafanaSmtpInsertInput>;
};
export type ConfigGrafanaSmtp = {
__typename?: 'ConfigGrafanaSmtp';
host: Scalars['String'];
password: Scalars['String'];
port: Scalars['ConfigPort'];
sender: Scalars['String'];
user: Scalars['String'];
};
export type ConfigGrafanaSmtpComparisonExp = {
_and?: InputMaybe<Array<ConfigGrafanaSmtpComparisonExp>>;
_not?: InputMaybe<ConfigGrafanaSmtpComparisonExp>;
_or?: InputMaybe<Array<ConfigGrafanaSmtpComparisonExp>>;
host?: InputMaybe<ConfigStringComparisonExp>;
password?: InputMaybe<ConfigStringComparisonExp>;
port?: InputMaybe<ConfigPortComparisonExp>;
sender?: InputMaybe<ConfigStringComparisonExp>;
user?: InputMaybe<ConfigStringComparisonExp>;
};
export type ConfigGrafanaSmtpInsertInput = {
host: Scalars['String'];
password: Scalars['String'];
port: Scalars['ConfigPort'];
sender: Scalars['String'];
user: Scalars['String'];
};
export type ConfigGrafanaSmtpUpdateInput = {
host?: InputMaybe<Scalars['String']>;
password?: InputMaybe<Scalars['String']>;
port?: InputMaybe<Scalars['ConfigPort']>;
sender?: InputMaybe<Scalars['String']>;
user?: InputMaybe<Scalars['String']>;
};
export type ConfigGrafanaUpdateInput = {
adminPassword?: InputMaybe<Scalars['String']>;
alerting?: InputMaybe<ConfigGrafanaAlertingUpdateInput>;
contacts?: InputMaybe<ConfigGrafanaContactsUpdateInput>;
smtp?: InputMaybe<ConfigGrafanaSmtpUpdateInput>;
};
export type ConfigGrafanacontactsDiscord = {
__typename?: 'ConfigGrafanacontactsDiscord';
avatarUrl: Scalars['String'];
url: Scalars['String'];
};
export type ConfigGrafanacontactsDiscordComparisonExp = {
_and?: InputMaybe<Array<ConfigGrafanacontactsDiscordComparisonExp>>;
_not?: InputMaybe<ConfigGrafanacontactsDiscordComparisonExp>;
_or?: InputMaybe<Array<ConfigGrafanacontactsDiscordComparisonExp>>;
avatarUrl?: InputMaybe<ConfigStringComparisonExp>;
url?: InputMaybe<ConfigStringComparisonExp>;
};
export type ConfigGrafanacontactsDiscordInsertInput = {
avatarUrl: Scalars['String'];
url: Scalars['String'];
};
export type ConfigGrafanacontactsDiscordUpdateInput = {
avatarUrl?: InputMaybe<Scalars['String']>;
url?: InputMaybe<Scalars['String']>;
};
export type ConfigGrafanacontactsPagerduty = {
__typename?: 'ConfigGrafanacontactsPagerduty';
class: Scalars['String'];
component: Scalars['String'];
group: Scalars['String'];
integrationKey: Scalars['String'];
severity: Scalars['String'];
};
export type ConfigGrafanacontactsPagerdutyComparisonExp = {
_and?: InputMaybe<Array<ConfigGrafanacontactsPagerdutyComparisonExp>>;
_not?: InputMaybe<ConfigGrafanacontactsPagerdutyComparisonExp>;
_or?: InputMaybe<Array<ConfigGrafanacontactsPagerdutyComparisonExp>>;
class?: InputMaybe<ConfigStringComparisonExp>;
component?: InputMaybe<ConfigStringComparisonExp>;
group?: InputMaybe<ConfigStringComparisonExp>;
integrationKey?: InputMaybe<ConfigStringComparisonExp>;
severity?: InputMaybe<ConfigStringComparisonExp>;
};
export type ConfigGrafanacontactsPagerdutyInsertInput = {
class: Scalars['String'];
component: Scalars['String'];
group: Scalars['String'];
integrationKey: Scalars['String'];
severity: Scalars['String'];
};
export type ConfigGrafanacontactsPagerdutyUpdateInput = {
class?: InputMaybe<Scalars['String']>;
component?: InputMaybe<Scalars['String']>;
group?: InputMaybe<Scalars['String']>;
integrationKey?: InputMaybe<Scalars['String']>;
severity?: InputMaybe<Scalars['String']>;
};
export type ConfigGrafanacontactsSlack = {
__typename?: 'ConfigGrafanacontactsSlack';
endpointURL: Scalars['String'];
iconEmoji: Scalars['String'];
iconURL: Scalars['String'];
mentionChannel: Scalars['String'];
mentionGroups: Array<Scalars['String']>;
mentionUsers: Array<Scalars['String']>;
recipient: Scalars['String'];
token: Scalars['String'];
url: Scalars['String'];
username: Scalars['String'];
};
export type ConfigGrafanacontactsSlackComparisonExp = {
_and?: InputMaybe<Array<ConfigGrafanacontactsSlackComparisonExp>>;
_not?: InputMaybe<ConfigGrafanacontactsSlackComparisonExp>;
_or?: InputMaybe<Array<ConfigGrafanacontactsSlackComparisonExp>>;
endpointURL?: InputMaybe<ConfigStringComparisonExp>;
iconEmoji?: InputMaybe<ConfigStringComparisonExp>;
iconURL?: InputMaybe<ConfigStringComparisonExp>;
mentionChannel?: InputMaybe<ConfigStringComparisonExp>;
mentionGroups?: InputMaybe<ConfigStringComparisonExp>;
mentionUsers?: InputMaybe<ConfigStringComparisonExp>;
recipient?: InputMaybe<ConfigStringComparisonExp>;
token?: InputMaybe<ConfigStringComparisonExp>;
url?: InputMaybe<ConfigStringComparisonExp>;
username?: InputMaybe<ConfigStringComparisonExp>;
};
export type ConfigGrafanacontactsSlackInsertInput = {
endpointURL: Scalars['String'];
iconEmoji: Scalars['String'];
iconURL: Scalars['String'];
mentionChannel: Scalars['String'];
mentionGroups: Array<Scalars['String']>;
mentionUsers: Array<Scalars['String']>;
recipient: Scalars['String'];
token: Scalars['String'];
url: Scalars['String'];
username: Scalars['String'];
};
export type ConfigGrafanacontactsSlackUpdateInput = {
endpointURL?: InputMaybe<Scalars['String']>;
iconEmoji?: InputMaybe<Scalars['String']>;
iconURL?: InputMaybe<Scalars['String']>;
mentionChannel?: InputMaybe<Scalars['String']>;
mentionGroups?: InputMaybe<Array<Scalars['String']>>;
mentionUsers?: InputMaybe<Array<Scalars['String']>>;
recipient?: InputMaybe<Scalars['String']>;
token?: InputMaybe<Scalars['String']>;
url?: InputMaybe<Scalars['String']>;
username?: InputMaybe<Scalars['String']>;
};
export type ConfigGrafanacontactsWebhook = {
__typename?: 'ConfigGrafanacontactsWebhook';
authorizationCredentials: Scalars['String'];
authorizationScheme: Scalars['String'];
httpMethod: Scalars['String'];
maxAlerts: Scalars['Int'];
password: Scalars['String'];
url: Scalars['String'];
username: Scalars['String'];
};
export type ConfigGrafanacontactsWebhookComparisonExp = {
_and?: InputMaybe<Array<ConfigGrafanacontactsWebhookComparisonExp>>;
_not?: InputMaybe<ConfigGrafanacontactsWebhookComparisonExp>;
_or?: InputMaybe<Array<ConfigGrafanacontactsWebhookComparisonExp>>;
authorizationCredentials?: InputMaybe<ConfigStringComparisonExp>;
authorizationScheme?: InputMaybe<ConfigStringComparisonExp>;
httpMethod?: InputMaybe<ConfigStringComparisonExp>;
maxAlerts?: InputMaybe<ConfigIntComparisonExp>;
password?: InputMaybe<ConfigStringComparisonExp>;
url?: InputMaybe<ConfigStringComparisonExp>;
username?: InputMaybe<ConfigStringComparisonExp>;
};
export type ConfigGrafanacontactsWebhookInsertInput = {
authorizationCredentials: Scalars['String'];
authorizationScheme: Scalars['String'];
httpMethod: Scalars['String'];
maxAlerts: Scalars['Int'];
password: Scalars['String'];
url: Scalars['String'];
username: Scalars['String'];
};
export type ConfigGrafanacontactsWebhookUpdateInput = {
authorizationCredentials?: InputMaybe<Scalars['String']>;
authorizationScheme?: InputMaybe<Scalars['String']>;
httpMethod?: InputMaybe<Scalars['String']>;
maxAlerts?: InputMaybe<Scalars['Int']>;
password?: InputMaybe<Scalars['String']>;
url?: InputMaybe<Scalars['String']>;
username?: InputMaybe<Scalars['String']>;
};
export type ConfigGraphql = {
@@ -1625,6 +1889,8 @@ export type ConfigHasuraSettings = {
enableRemoteSchemaPermissions?: Maybe<Scalars['Boolean']>;
/** HASURA_GRAPHQL_ENABLED_APIS */
enabledAPIs?: Maybe<Array<Scalars['ConfigHasuraAPIs']>>;
/** HASURA_GRAPHQL_INFER_FUNCTION_PERMISSIONS */
inferFunctionPermissions?: Maybe<Scalars['Boolean']>;
/** HASURA_GRAPHQL_LIVE_QUERIES_MULTIPLEXED_REFETCH_INTERVAL */
liveQueriesMultiplexedRefetchInterval?: Maybe<Scalars['ConfigUint32']>;
/** HASURA_GRAPHQL_STRINGIFY_NUMERIC_TYPES */
@@ -1641,6 +1907,7 @@ export type ConfigHasuraSettingsComparisonExp = {
enableConsole?: InputMaybe<ConfigBooleanComparisonExp>;
enableRemoteSchemaPermissions?: InputMaybe<ConfigBooleanComparisonExp>;
enabledAPIs?: InputMaybe<ConfigHasuraApIsComparisonExp>;
inferFunctionPermissions?: InputMaybe<ConfigBooleanComparisonExp>;
liveQueriesMultiplexedRefetchInterval?: InputMaybe<ConfigUint32ComparisonExp>;
stringifyNumericTypes?: InputMaybe<ConfigBooleanComparisonExp>;
};
@@ -1652,6 +1919,7 @@ export type ConfigHasuraSettingsInsertInput = {
enableConsole?: InputMaybe<Scalars['Boolean']>;
enableRemoteSchemaPermissions?: InputMaybe<Scalars['Boolean']>;
enabledAPIs?: InputMaybe<Array<Scalars['ConfigHasuraAPIs']>>;
inferFunctionPermissions?: InputMaybe<Scalars['Boolean']>;
liveQueriesMultiplexedRefetchInterval?: InputMaybe<Scalars['ConfigUint32']>;
stringifyNumericTypes?: InputMaybe<Scalars['Boolean']>;
};
@@ -1663,6 +1931,7 @@ export type ConfigHasuraSettingsUpdateInput = {
enableConsole?: InputMaybe<Scalars['Boolean']>;
enableRemoteSchemaPermissions?: InputMaybe<Scalars['Boolean']>;
enabledAPIs?: InputMaybe<Array<Scalars['ConfigHasuraAPIs']>>;
inferFunctionPermissions?: InputMaybe<Scalars['Boolean']>;
liveQueriesMultiplexedRefetchInterval?: InputMaybe<Scalars['ConfigUint32']>;
stringifyNumericTypes?: InputMaybe<Scalars['Boolean']>;
};
@@ -22956,14 +23225,14 @@ export type GetBackupPresignedUrlQueryVariables = Exact<{
export type GetBackupPresignedUrlQuery = { __typename?: 'query_root', getBackupPresignedUrl: { __typename?: 'BackupPresignedURL', url: string, expiresAt: any } };
export type ServiceResourcesFragment = { __typename?: 'ConfigConfig', auth?: { __typename?: 'ConfigAuth', resources?: { __typename?: 'ConfigResources', replicas?: any | null, compute?: { __typename?: 'ConfigResourcesCompute', cpu: any, memory: any } | null } | null } | null, hasura: { __typename?: 'ConfigHasura', resources?: { __typename?: 'ConfigResources', replicas?: any | null, compute?: { __typename?: 'ConfigResourcesCompute', cpu: any, memory: any } | null } | null }, postgres?: { __typename?: 'ConfigPostgres', resources?: { __typename?: 'ConfigPostgresResources', replicas?: any | null, compute?: { __typename?: 'ConfigResourcesCompute', cpu: any, memory: any } | null } | null } | null, storage?: { __typename?: 'ConfigStorage', resources?: { __typename?: 'ConfigResources', replicas?: any | null, compute?: { __typename?: 'ConfigResourcesCompute', cpu: any, memory: any } | null } | null } | null };
export type ServiceResourcesFragment = { __typename?: 'ConfigConfig', auth?: { __typename?: 'ConfigAuth', resources?: { __typename?: 'ConfigResources', replicas?: any | null, compute?: { __typename?: 'ConfigResourcesCompute', cpu: any, memory: any } | null, autoscaler?: { __typename?: 'ConfigAutoscaler', maxReplicas: any } | null } | null } | null, hasura: { __typename?: 'ConfigHasura', resources?: { __typename?: 'ConfigResources', replicas?: any | null, compute?: { __typename?: 'ConfigResourcesCompute', cpu: any, memory: any } | null, autoscaler?: { __typename?: 'ConfigAutoscaler', maxReplicas: any } | null } | null }, postgres?: { __typename?: 'ConfigPostgres', resources?: { __typename?: 'ConfigPostgresResources', replicas?: any | null, compute?: { __typename?: 'ConfigResourcesCompute', cpu: any, memory: any } | null, autoscaler?: { __typename?: 'ConfigAutoscaler', maxReplicas: any } | null } | null } | null, storage?: { __typename?: 'ConfigStorage', resources?: { __typename?: 'ConfigResources', replicas?: any | null, compute?: { __typename?: 'ConfigResourcesCompute', cpu: any, memory: any } | null, autoscaler?: { __typename?: 'ConfigAutoscaler', maxReplicas: any } | null } | null } | null };
export type GetResourcesQueryVariables = Exact<{
appId: Scalars['uuid'];
}>;
export type GetResourcesQuery = { __typename?: 'query_root', config?: { __typename?: 'ConfigConfig', auth?: { __typename?: 'ConfigAuth', resources?: { __typename?: 'ConfigResources', replicas?: any | null, compute?: { __typename?: 'ConfigResourcesCompute', cpu: any, memory: any } | null } | null } | null, hasura: { __typename?: 'ConfigHasura', resources?: { __typename?: 'ConfigResources', replicas?: any | null, compute?: { __typename?: 'ConfigResourcesCompute', cpu: any, memory: any } | null } | null }, postgres?: { __typename?: 'ConfigPostgres', resources?: { __typename?: 'ConfigPostgresResources', replicas?: any | null, compute?: { __typename?: 'ConfigResourcesCompute', cpu: any, memory: any } | null } | null } | null, storage?: { __typename?: 'ConfigStorage', resources?: { __typename?: 'ConfigResources', replicas?: any | null, compute?: { __typename?: 'ConfigResourcesCompute', cpu: any, memory: any } | null } | null } | null } | null };
export type GetResourcesQuery = { __typename?: 'query_root', config?: { __typename?: 'ConfigConfig', auth?: { __typename?: 'ConfigAuth', resources?: { __typename?: 'ConfigResources', replicas?: any | null, compute?: { __typename?: 'ConfigResourcesCompute', cpu: any, memory: any } | null, autoscaler?: { __typename?: 'ConfigAutoscaler', maxReplicas: any } | null } | null } | null, hasura: { __typename?: 'ConfigHasura', resources?: { __typename?: 'ConfigResources', replicas?: any | null, compute?: { __typename?: 'ConfigResourcesCompute', cpu: any, memory: any } | null, autoscaler?: { __typename?: 'ConfigAutoscaler', maxReplicas: any } | null } | null }, postgres?: { __typename?: 'ConfigPostgres', resources?: { __typename?: 'ConfigPostgresResources', replicas?: any | null, compute?: { __typename?: 'ConfigResourcesCompute', cpu: any, memory: any } | null, autoscaler?: { __typename?: 'ConfigAutoscaler', maxReplicas: any } | null } | null } | null, storage?: { __typename?: 'ConfigStorage', resources?: { __typename?: 'ConfigResources', replicas?: any | null, compute?: { __typename?: 'ConfigResourcesCompute', cpu: any, memory: any } | null, autoscaler?: { __typename?: 'ConfigAutoscaler', maxReplicas: any } | null } | null } | null } | null };
export type GetServerlessFunctionsSettingsQueryVariables = Exact<{
appId: Scalars['uuid'];
@@ -23516,9 +23785,9 @@ export type GetRunServiceQueryVariables = Exact<{
}>;
export type GetRunServiceQuery = { __typename?: 'query_root', runService?: { __typename?: 'run_service', id: any, subdomain: string, config?: { __typename?: 'ConfigRunServiceConfig', name: any, command?: Array<string> | null, image: { __typename?: 'ConfigRunServiceImage', image: string }, resources: { __typename?: 'ConfigRunServiceResources', replicas: any, compute: { __typename?: 'ConfigComputeResources', cpu: any, memory: any }, storage?: Array<{ __typename?: 'ConfigRunServiceResourcesStorage', name: any, path: string, capacity: any }> | null }, environment?: Array<{ __typename?: 'ConfigEnvironmentVariable', name: string, value: string }> | null, ports?: Array<{ __typename?: 'ConfigRunServicePort', port: any, type: string, publish?: boolean | null }> | null } | null } | null };
export type GetRunServiceQuery = { __typename?: 'query_root', runService?: { __typename?: 'run_service', id: any, subdomain: string, config?: { __typename?: 'ConfigRunServiceConfig', name: any, command?: Array<string> | null, image: { __typename?: 'ConfigRunServiceImage', image: string }, resources: { __typename?: 'ConfigRunServiceResources', replicas: any, compute: { __typename?: 'ConfigComputeResources', cpu: any, memory: any }, storage?: Array<{ __typename?: 'ConfigRunServiceResourcesStorage', name: any, path: string, capacity: any }> | null, autoscaler?: { __typename?: 'ConfigAutoscaler', maxReplicas: any } | null }, environment?: Array<{ __typename?: 'ConfigEnvironmentVariable', name: string, value: string }> | null, ports?: Array<{ __typename?: 'ConfigRunServicePort', port: any, type: string, publish?: boolean | null }> | null } | null } | null };
export type RunServiceConfigFragment = { __typename?: 'ConfigRunServiceConfig', name: any, command?: Array<string> | null, image: { __typename?: 'ConfigRunServiceImage', image: string }, resources: { __typename?: 'ConfigRunServiceResources', replicas: any, compute: { __typename?: 'ConfigComputeResources', cpu: any, memory: any }, storage?: Array<{ __typename?: 'ConfigRunServiceResourcesStorage', name: any, path: string, capacity: any }> | null }, environment?: Array<{ __typename?: 'ConfigEnvironmentVariable', name: string, value: string }> | null, ports?: Array<{ __typename?: 'ConfigRunServicePort', port: any, type: string, publish?: boolean | null, ingresses?: Array<{ __typename?: 'ConfigIngress', fqdn?: Array<string> | null }> | null, rateLimit?: { __typename?: 'ConfigRateLimit', limit: any, interval: string } | null }> | null, healthCheck?: { __typename?: 'ConfigHealthCheck', port: any, initialDelaySeconds?: number | null, probePeriodSeconds?: number | null } | null };
export type RunServiceConfigFragment = { __typename?: 'ConfigRunServiceConfig', name: any, command?: Array<string> | null, image: { __typename?: 'ConfigRunServiceImage', image: string }, resources: { __typename?: 'ConfigRunServiceResources', replicas: any, compute: { __typename?: 'ConfigComputeResources', cpu: any, memory: any }, storage?: Array<{ __typename?: 'ConfigRunServiceResourcesStorage', name: any, path: string, capacity: any }> | null, autoscaler?: { __typename?: 'ConfigAutoscaler', maxReplicas: any } | null }, environment?: Array<{ __typename?: 'ConfigEnvironmentVariable', name: string, value: string }> | null, ports?: Array<{ __typename?: 'ConfigRunServicePort', port: any, type: string, publish?: boolean | null, ingresses?: Array<{ __typename?: 'ConfigIngress', fqdn?: Array<string> | null }> | null, rateLimit?: { __typename?: 'ConfigRateLimit', limit: any, interval: string } | null }> | null, healthCheck?: { __typename?: 'ConfigHealthCheck', port: any, initialDelaySeconds?: number | null, probePeriodSeconds?: number | null } | null };
export type GetRunServicesQueryVariables = Exact<{
appID: Scalars['uuid'];
@@ -23528,7 +23797,7 @@ export type GetRunServicesQueryVariables = Exact<{
}>;
export type GetRunServicesQuery = { __typename?: 'query_root', app?: { __typename?: 'apps', runServices: Array<{ __typename?: 'run_service', id: any, createdAt: any, updatedAt: any, subdomain: string, config?: { __typename?: 'ConfigRunServiceConfig', name: any, command?: Array<string> | null, image: { __typename?: 'ConfigRunServiceImage', image: string }, resources: { __typename?: 'ConfigRunServiceResources', replicas: any, compute: { __typename?: 'ConfigComputeResources', cpu: any, memory: any }, storage?: Array<{ __typename?: 'ConfigRunServiceResourcesStorage', name: any, path: string, capacity: any }> | null }, environment?: Array<{ __typename?: 'ConfigEnvironmentVariable', name: string, value: string }> | null, ports?: Array<{ __typename?: 'ConfigRunServicePort', port: any, type: string, publish?: boolean | null, ingresses?: Array<{ __typename?: 'ConfigIngress', fqdn?: Array<string> | null }> | null, rateLimit?: { __typename?: 'ConfigRateLimit', limit: any, interval: string } | null }> | null, healthCheck?: { __typename?: 'ConfigHealthCheck', port: any, initialDelaySeconds?: number | null, probePeriodSeconds?: number | null } | null } | null }>, runServices_aggregate: { __typename?: 'run_service_aggregate', aggregate?: { __typename?: 'run_service_aggregate_fields', count: number } | null } } | null };
export type GetRunServicesQuery = { __typename?: 'query_root', app?: { __typename?: 'apps', runServices: Array<{ __typename?: 'run_service', id: any, createdAt: any, updatedAt: any, subdomain: string, config?: { __typename?: 'ConfigRunServiceConfig', name: any, command?: Array<string> | null, image: { __typename?: 'ConfigRunServiceImage', image: string }, resources: { __typename?: 'ConfigRunServiceResources', replicas: any, compute: { __typename?: 'ConfigComputeResources', cpu: any, memory: any }, storage?: Array<{ __typename?: 'ConfigRunServiceResourcesStorage', name: any, path: string, capacity: any }> | null, autoscaler?: { __typename?: 'ConfigAutoscaler', maxReplicas: any } | null }, environment?: Array<{ __typename?: 'ConfigEnvironmentVariable', name: string, value: string }> | null, ports?: Array<{ __typename?: 'ConfigRunServicePort', port: any, type: string, publish?: boolean | null, ingresses?: Array<{ __typename?: 'ConfigIngress', fqdn?: Array<string> | null }> | null, rateLimit?: { __typename?: 'ConfigRateLimit', limit: any, interval: string } | null }> | null, healthCheck?: { __typename?: 'ConfigHealthCheck', port: any, initialDelaySeconds?: number | null, probePeriodSeconds?: number | null } | null } | null }>, runServices_aggregate: { __typename?: 'run_service_aggregate', aggregate?: { __typename?: 'run_service_aggregate_fields', count: number } | null } } | null };
export type GetLocalRunServiceConfigsQueryVariables = Exact<{
appID: Scalars['uuid'];
@@ -23536,7 +23805,7 @@ export type GetLocalRunServiceConfigsQueryVariables = Exact<{
}>;
export type GetLocalRunServiceConfigsQuery = { __typename?: 'query_root', runServiceConfigs: Array<{ __typename?: 'ConfigRunServiceConfigWithID', serviceID: any, config: { __typename?: 'ConfigRunServiceConfig', name: any, command?: Array<string> | null, image: { __typename?: 'ConfigRunServiceImage', image: string }, resources: { __typename?: 'ConfigRunServiceResources', replicas: any, compute: { __typename?: 'ConfigComputeResources', cpu: any, memory: any }, storage?: Array<{ __typename?: 'ConfigRunServiceResourcesStorage', name: any, path: string, capacity: any }> | null }, environment?: Array<{ __typename?: 'ConfigEnvironmentVariable', name: string, value: string }> | null, ports?: Array<{ __typename?: 'ConfigRunServicePort', port: any, type: string, publish?: boolean | null, ingresses?: Array<{ __typename?: 'ConfigIngress', fqdn?: Array<string> | null }> | null, rateLimit?: { __typename?: 'ConfigRateLimit', limit: any, interval: string } | null }> | null, healthCheck?: { __typename?: 'ConfigHealthCheck', port: any, initialDelaySeconds?: number | null, probePeriodSeconds?: number | null } | null } }> };
export type GetLocalRunServiceConfigsQuery = { __typename?: 'query_root', runServiceConfigs: Array<{ __typename?: 'ConfigRunServiceConfigWithID', serviceID: any, config: { __typename?: 'ConfigRunServiceConfig', name: any, command?: Array<string> | null, image: { __typename?: 'ConfigRunServiceImage', image: string }, resources: { __typename?: 'ConfigRunServiceResources', replicas: any, compute: { __typename?: 'ConfigComputeResources', cpu: any, memory: any }, storage?: Array<{ __typename?: 'ConfigRunServiceResourcesStorage', name: any, path: string, capacity: any }> | null, autoscaler?: { __typename?: 'ConfigAutoscaler', maxReplicas: any } | null }, environment?: Array<{ __typename?: 'ConfigEnvironmentVariable', name: string, value: string }> | null, ports?: Array<{ __typename?: 'ConfigRunServicePort', port: any, type: string, publish?: boolean | null, ingresses?: Array<{ __typename?: 'ConfigIngress', fqdn?: Array<string> | null }> | null, rateLimit?: { __typename?: 'ConfigRateLimit', limit: any, interval: string } | null }> | null, healthCheck?: { __typename?: 'ConfigHealthCheck', port: any, initialDelaySeconds?: number | null, probePeriodSeconds?: number | null } | null } }> };
export type RunServiceRateLimitFragment = { __typename?: 'ConfigRunServiceConfig', name: any, ports?: Array<{ __typename?: 'ConfigRunServicePort', port: any, type: string, publish?: boolean | null, rateLimit?: { __typename?: 'ConfigRateLimit', limit: any, interval: string } | null, ingresses?: Array<{ __typename?: 'ConfigIngress', fqdn?: Array<string> | null }> | null }> | null };
@@ -23691,6 +23960,9 @@ export const ServiceResourcesFragmentDoc = gql`
memory
}
replicas
autoscaler {
maxReplicas
}
}
}
hasura {
@@ -23700,6 +23972,9 @@ export const ServiceResourcesFragmentDoc = gql`
memory
}
replicas
autoscaler {
maxReplicas
}
}
}
postgres {
@@ -23709,6 +23984,9 @@ export const ServiceResourcesFragmentDoc = gql`
memory
}
replicas
autoscaler {
maxReplicas
}
}
}
storage {
@@ -23718,6 +23996,9 @@ export const ServiceResourcesFragmentDoc = gql`
memory
}
replicas
autoscaler {
maxReplicas
}
}
}
}
@@ -24005,6 +24286,9 @@ export const RunServiceConfigFragmentDoc = gql`
capacity
}
replicas
autoscaler {
maxReplicas
}
}
environment {
name
@@ -27752,6 +28036,9 @@ export const GetRunServiceDocument = gql`
capacity
}
replicas
autoscaler {
maxReplicas
}
}
environment {
name

View File

@@ -50,6 +50,11 @@ export const RESOURCE_VCPU_STEP = 0.25 * RESOURCE_VCPU_MULTIPLIER;
*/
export const RESOURCE_MEMORY_STEP = 128;
/**
* Number of steps between GiB of RAM when the ratio is locked.
*/
export const RESOURCE_MEMORY_LOCKED_STEP = 4 * RESOURCE_MEMORY_STEP;
/**
* Price per vCPU.
*

View File

@@ -1,5 +1,28 @@
# @nhost/docs
## 2.18.0
### Minor Changes
- c4aa159: feat: added advanced TLS document
### Patch Changes
- 91f0465: feat: added turnstile guide
## 2.17.2
### Patch Changes
- 52a38fe: chore: added pg_ivm extension
## 2.17.1
### Patch Changes
- db2f44d: fix: update rate-limit to reflect reality
- dda0c67: chore: udpate metrics documentation with managed configuration
## 2.17.0
### Minor Changes

View File

@@ -0,0 +1,76 @@
---
title: Bot Protection
description: Use turnstile to protect from bots
icon: robot
---
## Overview
To safeguard your Auth API against automated attacks from scripts and bots, you can implement [Cloudflare's Turnstile](https://www.cloudflare.com/en-gb/products/turnstile/). Turnstile offers CAPTCHA-like protection without user friction, as it doesn't require solving puzzles.
![Turnstile Check in Action](/images/guides/auth/turnstile/turnstile.gif)
## Integration Benefits
1. **Selective Protection**: Auth integrates Turnstile specifically for all signup methods.
2. **API Accessibility**: Other API endpoints remain accessible for legitimate programmatic use.
3. **Bot Deterrence**: Manual verification during signup discourages unwanted bot activity.
This approach balances security with usability, ensuring robust protection where it matters most.
## Guide
<Steps>
<Step title="Create a widget on Cloudflare">
Sign up on [Cloudflare](https://dash.cloudflare.com) if you haven't already.
Go to your account -> Turnstile -> Add Widget. Then:
- Set a descriptive name
- In the domain, enter your frontend's domain
- Set widget mode as "managed"
Then click on "create" and write down the site key and the secret key.
</Step>
<Step title="Enable Turnstile integration on auth">
Start by adding the following configuration to your Nhost project:
<Tabs>
<Tab title="Config">
```toml
[auth.signUp.turnstile]
secretKey = 'turnstileSecretKey'
```
</Tab>
</Tabs>
Replace `turnstileSecretKey` with the secret key from the first step.
</Step>
<Step title="Integrate turnstile into your sign up form">
To integrate turnstile into your sign up form you can refer to [Cloudfare's documentation](https://developers.cloudflare.com/turnstile/tutorials/login-pages). Just keep in mind a few things:
- You don't need to do any verification of the response, just pass it to the Auth service on the `/signup/...` request in the header `x-cf-turnstile-response`.
- The "server side verification" is done by the auth service and will return a forbidden status error if the header is not present or if the check didn't pass.
- You will need to use the site key from step 1 to configure turnstile in your form
</Step>
<Step title="Pass turnstile's response to the signup request">
To pass the response as a header change your request to include the header. For instance:
```js
await signUpEmailPassword(
email,
password,
{
displayName,
},
{
headers: {
'x-cf-turnstile-response': turnstileResponse,
},
},
);
```
In the following [PR](https://github.com/nhost/nhost/pull/2897/files) you can see the changes that were needed in our very own dashboard to integrate turnstile.
</Step>
</Steps>

View File

@@ -159,6 +159,32 @@ DROP EXTENSION pg_hashids;
- [GitHub](https://github.com/iCyberon/pg_hashids)
## pg_ivm
The pg_ivm module provides Incremental View Maintenance (IVM) feature for PostgreSQL.
Incremental View Maintenance (IVM) is a way to make materialized views up-to-date in which only incremental changes are computed and applied on views rather than recomputing the contents from scratch as REFRESH MATERIALIZED VIEW does. IVM can update materialized views more efficiently than recomputation when only small parts of the view are changed.
### Managing
To install the extension you can create a migration with the following contents:
```sql SQL
SET ROLE postgres;
CREATE EXTENSION pg_ivm;
```
To uninstall it, you can use the following migration:
```sql SQL
SET ROLE postgres;
DROP EXTENSION pg_ivm;
```
### Resources
- [GitHub](https://github.com/sraoss/pg_ivm)
## pg_squeeze
PostgreSQL extension that removes unused space from a table and optionally sorts tuples according to particular index (as if CLUSTER command was executed concurrently with regular reads / writes). In fact we try to replace pg_repack extension.

View File

@@ -95,7 +95,7 @@ publish = true
</Tab>
</Tabs>
<Info>Currently, only services of type `http` can be exposed to the internet.</Info>
<Info>Currently, only services of type `http` and `grpc` can be exposed to the internet.</Info>
2. Once the service of type `http` is published, you can connect to it using a URL with the following format:
@@ -105,3 +105,21 @@ publish = true
`https://zlbmqjfczuwqvsquujno-3000.svc.eu-central-1.nhost.run`
## GRPC
GRPC services are supported, however, they are only supported via [custom domains](/platform/custom-domains). To expose a GRPC service to the internet you can use the following configuration:
``` toml
...
[[ports]]
type = "grpc"
port = 5000
publish = false
[[ports.ingresses]]
fqdn = ["grpc.domain.com"]
...
```

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 532 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 392 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 KiB

View File

@@ -76,16 +76,13 @@
"platform/subdomain",
"platform/compute-resources",
"platform/service-replicas",
{
"group": "Monitoring",
"icon": "monitor-waveform",
"pages": ["platform/metrics"]
},
"platform/metrics",
"platform/environment-variables",
"platform/secrets",
"platform/deployments",
"platform/custom-domains",
"platform/rate-limits"
"platform/rate-limits",
"platform/tls"
]
},
{
@@ -159,6 +156,7 @@
"guides/auth/sign-in-phone-number",
"guides/auth/sign-in-webauthn",
"guides/auth/elevated-permissions",
"guides/auth/bot-protection",
"guides/auth/email-templates",
"guides/auth/custom-jwts"
]

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/docs",
"version": "2.17.0",
"version": "2.18.0",
"private": true,
"scripts": {
"start": "mintlify dev"

View File

@@ -4,6 +4,10 @@ description: 'Grafana Instance configured and tailored to your project'
icon: monitor-waveform
---
<Info>
This is a Pro/Team/Enterprise feature. This is not available on Starter projects.
</Info>
Insights such as response times, resource usage, and error rates, to help you assess the **performance** and **health** of your services.
Metrics helps you analyze the performance of your infrastructure, while identifying bottlenecks and optimizing your applications.
@@ -23,16 +27,130 @@ Your Grafana instance comes pre-defined with dashboards that cover backend servi
![Grafana](/images/platform/metrics/grafana.png)
### Nhost Dashboard
## Accessing Grafana
You can find the link to Grafana in your project's dashboard, under **Metrics**.
You can find the link to Grafana in your project's dashboard, under **Metrics**.
![Project Metrics](/images/platform/metrics/nhost-dashboard-metrics.png)
## Configuring Grafana
Grafana comes pre-configured with a datasource with your project's metrics plus a few useful dashboards to observe your projects. In addition, you can enable alerting by configuring one or more contact points and enabling alerts in your configuration file.
<Info>
The configuration below is open source and can be found [here](https://github.com/nhost/nhost/tree/main/observability/grafana). If you want to see improvements, more rules, better dashboards, more options, etc., don't hesitate to contribute them or open an issue.
</Info>
### Configure contact points
Contact points in Grafana are lists of integrations that send notifications to specific channels or services when alerts are triggered. Supported contact points are:
- email
- pagerduty
- discord
- slack
- webhooks
To configure them include one ore more sections in your configuration file:
```toml
[observability.grafana.contacts]
emails = ['engineering@acme.com']
[[observability.grafana.contacts.pagerduty]]
integrationKey = 'integration-key'
severity = 'critical'
class = 'infra'
component = 'backend'
group = 'group'
[[observability.grafana.contacts.discord]]
url = 'https://discord.com/api/webhooks/...'
avatarUrl = 'https://discord.com/api/avatar/...'
[[observability.grafana.contacts.slack]]
recipient = 'recipient'
token = 'token'
username = 'username'
iconEmoji = 'danger'
iconURL = 'https://...'
mentionUsers = ['user1', 'user2']
mentionGroups = ['group1', 'group2']
mentionChannel = 'channel'
url = 'https://slack.com/api/webhooks/...'
endpointURL = 'https://slack.com/api/endpoint/...'
[[observability.grafana.contacts.webhook]]
url = 'https://webhook.example.com'
httpMethod = 'POST'
username = 'user'
password = 'password'
authorizationScheme = 'Bearer'
authorizationCredentials = 'token'
maxAlerts = 10
```
Once you have added them to your configuration and deployed them you should be able to see them in your grafana dashboard under "Settings" -> "Contact points" -> "Nhost Managed Contacts":
![contact points](/images/platform/metrics/contact_points.png)
If you click on "View" you should be able to see a test button you can use to ensure your contacts are properly configured.
### SMTP
If you are planning to send emails as part of your alerting, you need to configure some SMTP settings as well. To do so add to your configuration:
```toml
[observability.grafana.smtp]
host = 'localhost'
port = 25
sender = 'admin@localhost'
user = 'smtpUser'
password = 'smtpPassword'
```
### Alerting
To enable alerting simply add to your configuration:
```toml
[observability.grafana.alerting]
enabled = true
```
This will enable the following rules, which you can find in your grafana dashboard under "Alert rules":
![alert rules](/images/platform/metrics/alert_rules.png)
1. **High CPU usage**
- Trigger: CPU usage > 75%
- Duration: Sustained for 5-10 minutes
2. **Low disk space**
- Trigger: Disk utilization > 75%
- Duration: Persistent for 5-10 minutes
3. **Low free memory**
- Trigger: Memory usage > 75%
- Duration: Continuous for 5-10 minutes
4. **Service restarted due to lack of memory**
- Trigger: Any service restart due to memory exhaustion
- Duration: Immediate upon occurrence
5. **High request error rate**
- Trigger: Request error rate > 25%
- Duration: Maintained for 5-10 minutes
After they have been enabling they will start notifying your contact points when the conditions are met. For instance, here is an email sent due to a high error rate:
![email_notification](/images/platform/metrics/email_notification.png)
## Advanced configuration
In addition, Team and Enterprise projects can perform any changes they want. For instance you can add users, configure an OAuth provider for user authentication, add datasources, you can configure your own alerts, etc.
## Beta
Metrics is in beta, its functionality and pricing might change.
### Limitations
- Dashboards can be updated or created, but they won't persist after a deployment.

View File

@@ -45,7 +45,7 @@ Given that not all endpoints are equally sensitive, Auth supports more complex r
| Endpoints | Key | Limits | Description | Minimum version |
| ----------------------|-----|--------|-------------|-----------------|
| Any that sends emails<sup>1</sup> | Global | 50 / hour | Not configurable. This limit applies to any project without custom SMTP settings | 0.33.0 |
| Any that sends emails<sup>1</sup> | Global | 10 / hour | Not configurable. This limit applies to any project without custom SMTP settings | 0.33.0 |
| Any that sends emails<sup>1</sup> | Client IP | 10 / hour | Configurable. This limit applies to any project with custom SMTP settings and is configurable | 0.33.0 |
| Any that sends SMS<sup>2</sup> | Client IP | 10 / hour | Configurable. | 0.33.0 |
| Any endpoint that an attacker may try to brute-force. This includes sign-in and verify endpoints<sup>3</sup> | Client IP | 10 / 5 minutes | Configurable | 0.33.0 |

185
docs/platform/tls.mdx Normal file
View File

@@ -0,0 +1,185 @@
---
title: TLS Configuration
description: Advanced TLS settings
icon: file-certificate
---
Below you can find some advanced TLS functionality you can enable.
<Warning>
Advanced TLS settings are only available with [custom domains](/platform/custom-domains)
</Warning>
## TLS Client Authentication
With TLS Client Authentication you can configure our platform to require clients to include a client certificate signed by a CA of your choosing. If the client doesn't provide a certificate or the certificate isn't signed by the correct CA the request will be denied. If the request includes a valid certificate the request will be forwarded to your service and will include information about the TLS configuration.
To configure TLS client authentication you can use the configuration below:
```toml
[[functions.resources.ingress]]
fqdn = ["func.acme.com"]
[functions.resources.networking.ingresses.tls]
clientCA = "{{ secrets.client_ca }}"
```
### Headers
The following headers will be added to all successful requests:
- `ssl-client-cert`: The client cetificate that was used
- `ssl-client-issuer-dn`: Client certificate's issuer DN
- `ssl-client-subject-dn`: Client certificate;s distinguished name
- `ssl-client-verify`: Result of the operation. As we only forward requests on success the value should always be `SUCCESS`.
### Guide
Here is a quick guide on how to enable TLS client authentication for the functions service using self-signed certificates.
#### Creating the CA
First we need to create a CA that will be used to sign and validate the client certificates.
<Steps>
<Step title="Generate the CA private key">
First, we need to create a private key for our Certificate Authority. We'll use a 4096-bit RSA key for strong security.
```
openssl genrsa -aes256 -out ca.key 4096
```
This command will prompt you to enter a passphrase to protect the CA private key. Make sure to choose a strong passphrase and keep it safe.
</Step>
<Step title="Create the CA certificate">
Now that we have the private key, let's create a self-signed CA certificate:
```
openssl req -x509 -new -nodes -key ca.key -sha256 -days 3650 -out ca.crt
```
This command will prompt you for various details to include in the certificate. The most important field is the Common Name (CN), which should be a descriptive name for your CA.
</Step>
</Steps>
The resulting `ca.key` file will be needed later to sign client certificates while the result `ca.crt` will be needed to validate them.
#### Creating client certificates
Now we can proceed to create client certificats. You can repeat the steps below to create as many as you need.
<Steps>
<Step title="Generate a private key for the client">
First, we'll create a private key for the client certificate:
```
openssl genrsa -out client.key 2048
```
</Step>
<Step title="Create a Certificate Signing Request (CSR) for the client">
Now, we'll create a CSR for the client certificate:
```
openssl req -new -key client.key -out client.csr
```
Fill in the prompted information. The Common Name (CN) should typically be the name of the client or user.
</Step>
<Step title="Create a configuration file for the client certificate">
Create a file named `client.ext` with the following content:
```
authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
extendedKeyUsage = clientAuth
```
This configuration specifies that the certificate is for client authentication.
</Step>
<Step title="Generate the client certificate">
Now, we'll use our CA to sign the client certificate:
```
openssl x509 -req -in client.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out client.crt -days 365 -sha256 -extfile client.ext
```
This command will prompt you for the CA private key passphrase you set earlier.
</Step>
The resulting `client.key` and `client.crt` files will be needed by the user to authenticate requests.
</Steps>
#### Configure your service
With everything in place you can configure your service. Imagine we have an already deployed project and we want to enable this for all functions. First we will head to the dashboard -> project -> settings -> secrets and create a new secret named `CLIENT_CA` with the contents of the `ca.crt` file. Afterwards we will deploy the following configuration:
```toml
[[functions.resources.networking.ingresses]]
fqdn = [ "functions.acme.com" ]
[functions.resources.networking.ingresses.tls]
clientCA = "{{ secrets.CLIENT_CA }}"
```
#### Profit
Our project has a function that echoes back request parameters, including headers. We will use this to inspect the TLS headers added to the request and that you can use for further validation if you need it. First, we can query the function without passing any client certificate:
```
$ curl https://functions.acme.com/v1/echo
<html>
<head><title>400 No required SSL certificate was sent</title></head>
<body>
<center><h1>400 Bad Request</h1></center>
<center>No required SSL certificate was sent</center>
<hr><center>nginx</center>
</body>
</html>
```
As you can see the request was rejected. Now we can add a valid client certificate and the corresponding key to the request:
```
$ curl --cert client.crt --key client.key https://functions.acme.com/v1/echo | jq
{
"headers": {
"accept": "*/*",
"ssl-client-cert": "-----BEGIN%20CERTIFICATE-----...ommitted for brevity...-----END%20CERTIFICATE-----%0A",
"ssl-client-issuer-dn": "OU=IT,O=Acme Org.,L=Stockholm,ST=Stockholm,C=SE",
"ssl-client-subject-dn": "emailAddress=jane@acme.org,OU=IT,O=Acme Org.,L=Sausalito,ST=California,C=US",
"ssl-client-verify": "SUCCESS",
"user-agent": "curl/8.7.1",
"x-forwarded-for": "2001:8b1:8ac9:4100:46b1:3412:1342:9319",
"x-forwarded-host": "functions.acme.com",
"x-forwarded-port": "443",
"x-forwarded-proto": "https",
"x-forwarded-scheme": "https",
"x-real-ip": "2001:8b1:8ac9:4100:46b1:3412:1342:9319",
"x-request-id": "8f80c26ee873bfc9db7ce9073eecd17a",
"x-scheme": "https",
"content-length": 0
},
"query": {},
"node": "v20.17.0",
"arch": "arm64"
}
```
With a valid certificate you can see the request went through and it includes the `ssl-client-*` headers providing additional information about it.

View File

@@ -1,5 +1,11 @@
# @nhost-examples/cli
## 0.3.12
### Patch Changes
- @nhost/nhost-js@3.1.10
## 0.3.11
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost-examples/cli",
"version": "0.3.11",
"version": "0.3.12",
"main": "src/index.mjs",
"private": true,
"scripts": {

View File

@@ -1,5 +1,19 @@
# @nhost-examples/codegen-react-apollo
## 0.4.13
### Patch Changes
- Updated dependencies [55d8bb5]
- @nhost/react@3.6.0
- @nhost/react-apollo@13.0.0
## 0.4.12
### Patch Changes
- 52a38fe: chore: update dependencies to address security vulnerabilities
## 0.4.11
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost-examples/codegen-react-apollo",
"version": "0.4.11",
"version": "0.4.13",
"private": true,
"scripts": {
"codegen": "graphql-codegen",
@@ -36,6 +36,6 @@
"postcss": "^8.4.38",
"tailwindcss": "^3.4.3",
"typescript": "^4.9.5",
"vite": "^5.2.7"
"vite": "^5.4.6"
}
}

View File

@@ -1,5 +1,18 @@
# @nhost-examples/codegen-react-query
## 0.4.13
### Patch Changes
- Updated dependencies [55d8bb5]
- @nhost/react@3.6.0
## 0.4.12
### Patch Changes
- 52a38fe: chore: update dependencies to address security vulnerabilities
## 0.4.11
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost-examples/codegen-react-query",
"version": "0.4.11",
"version": "0.4.13",
"private": true,
"scripts": {
"codegen": "graphql-codegen",
@@ -37,6 +37,6 @@
"postcss": "^8.4.38",
"tailwindcss": "^3.4.3",
"typescript": "^4.9.5",
"vite": "^5.2.7"
"vite": "^5.4.6"
}
}

View File

@@ -1,5 +1,19 @@
# @nhost-examples/react-urql
## 0.3.13
### Patch Changes
- Updated dependencies [55d8bb5]
- @nhost/react@3.6.0
- @nhost/react-urql@10.0.0
## 0.3.12
### Patch Changes
- 52a38fe: chore: update dependencies to address security vulnerabilities
## 0.3.11
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "@nhost-examples/codegen-react-urql",
"private": true,
"version": "0.3.11",
"version": "0.3.13",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
@@ -30,6 +30,6 @@
"postcss": "^8.4.38",
"tailwindcss": "^3.4.3",
"typescript": "^4.9.5",
"vite": "^5.2.7"
"vite": "^5.4.6"
}
}

View File

@@ -1,5 +1,17 @@
# @nhost-examples/multi-tenant-one-to-many
## 2.2.13
### Patch Changes
- @nhost/nhost-js@3.1.10
## 2.2.12
### Patch Changes
- 52a38fe: chore: update dependencies to address security vulnerabilities
## 2.2.11
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "@nhost-examples/multi-tenant-one-to-many",
"private": true,
"version": "2.2.11",
"version": "2.2.13",
"description": "",
"main": "index.js",
"scripts": {},
@@ -10,7 +10,7 @@
"license": "ISC",
"devDependencies": {
"@types/express": "^4.17.21",
"express": "^4.19.2",
"express": "^4.20.0",
"typescript": "^4.9.5"
},
"dependencies": {

View File

@@ -1,5 +1,22 @@
# @nhost-examples/nextjs
## 0.3.13
### Patch Changes
- Updated dependencies [55d8bb5]
- @nhost/react@3.6.0
- @nhost/react-apollo@13.0.0
- @nhost/nextjs@2.1.22
## 0.3.12
### Patch Changes
- 52a38fe: chore: update dependencies to address security vulnerabilities
- Updated dependencies [52a38fe]
- @nhost/nextjs@2.1.21
## 0.3.11
### Patch Changes

View File

@@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />
// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information.

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost-examples/nextjs",
"version": "0.3.11",
"version": "0.3.13",
"private": true,
"scripts": {
"dev": "next dev",
@@ -24,7 +24,7 @@
"@nhost/react": "workspace:^",
"@nhost/react-apollo": "workspace:^",
"graphql": "16.8.1",
"next": "^14.1.4",
"next": "^14.2.10",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-icons": "^4.12.0"

View File

@@ -1,5 +1,11 @@
# @nhost-examples/node-storage
## 0.2.12
### Patch Changes
- @nhost/nhost-js@3.1.10
## 0.2.11
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost-examples/node-storage",
"version": "0.2.11",
"version": "0.2.12",
"private": true,
"description": "This is an example of how to use the Storage with Node.js",
"main": "src/index.mjs",

View File

@@ -1,5 +1,17 @@
# @nhost-examples/nextjs-server-components
## 0.4.14
### Patch Changes
- @nhost/nhost-js@3.1.10
## 0.4.13
### Patch Changes
- 52a38fe: chore: update dependencies to address security vulnerabilities
## 0.4.12
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost-examples/nextjs-server-components",
"version": "0.4.12",
"version": "0.4.14",
"private": true,
"scripts": {
"dev": "next dev",
@@ -18,7 +18,7 @@
"form-data": "^4.0.0",
"graphql": "16.8.1",
"js-cookie": "^3.0.5",
"next": "^14.1.4",
"next": "^14.2.10",
"postcss": "^8.4.38",
"react": "^18.2.0",
"react-dom": "^18.2.0",

View File

@@ -1,5 +1,10 @@
---
## 0.4.1
### Patch Changes
- 52a38fe: chore: update dependencies to address security vulnerabilities
## 0.4.0
### Minor Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost-examples/sveltekit",
"version": "0.4.0",
"version": "0.4.1",
"private": true,
"scripts": {
"dev": "vite dev",
@@ -29,7 +29,7 @@
"svelte-check": "^3.6.8",
"tailwindcss": "^3.4.3",
"typescript": "^5.4.3",
"vite": "^5.2.7",
"vite": "^5.4.6",
"vitest": "^0.25.8"
},
"type": "module",

View File

@@ -1,5 +1,21 @@
# @nhost-examples/react-apollo
## 1.0.2
### Patch Changes
- Updated dependencies [55d8bb5]
- @nhost/react@3.6.0
- @nhost/react-apollo@13.0.0
## 1.0.1
### Patch Changes
- 4d6b722: fix: add check for elevated permission before deleting a security key
- 3dcbacf: fix: add elevated permission check before adding a security key
- 52a38fe: chore: update dependencies to address security vulnerabilities
## 1.0.0
### Major Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost-examples/react-apollo",
"version": "1.0.0",
"version": "1.0.2",
"private": true,
"type": "module",
"scripts": {
@@ -32,8 +32,8 @@
"next-themes": "^0.3.0",
"prism-react-renderer": "^2.3.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-code-block": "^1.0.0",
"react-dom": "^18.2.0",
"react-dropzone": "^14.2.3",
"react-hook-form": "^7.52.2",
"react-router-dom": "^6.22.3",
@@ -62,6 +62,6 @@
"totp-generator": "^0.0.13",
"typescript": "^5.5.3",
"typescript-eslint": "^8.0.0",
"vite": "^5.4.0"
"vite": "^5.4.6"
}
}

View File

@@ -6,7 +6,12 @@ import { Form, FormControl, FormField, FormItem, FormMessage } from '@/component
import { Input } from '@/components/ui/input'
import { ApolloError, gql, useMutation } from '@apollo/client'
import { zodResolver } from '@hookform/resolvers/zod'
import { useAddSecurityKey, useUserId } from '@nhost/react'
import {
useAddSecurityKey,
useElevateSecurityKeyEmail,
useUserEmail,
useUserId
} from '@nhost/react'
import { useAuthQuery } from '@nhost/react-apollo'
import { Fingerprint, Info, Plus, Trash } from 'lucide-react'
import { useState } from 'react'
@@ -29,9 +34,11 @@ const addSecurityKeySchema = z.object({
export default function SecurityKeys() {
const userId = useUserId()
const [showAddSecurityKeyDialog, setShowAddSecurityDialog] = useState(false)
const email = useUserEmail()
const { add } = useAddSecurityKey()
const [keys, setKeys] = useState<SecurityKey[]>([])
const { elevated, elevateEmailSecurityKey } = useElevateSecurityKeyEmail()
const [showAddSecurityKeyDialog, setShowAddSecurityDialog] = useState(false)
const { refetch: refetchSecurityKeys } = useAuthQuery<SecurityKeysQuery>(
gql`
@@ -52,30 +59,6 @@ export default function SecurityKeys() {
}
)
const form = useForm<z.infer<typeof addSecurityKeySchema>>({
resolver: zodResolver(addSecurityKeySchema),
defaultValues: {
nickname: ''
}
})
const onSubmit = async (values: z.infer<typeof addSecurityKeySchema>) => {
const { nickname } = values
const { key, isError, error } = await add(nickname)
if (isError) {
toast.error(error?.message)
} else {
if (key) {
setKeys((previousKeys) => [...previousKeys, key])
setShowAddSecurityDialog(false)
}
form.reset()
await refetchSecurityKeys()
}
}
const [removeKey] = useMutation<{
deleteAuthUserSecurityKey?: {
id: string
@@ -97,7 +80,58 @@ export default function SecurityKeys() {
}
)
const form = useForm<z.infer<typeof addSecurityKeySchema>>({
resolver: zodResolver(addSecurityKeySchema),
defaultValues: {
nickname: ''
}
})
const elevatePermission = async () => {
if (!elevated && keys.length > 0) {
try {
const { elevated } = await elevateEmailSecurityKey(email as string)
if (!elevated) {
throw new Error('Permissions were not elevated')
}
return true
} catch {
toast.error('Could not elevate permissions')
return false
}
}
return true // Return true if already elevated or no keys
}
const onSubmit = async (values: z.infer<typeof addSecurityKeySchema>) => {
const { nickname } = values
const permissionGranted = await elevatePermission()
if (!permissionGranted) {
return
}
const { key, isError, error } = await add(nickname)
if (isError) {
toast.error(error?.message)
} else if (key) {
setKeys((previousKeys) => [...previousKeys, key])
setShowAddSecurityDialog(false)
form.reset()
await refetchSecurityKeys()
}
}
const handleDeleteSecurityKey = async (id: string) => {
const permissionGranted = await elevatePermission()
if (!permissionGranted) {
return
}
try {
await removeKey({ variables: { id } })
await refetchSecurityKeys()

View File

@@ -1,5 +1,18 @@
# @nhost-examples/react-gqty
## 1.2.13
### Patch Changes
- Updated dependencies [55d8bb5]
- @nhost/react@3.6.0
## 1.2.12
### Patch Changes
- 52a38fe: chore: update dependencies to address security vulnerabilities
## 1.2.11
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "@nhost-examples/react-gqty",
"private": true,
"version": "1.2.11",
"version": "1.2.13",
"type": "module",
"scripts": {
"dev": "vite",
@@ -27,6 +27,6 @@
"postcss": "^8.4.38",
"tailwindcss": "^3.4.3",
"typescript": "^4.9.5",
"vite": "^5.2.7"
"vite": "^5.4.6"
}
}

View File

@@ -1,5 +1,13 @@
# @nhost-examples/react-native
## 0.0.6
### Patch Changes
- Updated dependencies [55d8bb5]
- @nhost/react@3.6.0
- @nhost/react-apollo@13.0.0
## 0.0.5
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost-examples/react-native",
"version": "0.0.5",
"version": "0.0.6",
"private": true,
"scripts": {
"android": "react-native run-android",

View File

@@ -1,5 +1,19 @@
# @nhost-examples/vue-apollo
## 0.6.13
### Patch Changes
- @nhost/nhost-js@3.1.10
- @nhost/apollo@7.1.7
- @nhost/vue@2.6.7
## 0.6.12
### Patch Changes
- 52a38fe: chore: update dependencies to address security vulnerabilities
## 0.6.11
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "@nhost-examples/vue-apollo",
"private": true,
"version": "0.6.11",
"version": "0.6.13",
"scripts": {
"dev": "vite",
"build": "vite build",
@@ -37,7 +37,7 @@
"@xstate/inspect": "^0.6.5",
"sass": "1.32.0",
"typescript": "4.9.4",
"vite": "^5.2.7",
"vite": "^5.4.6",
"vue-tsc": "^0.38.9"
},
"eslintConfig": {

View File

@@ -1,5 +1,18 @@
# @nhost-examples/vue-quickstart
## 0.2.13
### Patch Changes
- @nhost/apollo@7.1.7
- @nhost/vue@2.6.7
## 0.2.12
### Patch Changes
- 52a38fe: chore: update dependencies to address security vulnerabilities
## 0.2.11
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost-examples/vue-quickstart",
"version": "0.2.11",
"version": "0.2.13",
"private": true,
"scripts": {
"build": "vite build",
@@ -35,7 +35,7 @@
"unocss": "^0.33.5",
"unplugin-auto-import": "^0.17.5",
"unplugin-vue-components": "^0.26.0",
"vite": "^5.2.7",
"vite": "^5.4.6",
"vite-plugin-pages": "^0.28.0",
"vue-tsc": "^0.38.9"
}

View File

@@ -1,5 +1,11 @@
# @nhost/apollo
## 7.1.7
### Patch Changes
- @nhost/nhost-js@3.1.10
## 7.1.6
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/apollo",
"version": "7.1.6",
"version": "7.1.7",
"description": "Nhost Apollo Client library",
"license": "MIT",
"keywords": [

View File

@@ -1,5 +1,13 @@
# @nhost/react-apollo
## 13.0.0
### Patch Changes
- Updated dependencies [55d8bb5]
- @nhost/react@3.6.0
- @nhost/apollo@7.1.7
## 12.0.6
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/react-apollo",
"version": "12.0.6",
"version": "13.0.0",
"description": "Nhost React Apollo client",
"license": "MIT",
"keywords": [

View File

@@ -1,5 +1,12 @@
# @nhost/react-urql
## 10.0.0
### Patch Changes
- Updated dependencies [55d8bb5]
- @nhost/react@3.6.0
## 9.0.6
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/react-urql",
"version": "9.0.6",
"version": "10.0.0",
"description": "Nhost React URQL client",
"license": "MIT",
"keywords": [

View File

@@ -0,0 +1,58 @@
apiVersion: 1
contactPoints:
- orgId: 1
name: Nhost Managed Contacts
receivers:
{{ if .Contacts.Emails }}
- uid: 1
type: email
settings:
addresses: {{ join .Contacts.Emails "," }}
singleEmail: false
sendReminder: true
{{ end }}
{{- range $i, $c := .Contacts.Pagerduty }}
- uid: {{ add 100 $i }}
type: pagerduty
settings:
integrationKey: {{ $c.IntegrationKey }}
severity: {{ $c.Severity }}
class: {{ $c.Class }}
component: {{ $c.Component }}
group: {{ $c.Group }}
{{- end }}
{{- range $i, $c := .Contacts.Discord }}
- uid: {{ add 200 $i }}
type: discord
settings:
url: {{ $c.URL }}
avatar_url: {{ $c.AvatarURL }}
use_discord_username: true
{{- end }}
{{- range $i, $c := .Contacts.Slack }}
- uid: {{ add 300 $i }}
type: slack
settings:
recipient: {{ $c.Recipient }}
token: {{ $c.Token }}
username: {{ $c.Username }}
icon_emoji: {{ $c.IconEmoji }}
icon_url: {{ $c.IconURL }}
mentionUsers: {{ join $c.MentionUsers "," }}
mentionGroups: {{ join $c.MentionGroups "," }}
mentionChannel: {{ $c.MentionChannel }}
url: {{ $c.URL }}
endpointUrl: {{ $c.EndpointURL }}
{{- end }}
{{- range $i, $c := .Contacts.Webhook }}
- uid: {{ add 400 $i }}
type: webhook
settings:
url: {{ $c.URL }}
httpMethod: {{ $c.HTTPMethod }}
username: {{ $c.Username }}
password: {{ $c.Password }}
authorization_scheme: {{ $c.AuthorizationScheme }}
authorization_credentials: {{ $c.AuthorizationCredentials }}
maxAlerts: '{{ $c.MaxAlerts }}'
{{- end }}

View File

@@ -44,7 +44,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"fieldConfig": {
"defaults": {
@@ -91,7 +91,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"editorMode": "code",
"exemplar": false,
@@ -108,7 +108,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"fieldConfig": {
"defaults": {
@@ -155,7 +155,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"editorMode": "code",
"exemplar": false,
@@ -172,7 +172,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"fieldConfig": {
"defaults": {
@@ -219,7 +219,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"editorMode": "code",
"exemplar": false,
@@ -249,7 +249,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"description": "Number of invocations by method/function",
"fieldConfig": {
@@ -327,13 +327,13 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"editorMode": "code",
"expr": "sum by(method, route) (increase(functions_requests_total{method=~\"$method\",route=~\"$route\"}[$__rate_interval]))",
"format": "time_series",
"interval": "2m",
"legendFormat": "{{method}} {{route}}",
"legendFormat": "{{ print "{{ method }} - {{ route }}" }}",
"range": true,
"refId": "A"
}
@@ -344,7 +344,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"description": "Number of invocations by status response",
"fieldConfig": {
@@ -422,13 +422,13 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"editorMode": "code",
"expr": "sum by(status) (increase(functions_requests_total{method=~\"$method\",route=~\"$route\"}[$__rate_interval]))",
"format": "time_series",
"interval": "2m",
"legendFormat": "{{status}}",
"legendFormat": "{{ print "{{status}}" }}",
"range": true,
"refId": "A"
}
@@ -439,7 +439,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"description": "",
"fieldConfig": {
@@ -518,12 +518,12 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"editorMode": "code",
"expr": "sum by(method, route) (increase(functions_bytes_sent{method=~\"$method\", route=~\"$route\"}[$__rate_interval])) / sum by(method, route) (increase(functions_requests_total{method=~\"$method\", route=~\"$route\"}[$__rate_interval]))",
"interval": "2m",
"legendFormat": "{{ method }} - {{ route }}",
"legendFormat": "{{ print "{{ method }} - {{ route }}" }}",
"range": true,
"refId": "A"
}
@@ -534,7 +534,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"fieldConfig": {
"defaults": {
@@ -601,7 +601,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"editorMode": "code",
"exemplar": false,
@@ -609,7 +609,7 @@
"format": "table",
"instant": true,
"interval": "2m",
"legendFormat": "{{method}} {{route}}",
"legendFormat": "{{ print "{{ method }} - {{ route }}" }}",
"range": false,
"refId": "A"
}
@@ -634,7 +634,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"description": "Time the slowest response took",
"fieldConfig": {
@@ -712,12 +712,12 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"editorMode": "code",
"expr": "histogram_quantile(1, rate(functions_duration_seconds_bucket[$__rate_interval]))",
"interval": "2m",
"legendFormat": "{{ method }} - {{ route }}",
"legendFormat": "{{ print "{{ method }} - {{ route }}" }}",
"range": true,
"refId": "A"
}
@@ -728,7 +728,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"description": "The 95th percentile of response times refers to the value below which 95% of response times fall. In other words, it is the point at which only 5% of response times are higher",
"fieldConfig": {
@@ -806,12 +806,12 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"editorMode": "code",
"expr": "histogram_quantile(0.95, rate(functions_duration_seconds_bucket[$__rate_interval]))",
"interval": "2m",
"legendFormat": "{{ method }} - {{ route }}",
"legendFormat": "{{ print "{{ method }} - {{ route }}" }}",
"range": true,
"refId": "A"
}
@@ -822,7 +822,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"description": "The 75th percentile of response times refers to the value below which 75% of response times fall. In other words, it is the point at which 25% of response times are higher",
"fieldConfig": {
@@ -900,12 +900,12 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"editorMode": "code",
"expr": "histogram_quantile(0.75, rate(functions_duration_seconds_bucket[$__rate_interval]))",
"interval": "2m",
"legendFormat": "{{ method }} - {{ route }}",
"legendFormat": "{{ print "{{ method }} - {{ route }}" }}",
"range": true,
"refId": "A"
}
@@ -916,7 +916,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"description": "",
"fieldConfig": {
@@ -994,12 +994,12 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"editorMode": "builder",
"expr": "sum by(method, route) (increase(functions_duration_seconds_sum{method=~\"$method\", route=~\"$route\"}[$__rate_interval])) / sum by(method, route) (increase(functions_duration_seconds_count{method=~\"$method\", route=~\"$route\"}[$__rate_interval]))",
"interval": "2m",
"legendFormat": "{{ method }} - {{ route }}",
"legendFormat": "{{ print "{{ method }} - {{ route }}" }}",
"range": true,
"refId": "A"
}
@@ -1023,7 +1023,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"description": "Number of invocations that failed divided by the total number of invocations",
"fieldConfig": {
@@ -1101,13 +1101,13 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"editorMode": "code",
"expr": "sum by(method, route) (increase(functions_requests_total{method=~\"$method\",route=~\"$route\",status=~\"^[4-5].*\"}[$__rate_interval])) / sum by(method, route) (increase(functions_requests_total[$__rate_interval]))",
"format": "time_series",
"interval": "2m",
"legendFormat": "{{method}} {{ route }}",
"legendFormat": "{{ print "{{ method }} - {{ route }}" }}",
"range": true,
"refId": "A"
}
@@ -1118,7 +1118,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"fieldConfig": {
"defaults": {
@@ -1184,7 +1184,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"editorMode": "code",
"exemplar": false,
@@ -1192,7 +1192,7 @@
"format": "table",
"instant": true,
"interval": "2m",
"legendFormat": "{{method}} {{route}}",
"legendFormat": "{{ print "{{ method }} - {{ route }}" }}",
"range": false,
"refId": "A"
}
@@ -1205,7 +1205,9 @@
"refresh": false,
"schemaVersion": 37,
"style": "dark",
"tags": [],
"tags": [
"nhost"
],
"templating": {
"list": [
{
@@ -1217,7 +1219,7 @@
},
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"definition": "label_values(functions_requests_total, method)",
"hide": 0,
@@ -1244,7 +1246,7 @@
},
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"definition": "label_values(functions_requests_total, route)",
"hide": 0,

View File

@@ -31,7 +31,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"description": "",
"gridPos": {
@@ -67,7 +67,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"fieldConfig": {
"defaults": {
@@ -144,12 +144,12 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"editorMode": "code",
"expr": "sum by(container,pod) (irate(container_cpu_usage_seconds_total{container=~\"hasura|hasura-graphi\"}[$__rate_interval])) * 1000",
"interval": "2m",
"legendFormat": "{{pod}}::{{container}}",
"legendFormat": "{{ print "{{pod}}::{{container}}" }}",
"range": true,
"refId": "A"
}
@@ -160,7 +160,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"fieldConfig": {
"defaults": {
@@ -238,12 +238,12 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"editorMode": "code",
"expr": "sum by(container,pod) (container_memory_usage_bytes{container=~\"hasura|hasura-graphi\"})",
"interval": "2m",
"legendFormat": "{{pod}}::{{container}}",
"legendFormat": "{{ print "{{pod}}::{{container}}" }}",
"range": true,
"refId": "A"
}
@@ -265,7 +265,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"fieldConfig": {
"defaults": {
@@ -342,7 +342,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"editorMode": "code",
"expr": "sum(rate(graphql_requests_total{service=\"hasura-service\"}[$__rate_interval]))",
@@ -354,13 +354,13 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"editorMode": "code",
"expr": "rate(graphql_requests_total{service=\"hasura-service\"}[$__rate_interval])",
"hide": false,
"interval": "2m",
"legendFormat": "{{operation}}::{{name}}::{{field}}",
"legendFormat": "{{ print "{{operation}}::{{name}}::{{field}}" }}",
"range": true,
"refId": "B"
}
@@ -371,7 +371,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"fieldConfig": {
"defaults": {
@@ -448,7 +448,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"editorMode": "code",
"expr": "graphql_websocket_connections_started_total{service=\"hasura-service\"} - graphql_websocket_connections_completed_total{service=\"hasura-service\"}",
@@ -460,7 +460,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"editorMode": "code",
"expr": "rate(graphql_websocket_connections_started_total{service=\"hasura-service\"}[$__rate_interval])",
@@ -473,7 +473,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"editorMode": "code",
"expr": "rate(graphql_websocket_connections_completed_total{service=\"hasura-service\"}[$__rate_interval])",
@@ -489,7 +489,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"fieldConfig": {
"defaults": {
@@ -567,12 +567,12 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"editorMode": "code",
"expr": "histogram_quantile(0.95, sum(rate(graphql_requests_duration_miliseconds_bucket{service=\"hasura-service\"}[$__rate_interval])) by (le,operation,name,field))",
"interval": "2m",
"legendFormat": "{{operation}}::{{ name }}::{{field}}",
"legendFormat": "{{ print "{{operation}}::{{ name }}::{{field}}" }}",
"range": true,
"refId": "A"
}
@@ -583,7 +583,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"fieldConfig": {
"defaults": {
@@ -660,12 +660,12 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"editorMode": "code",
"expr": "rate(graphql_requests_total{service=\"hasura-service\", result=\"failure\"}[$__rate_interval])",
"interval": "2m",
"legendFormat": "{{operation}}::{{ name }}::{{field}}",
"legendFormat": "{{ print "{{operation}}::{{ name }}::{{field}}" }}",
"range": true,
"refId": "A"
}
@@ -676,7 +676,9 @@
],
"schemaVersion": 37,
"style": "dark",
"tags": [],
"tags": [
"nhost"
],
"templating": {
"list": []
},

View File

@@ -1,35 +1,4 @@
{
"__inputs": [
{
"name": "DS_PROMETHEUS",
"label": "Prometheus",
"description": "",
"type": "datasource",
"pluginId": "prometheus",
"pluginName": "Prometheus"
}
],
"__elements": {},
"__requires": [
{
"type": "grafana",
"id": "grafana",
"name": "Grafana",
"version": "9.2.0"
},
{
"type": "datasource",
"id": "prometheus",
"name": "Prometheus",
"version": "1.0.0"
},
{
"type": "panel",
"id": "timeseries",
"name": "Time series",
"version": ""
}
],
"annotations": {
"list": [
{
@@ -75,7 +44,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"description": "Number of requests by method/function",
"fieldConfig": {
@@ -153,13 +122,13 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"editorMode": "code",
"expr": "sum by(method, ingress) (increase(nginx_ingress_controller_requests{method=~\"$method\",ingress=~\"$ingress\"}[$__rate_interval]))",
"format": "time_series",
"interval": "2m",
"legendFormat": "{{method}} {{ingress}}",
"legendFormat": "{{ print "{{method}} {{ingress}}" }}",
"range": true,
"refId": "A"
}
@@ -170,7 +139,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"description": "Number of requests by status response",
"fieldConfig": {
@@ -248,13 +217,13 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"editorMode": "code",
"expr": "sum by(status) (increase(nginx_ingress_controller_requests{method=~\"$method\",ingress=~\"$ingress\"}[$__rate_interval]))",
"format": "time_series",
"interval": "2m",
"legendFormat": "{{status}}",
"legendFormat": "{{ print "{{status}}" }}",
"range": true,
"refId": "A"
}
@@ -265,7 +234,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"description": "",
"fieldConfig": {
@@ -344,12 +313,12 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"editorMode": "code",
"expr": "sum by(ingress, method) (increase(nginx_ingress_controller_response_size_sum{ingress=~\"$ingress\",method=~\"$method\"}[$__rate_interval])) / sum by(ingress, method) (increase(nginx_ingress_controller_requests{ingress=~\"$ingress\",method=~\"$method\"}[$__rate_interval]))",
"interval": "2m",
"legendFormat": "{{ method }} - {{ ingress }}",
"legendFormat": "{{ print "{{method}} {{ingress}}" }}",
"range": true,
"refId": "A"
}
@@ -360,7 +329,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"fieldConfig": {
"defaults": {
@@ -427,7 +396,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"editorMode": "code",
"exemplar": false,
@@ -435,7 +404,7 @@
"format": "table",
"instant": true,
"interval": "2m",
"legendFormat": "{{ingress}} {{method}}",
"legendFormat": "{{ print "{{method}} {{ingress}}" }}",
"range": false,
"refId": "A"
}
@@ -460,7 +429,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"description": "",
"fieldConfig": {
@@ -539,12 +508,12 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"editorMode": "code",
"expr": "sum by(method, ingress) (increase(nginx_ingress_controller_response_duration_seconds_sum{method=~\"$method\", ingress=~\"$ingress\"}[$__rate_interval])) / sum by(method, ingress) (increase(nginx_ingress_controller_response_duration_seconds_count{method=~\"$method\", ingress=~\"$ingress\"}[$__rate_interval]))",
"interval": "2m",
"legendFormat": "{{ ingress }} - {{ method }}",
"legendFormat": "{{ print "{{method}} {{ingress}}" }}",
"range": true,
"refId": "A"
}
@@ -568,7 +537,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"description": "Number of requests that failed divided by the total number of requests",
"fieldConfig": {
@@ -647,13 +616,13 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"editorMode": "code",
"expr": "sum by(ingress,method) (increase(nginx_ingress_controller_requests{ingress=~\"$ingress\",method=~\"$method\",status=~\"^[4-5].*\"}[$__rate_interval])) / sum by(ingress, method) (increase(nginx_ingress_controller_requests[$__rate_interval]))",
"format": "time_series",
"interval": "2m",
"legendFormat": "{{method}} {{ ingress }}",
"legendFormat": "{{ print "{{method}} {{ingress}}" }}",
"range": true,
"refId": "A"
}
@@ -664,7 +633,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"fieldConfig": {
"defaults": {
@@ -731,7 +700,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
"uid": "nhost"
},
"editorMode": "code",
"exemplar": false,
@@ -739,7 +708,7 @@
"format": "table",
"instant": true,
"interval": "2m",
"legendFormat": "{{ingress}} {{method}}",
"legendFormat": "{{ print "{{method}} {{ingress}}" }}",
"range": false,
"refId": "A"
}
@@ -751,7 +720,9 @@
],
"schemaVersion": 37,
"style": "dark",
"tags": [],
"tags": [
"nhost"
],
"templating": {
"list": [
{
@@ -802,4 +773,4 @@
"uid": "WOWEHb7Sz",
"version": 16,
"weekStart": ""
}
}

View File

@@ -1,41 +1,4 @@
{
"__inputs": [
{
"name": "DS_PROMETHEUS",
"label": "Prometheus",
"description": "",
"type": "datasource",
"pluginId": "prometheus",
"pluginName": "Prometheus"
}
],
"__elements": {},
"__requires": [
{
"type": "grafana",
"id": "grafana",
"name": "Grafana",
"version": "9.2.0"
},
{
"type": "datasource",
"id": "prometheus",
"name": "Prometheus",
"version": "1.0.0"
},
{
"type": "panel",
"id": "text",
"name": "Text",
"version": ""
},
{
"type": "panel",
"id": "timeseries",
"name": "Time series",
"version": ""
}
],
"annotations": {
"list": [
{
@@ -62,7 +25,6 @@
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": null,
"links": [],
"liveNow": false,
"panels": [
@@ -82,7 +44,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"gridPos": {
"h": 11,
@@ -100,13 +62,13 @@
"content": "This dashboard shows the overall resources used by every service in your project.\n\nMetrics service is currently in **beta** so things may change.\n\nKeep in mind that while you might be change settings, edit the dashboard or even create new ones these changes are not persisted. If you want to have different settings or even your own dashboards, please, contact us as we are looking for use cases to build the feature.\n\nDocumentation about our platform:\n\n- [Compute Resources](https://docs.nhost.io/platform/compute)\n- [Service Replicas](https://docs.nhost.io/platform/service-replicas)",
"mode": "markdown"
},
"pluginVersion": "9.2.0",
"pluginVersion": "11.2.0",
"type": "text"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"gridPos": {
"h": 11,
@@ -124,7 +86,7 @@
"content": "#### Pods\n\nEach service is comprised by at least one \"pod\" and, in the case of [replicas](https://docs.nhost.io/platform/service-replicas), you should see as many pods as replicas configured. Each pod is identified by the sevice name + some unique identifier, for instance, `\nhasura-auth-7995bfd767-mvthp`.\n\nPods can come and go for various reasons:\n\n1. When there is a configuration change. When this happens a new pod is created witht he new configuration. After the new pod is ready the old one is decommissioned. This means changes in configuration are hitless. The exception is postgres, when postgres configuration changes we need to bring it down cleanly before we start a new one so there is a short donwtime while this occurrs (1-2 min).\n2. When the process crashes due to an unexpected error. In this case the platform should detect the event and create a new pod immediately.\n3. When the process exceeds its allotted memory the pod is terminated and a new one is created.\n\n#### Throttling\n\nAs pro projects have shared CPUs services can throttle when they attempt to use more resources than they have available. Throttling metrics are hard to grasp but it is important to understand they can have a big impact on response times. Thottling happens in internvals of time (100ms) so it is important to look at both the throttling time and throttling % metrics. If the % is low throttling time might not be very impactful but the higher the percentage gets the higher the impact it can have.\n\nTo avoid throttling consider using [dedicated compute resources](https://docs.nhost.io/platform/compute#dedicated-compute)",
"mode": "markdown"
},
"pluginVersion": "9.2.0",
"pluginVersion": "11.2.0",
"type": "text"
},
{
@@ -143,7 +105,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"description": "CPU utilization is calculated by calculating the average usage between two datapoints. At maximum granularity this is a 1 minute average, but when selecting longer periods of time granularity can decrease.\n\nGiven that the graph shows average usage it might be difficult to detect very sudden spikes.",
"fieldConfig": {
@@ -152,11 +114,13 @@
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
@@ -165,6 +129,7 @@
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
@@ -222,7 +187,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"editorMode": "code",
"expr": "sum by(pod) (irate(container_cpu_usage_seconds_total{container!~\"POD|\"}[$__rate_interval])) * 1000",
@@ -238,7 +203,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"fieldConfig": {
"defaults": {
@@ -246,11 +211,13 @@
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
@@ -259,6 +226,7 @@
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
@@ -316,7 +284,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"editorMode": "code",
"expr": "sum by (pod) (container_memory_usage_bytes{container!~\"POD|\"})",
@@ -331,7 +299,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"description": "When a service lacks resources the process is throttled until resources are available again.\n\nThis graph shows for how long pods are being throttled. This can incur in added latency to requests.",
"fieldConfig": {
@@ -340,11 +308,13 @@
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
@@ -353,6 +323,7 @@
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
@@ -411,7 +382,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"editorMode": "code",
"expr": "sum by(pod) (rate(container_cpu_cfs_throttled_seconds_total{container!~\"POD|\"}[$__rate_interval]))",
@@ -428,7 +399,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"description": "When a service lacks resources the process is throttled until resources are available again.\n\nThis graph shows how often the process is being throttled. As throttling happens in intervals of 100ms here you can see how many of those intervals required throttling.",
"fieldConfig": {
@@ -437,11 +408,13 @@
"mode": "palette-classic"
},
"custom": {
"axisBorderShow": false,
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"barWidthFactor": 0.6,
"drawStyle": "line",
"fillOpacity": 0,
"gradientMode": "none",
@@ -450,6 +423,7 @@
"tooltip": false,
"viz": false
},
"insertNulls": false,
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
@@ -508,7 +482,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"editorMode": "code",
"expr": "sum by(pod) (rate(container_cpu_cfs_throttled_periods_total{container!~\"POD|\"}[$__rate_interval]))/sum by(pod) (rate(container_cpu_cfs_periods_total{container!~\"POD|\"}[$__rate_interval]))",
@@ -525,7 +499,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"fieldConfig": {
"defaults": {
@@ -567,8 +541,7 @@
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
"color": "green"
},
{
"color": "red",
@@ -603,7 +576,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"editorMode": "code",
"expr": "sum by(pod) (rate(container_network_transmit_bytes_total[$__rate_interval]))",
@@ -615,7 +588,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"editorMode": "code",
"expr": "- sum by(pod) (rate(container_network_receive_bytes_total[$__rate_interval]))",
@@ -632,7 +605,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"description": "This graph shows when a service was restarted. There are two main reasons why a service may be restarted:\n\n- OOMKilled - This means the service tried to use more memory than it has available and had to be restarted. For more information on resources you can check the [documentation](https://docs.nhost.io/platform/compute).\n- Error - This can show for mainly two reasons; when new configuration needs to be applied the service is terminated and due to limitations this shows as \"Error\" but it is, in fact, part of normal operations. This can also show if your service is misconfigured and/or can't start correctly for some reason. If this error doesn't show constantly it is safe to ignore this error.",
"fieldConfig": {
@@ -676,8 +649,7 @@
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
"color": "green"
},
{
"color": "red",
@@ -712,13 +684,13 @@
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"editorMode": "code",
"expr": "sum by(container, reason) (increase(pod_terminated_total[$__rate_interval]))",
"hide": false,
"interval": "2m",
"legendFormat": "{{container}}-{{reason}}",
"legendFormat": "{{ print "{{container}}-{{reason}}" }}",
"range": true,
"refId": "A"
}
@@ -729,7 +701,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"fieldConfig": {
"defaults": {
@@ -771,8 +743,7 @@
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
"color": "green"
},
{
"color": "red",
@@ -807,7 +778,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"editorMode": "code",
"expr": "sum by(ingress) (irate(nginx_ingress_controller_response_size_sum[$__rate_interval]))",
@@ -819,7 +790,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"editorMode": "code",
"expr": "sum(irate(fastly_prom_exporter_bytes_sent[$__rate_interval]))",
@@ -836,7 +807,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"fieldConfig": {
"defaults": {
@@ -878,8 +849,7 @@
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
"color": "green"
},
{
"color": "red",
@@ -913,7 +883,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"editorMode": "builder",
"expr": "sum by(ingress) (irate(nginx_ingress_controller_requests[$__interval]))",
@@ -925,7 +895,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"editorMode": "builder",
"expr": "sum(irate(fastly_prom_exporter_requests_total[$__interval]))",
@@ -955,7 +925,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"description": "CPU utilization is calculated by calculating the average usage between two datapoints. At maximum granularity this is a 1 minute average, but when selecting longer periods of time granularity can decrease.\n\nGiven that the graph shows average usage it might be difficult to detect very sudden spikes.\n\nThe allotted line indicates how many CPU cycles are dedicated for the service. As free and pro projects have only shared CPU this line should show only a symbolic number. For projects with [dedicated compute resources](https://docs.nhost.io/platform/compute) this line should match the amount of resources configured.",
"fieldConfig": {
@@ -998,8 +968,7 @@
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
"color": "green"
},
{
"color": "red",
@@ -1033,24 +1002,24 @@
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"editorMode": "code",
"expr": "sum by(pod) (irate(container_cpu_usage_seconds_total{container=\"postgres\"}[$__rate_interval])) * 1000",
"interval": "2m",
"legendFormat": "{{pod}}-used",
"legendFormat": "{{ print "{{pod}}-used" }}",
"range": true,
"refId": "A"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"editorMode": "code",
"expr": "sum by(pod) (container_spec_cpu_shares{container=\"postgres\"}) / 1.024",
"hide": false,
"legendFormat": "{{pod}}-allotted",
"legendFormat": "{{ print "{{pod}}-alloted" }}",
"range": true,
"refId": "B"
}
@@ -1061,7 +1030,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"description": "This graph shows memory utilization for the service. The allotted line shows what's the amount of memory a service is allowed to consume. As resources are shared there is the possibility that the actual memory available is slightly lower. If a service exceeds the amount of memory it can use, it is restarted automatically.",
"fieldConfig": {
@@ -1104,8 +1073,7 @@
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
"color": "green"
},
{
"color": "red",
@@ -1140,24 +1108,24 @@
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"editorMode": "code",
"expr": "sum by(pod) (container_memory_usage_bytes{container=\"postgres\"})",
"hide": false,
"legendFormat": "{{pod}}-used",
"legendFormat": "{{ print "{{pod}}-used" }}",
"range": true,
"refId": "A"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"editorMode": "code",
"expr": "sum by(pod) (container_spec_memory_limit_bytes{container=\"postgres\"})",
"hide": false,
"legendFormat": "{{pod}}-allotted",
"legendFormat": "{{ print "{{pod}}-alloted" }}",
"range": true,
"refId": "B"
}
@@ -1168,7 +1136,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"description": "This shows the amount of data utilized by the postgres volume. This number may differ from the database size reported by postgres depending on the features configured. For instance, when archiving is enabled postgres needs to write on disk a lot of supporting files which might lead to big increase in disk usage.\n\nWhen postgres runs out of disk space it fails to start so it is important to ensure you don't fill the volume. If you need to increase your disk capacity don't hesitate to let us know.",
"fieldConfig": {
@@ -1211,8 +1179,7 @@
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
"color": "green"
},
{
"color": "red",
@@ -1247,7 +1214,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"editorMode": "code",
"expr": "kubelet_volume_stats_used_bytes{persistentvolumeclaim=\"postgres-pv-claim\"}",
@@ -1258,7 +1225,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"editorMode": "code",
"expr": "kubelet_volume_stats_capacity_bytes{persistentvolumeclaim=\"postgres-pv-claim\"}",
@@ -1274,7 +1241,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"fieldConfig": {
"defaults": {
@@ -1316,8 +1283,7 @@
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
"color": "green"
},
{
"color": "red",
@@ -1352,7 +1318,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"editorMode": "code",
"expr": "sum by(pod) (rate(container_fs_reads_bytes_total{container=\"postgres\"}[$__rate_interval]))",
@@ -1364,7 +1330,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"editorMode": "code",
"expr": "sum by(pod) (rate(container_fs_writes_bytes_total{container=\"postgres\"}[$__rate_interval]))",
@@ -1394,7 +1360,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"description": "CPU utilization is calculated by calculating the average usage between two datapoints. At maximum granularity this is a 1 minute average, but when selecting longer periods of time granularity can decrease.\n\nGiven that the graph shows average usage it might be difficult to detect very sudden spikes.\n\nThe allotted line indicates how many CPU cycles are dedicated for the service. As free and pro projects have only shared CPU this line should show only a symbolic number. For projects with [dedicated compute resources](https://docs.nhost.io/platform/compute) this line should match the amount of resources configured.",
"fieldConfig": {
@@ -1437,8 +1403,7 @@
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
"color": "green"
},
{
"color": "red",
@@ -1472,24 +1437,24 @@
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"editorMode": "code",
"expr": "sum by(pod) (irate(container_cpu_usage_seconds_total{container=\"hasura\"}[$__rate_interval])) * 1000",
"interval": "2m",
"legendFormat": "{{pod}}-used",
"legendFormat": "{{ print "{{pod}}-used" }}",
"range": true,
"refId": "A"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"editorMode": "code",
"expr": "sum by(pod) (container_spec_cpu_shares{container=\"hasura\"}) / 1.024",
"hide": false,
"legendFormat": "{{pod}}-allotted",
"legendFormat": "{{ print "{{pod}}-alloted" }}",
"range": true,
"refId": "B"
}
@@ -1500,7 +1465,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"description": "This graph shows memory utilization for the service. The allotted line shows what's the amount of memory a service is allowed to consume. As resources are shared there is the possibility that the actual memory available is slightly lower. If a service exceeds the amount of memory it can use, it is restarted automatically.",
"fieldConfig": {
@@ -1543,8 +1508,7 @@
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
"color": "green"
},
{
"color": "red",
@@ -1579,24 +1543,24 @@
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"editorMode": "code",
"expr": "sum by(pod) (container_memory_usage_bytes{container=\"hasura\"})",
"hide": false,
"legendFormat": "{{pod}}-used",
"legendFormat": "{{ print "{{pod}}-used" }}",
"range": true,
"refId": "A"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"editorMode": "code",
"expr": "sum by(pod) (container_spec_memory_limit_bytes{container=\"hasura\"})",
"hide": false,
"legendFormat": "{{pod}}-allotted",
"legendFormat": "{{ print "{{pod}}-alloted" }}",
"range": true,
"refId": "B"
}
@@ -1620,7 +1584,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"description": "CPU utilization is calculated by calculating the average usage between two datapoints. At maximum granularity this is a 1 minute average, but when selecting longer periods of time granularity can decrease.\n\nGiven that the graph shows average usage it might be difficult to detect very sudden spikes.\n\nThe allotted line indicates how many CPU cycles are dedicated for the service. As free and pro projects have only shared CPU this line should show only a symbolic number. For projects with [dedicated compute resources](https://docs.nhost.io/platform/compute) this line should match the amount of resources configured.",
"fieldConfig": {
@@ -1663,8 +1627,7 @@
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
"color": "green"
},
{
"color": "red",
@@ -1698,24 +1661,24 @@
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"editorMode": "code",
"expr": "sum by(pod) (irate(container_cpu_usage_seconds_total{container=\"hasura-auth\"}[$__rate_interval])) * 1000",
"interval": "2m",
"legendFormat": "{{pod}}-used",
"legendFormat": "{{ print "{{pod}}-used" }}",
"range": true,
"refId": "A"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"editorMode": "code",
"expr": "sum by(pod) (container_spec_cpu_shares{container=\"hasura-auth\"}) / 1.024",
"hide": false,
"legendFormat": "{{pod}}-allotted",
"legendFormat": "{{ print "{{pod}}-alloted" }}",
"range": true,
"refId": "B"
}
@@ -1726,7 +1689,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"description": "This graph shows memory utilization for the service. The allotted line shows what's the amount of memory a service is allowed to consume. As resources are shared there is the possibility that the actual memory available is slightly lower. If a service exceeds the amount of memory it can use, it is restarted automatically.",
"fieldConfig": {
@@ -1769,8 +1732,7 @@
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
"color": "green"
},
{
"color": "red",
@@ -1805,24 +1767,24 @@
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"editorMode": "code",
"expr": "sum by(pod) (container_memory_usage_bytes{container=\"hasura-auth\"})",
"hide": false,
"legendFormat": "{{pod}}-used",
"legendFormat": "{{ print "{{pod}}-used" }}",
"range": true,
"refId": "A"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"editorMode": "code",
"expr": "sum by(pod) (container_spec_memory_limit_bytes{container=\"hasura-auth\"})",
"hide": false,
"legendFormat": "{{pod}}-allotted",
"legendFormat": "{{ print "{{pod}}-alloted" }}",
"range": true,
"refId": "B"
}
@@ -1846,7 +1808,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"description": "CPU utilization is calculated by calculating the average usage between two datapoints. At maximum granularity this is a 1 minute average, but when selecting longer periods of time granularity can decrease.\n\nGiven that the graph shows average usage it might be difficult to detect very sudden spikes.\n\nThe allotted line indicates how many CPU cycles are dedicated for the service. As free and pro projects have only shared CPU this line should show only a symbolic number. For projects with [dedicated compute resources](https://docs.nhost.io/platform/compute) this line should match the amount of resources configured.",
"fieldConfig": {
@@ -1889,8 +1851,7 @@
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
"color": "green"
},
{
"color": "red",
@@ -1924,24 +1885,24 @@
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"editorMode": "code",
"expr": "sum by(pod) (irate(container_cpu_usage_seconds_total{container=\"hasura-storage\"}[$__rate_interval])) * 1000",
"interval": "2m",
"legendFormat": "{{pod}}-used",
"legendFormat": "{{ print "{{pod}}-used" }}",
"range": true,
"refId": "A"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"editorMode": "code",
"expr": "sum by(pod) (container_spec_cpu_shares{container=\"hasura-storage\"}) / 1.024",
"hide": false,
"legendFormat": "{{pod}}-allotted",
"legendFormat": "{{ print "{{pod}}-alloted" }}",
"range": true,
"refId": "B"
}
@@ -1952,7 +1913,7 @@
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"description": "This graph shows memory utilization for the service. The allotted line shows what's the amount of memory a service is allowed to consume. As resources are shared there is the possibility that the actual memory available is slightly lower. If a service exceeds the amount of memory it can use, it is restarted automatically.",
"fieldConfig": {
@@ -1995,8 +1956,7 @@
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
"color": "green"
},
{
"color": "red",
@@ -2031,24 +1991,24 @@
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"editorMode": "code",
"expr": "sum by(pod) (container_memory_usage_bytes{container=\"hasura-storage\"})",
"hide": false,
"legendFormat": "{{pod}}-used",
"legendFormat": "{{ print "{{pod}}-used" }}",
"range": true,
"refId": "A"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
"uid": "nhost"
},
"editorMode": "code",
"expr": "sum by(pod) (container_spec_memory_limit_bytes{container=\"hasura-storage\"})",
"hide": false,
"legendFormat": "{{pod}}-allotted",
"legendFormat": "{{ print "{{pod}}-alloted" }}",
"range": true,
"refId": "B"
}
@@ -2057,31 +2017,12 @@
"type": "timeseries"
}
],
"schemaVersion": 37,
"style": "dark",
"schemaVersion": 39,
"tags": [
"nhost"
],
"templating": {
"list": [
{
"current": {
"selected": false,
"text": "Prometheus",
"value": "Prometheus"
},
"hide": 2,
"includeAll": false,
"multi": false,
"name": "DS_PROMETHEUS",
"options": [],
"query": "prometheus",
"refresh": 1,
"regex": "Prometheus",
"skipUrlSync": false,
"type": "datasource"
}
]
"list": []
},
"time": {
"from": "now-6h",

View File

@@ -0,0 +1,10 @@
apiVersion: 1
providers:
- disableDeletion: false
editable: false
folder: "Nhost - {{ .Subdomain }} ({{ .ProjectName }})"
name: default
options:
path: /var/lib/grafana/dashboards/default
orgId: 1
type: file

View File

@@ -0,0 +1,17 @@
apiVersion: 1
datasources:
- access: proxy
isDefault: true
name: Nhost
type: prometheus
url: http://amp-signer.nhost-services:8080
uid: nhost
jsonData:
customQueryParameters: app_id=${APP_ID}
httpHeaderName1: 'Authorization'
manageAlerts: false
cacheLevel: 'High'
disableRecordingRules: true
timeInterval: '60s'
secureJsonData:
httpHeaderValue1: 'Bearer ${TOKEN}'

View File

@@ -0,0 +1,23 @@
[analytics]
check_for_updates = false
[grafana_net]
url = https://grafana.net
[log]
mode = console
[paths]
data = /var/lib/grafana/
logs = /var/log/grafana
plugins = /var/lib/grafana/plugins
provisioning = /var/lib/grafana/provisioning
[server]
domain = ''
root_url = '{{ .RootURL }}'
{{ if .SMTP }}
[smtp]
enabled=true
host={{ .SMTP.Host }}:{{ .SMTP.Port }}
user={{ .SMTP.User }}
password={{ .SMTP.Password }}
from_address={{ .SMTP.Sender }}
{{ end }}

View File

@@ -0,0 +1,7 @@
apiVersion: 1
policies:
- orgId: 1
receiver: Nhost Managed Contacts
group_by:
- grafana_folder
- alertname

View File

@@ -0,0 +1,369 @@
apiVersion: 1
groups:
- orgId: 1
name: core
folder: "Nhost - {{ .Subdomain }} ({{ .ProjectName }})"
interval: 5m
rules:
- uid: nhosthighcpuusage
title: High CPU usage
condition: B
data:
- refId: A
relativeTimeRange:
from: 600
to: 0
datasourceUid: nhost
model:
editorMode: code
expr: sum by(pod) (irate(container_cpu_usage_seconds_total{container!~"grafana|POD|"}[$__rate_interval])) / (sum by(pod) (container_spec_cpu_quota{container!~"grafana|POD|"}) / sum by(pod) (container_spec_cpu_period{container!~"POD|"})) * 100
instant: true
intervalMs: 1000
legendFormat: __auto
maxDataPoints: 43200
range: false
refId: A
- refId: B
relativeTimeRange:
from: 600
to: 0
datasourceUid: __expr__
model:
conditions:
- evaluator:
params:
- 75
type: gt
operator:
type: and
query:
params:
- C
reducer:
params: []
type: last
type: query
datasource:
type: __expr__
uid: __expr__
expression: A
intervalMs: 1000
maxDataPoints: 43200
refId: B
type: threshold
noDataState: NoData
execErrState: Error
for: 5m
annotations:
runbook_url: https://docs.nhost.io/platform/compute-resources
Project Subdomain: {{ .Subdomain }}
Project Name: {{ .ProjectName }}
description: |
High CPU usage can be caused by a number of factors, including but not limited to:
- High traffic
- Inefficient code/queries
- Inadequate resources
To resolve this issue, consider the following:
- Optimize your code/queries
- Increase the number of replicas
- Increase the CPU resources allocated to your service
High CPU usage can lead to service instability, increased latency and downtime.
For more information, see the [Nhost documentation](https://docs.nhost.io/platform/compute-resources)
summary: |
The service replica {{ print "{{ index $labels \"pod\" }}" }} is experiencing, or has experienced, high CPU usage. Current usage is at {{ print "{{ index $values \"A\" }}" }}%.
labels: {}
isPaused: false
- uid: nhostlowdiskspace
title: Low disk space
condition: B
data:
- refId: A
relativeTimeRange:
from: 600
to: 0
datasourceUid: nhost
model:
editorMode: code
expr: sum by(persistentvolumeclaim) (kubelet_volume_stats_used_bytes) / sum by(persistentvolumeclaim) (kubelet_volume_stats_capacity_bytes) * 100
instant: true
intervalMs: 1000
legendFormat: __auto
maxDataPoints: 43200
range: false
refId: A
- refId: B
relativeTimeRange:
from: 600
to: 0
datasourceUid: __expr__
model:
conditions:
- evaluator:
params:
- 75
type: gt
operator:
type: and
query:
params:
- C
reducer:
params: []
type: last
type: query
datasource:
type: __expr__
uid: __expr__
expression: A
intervalMs: 1000
maxDataPoints: 43200
refId: B
type: threshold
noDataState: NoData
execErrState: Error
for: 5m
annotations:
runbook_url: https://docs.nhost.io/guides/database/configuring-postgres
Subdomain: {{ .Subdomain }}
Project Name: {{ .ProjectName }}
description: |
An increase in disk space usage can be caused by a number of factors, including but not limited to:
- Large amounts of data
- Changing in WAL settings
To resolve this issue, consider the following:
- If you recently changed your WAL settings, consider reverting to the previous settings
- Optimize your database tables
- Remove data that is no longer needed
- Increase the disk space allocated to your database
Running out of disk space can lead to service downtime and potential data loss.
For more information, see the [Nhost documentation](https://docs.nhost.io/guides/database/configuring-postgres)
summary: |
The persistent volume claim {{ print "{{ index $labels \"persistentvolumeclaim\" }}" }} current usage is at {{ print "{{ index $values \"A\" }}" }}%.
labels: {}
isPaused: false
- uid: nhostlowmemory
title: Low free memory
condition: B
data:
- refId: A
relativeTimeRange:
from: 600
to: 0
datasourceUid: nhost
model:
editorMode: code
expr: sum by(pod) (container_memory_usage_bytes{container!~"grafana|"}) / sum by(pod) (container_spec_memory_limit_bytes{container!~"grafana|"}) * 100
instant: true
intervalMs: 1000
legendFormat: __auto
maxDataPoints: 43200
range: false
refId: A
- refId: B
relativeTimeRange:
from: 600
to: 0
datasourceUid: __expr__
model:
conditions:
- evaluator:
params:
- 75
type: gt
operator:
type: and
query:
params:
- C
reducer:
params: []
type: last
type: query
datasource:
type: __expr__
uid: __expr__
expression: A
intervalMs: 1000
maxDataPoints: 43200
refId: B
type: threshold
noDataState: NoData
execErrState: Error
for: 5m
annotations:
runbook_url: https://docs.nhost.io/platform/compute-resources
Subdomain: {{ .Subdomain }}
Project Name: {{ .ProjectName }}
description: |
Low memory can be caused by a number of factors, including but not limited to:
- High traffic
- Inefficient code/queries
- Inadequate resources
To resolve this issue, consider the following:
- Optimize your code/queries
- Increase the memory resources allocated to your service
Running out of memory can lead to service instability, increased latency and downtime.
For more information, see the [Nhost documentation](https://docs.nhost.io/platform/compute-resources)
summary: |
The service replica {{ print "{{ index $labels \"pod\" }}" }} is experiencing, or has experienced, low memory. Current usage is at {{ print "{{ index $values \"A\" }}" }}%.
labels: {}
isPaused: false
- uid: nhostoom
title: Service restarted due to lack of memory
condition: B
data:
- refId: A
relativeTimeRange:
from: 600
to: 0
datasourceUid: nhost
model:
editorMode: code
expr: sum by(pod) (increase(pod_terminated_total{reason="OOMKilled", pod!="grafana"}[$__rate_interval]))
instant: true
intervalMs: 1000
legendFormat: __auto
maxDataPoints: 43200
range: false
refId: A
- refId: B
relativeTimeRange:
from: 600
to: 0
datasourceUid: __expr__
model:
conditions:
- evaluator:
params:
- 0
type: gt
operator:
type: and
query:
params:
- C
reducer:
params: []
type: last
type: query
datasource:
type: __expr__
uid: __expr__
expression: A
intervalMs: 1000
maxDataPoints: 43200
refId: B
type: threshold
noDataState: OK
execErrState: Error
for: 0s
annotations:
summary: |
The service replica {{ print "{{ index $labels \"pod\" }}" }} has been restarted due to lack of memory.
description: |
When a service runs out of memory and is unable to allocate more, it is terminated by the
OOM Killer. This is primarily caused by trying to allocate more memory than is permitted,
which in turn can be caused by:
- High traffic
- Inefficient code/queries
- Inadequate resources
To resolve this issue, consider the following:
- Optimize your code/queries
- Increase the memory resources allocated to your service
This can lead to service instability, increased latency and downtime.
For more information, see the [Nhost documentation](https://docs.nhost.io/platform/compute-resources)
runbook_url: https://docs.nhost.io/platform/compute-resources
Subdomain: {{ .Subdomain }}
Project Name: {{ .ProjectName }}
labels: {}
isPaused: false
- uid: nhosthigherrorrate
title: High request error rate
condition: B
data:
- refId: A
relativeTimeRange:
from: 600
to: 0
datasourceUid: nhost
model:
editorMode: code
expr: sum by(ingress,method) (increase(nginx_ingress_controller_requests{ingress!="grafana",status=~"^[4-5].*"}[$__rate_interval])) / sum by(ingress, method) (increase(nginx_ingress_controller_requests[$__rate_interval])) * 100
instant: true
intervalMs: 1000
legendFormat: __auto
maxDataPoints: 43200
range: false
refId: A
- refId: B
relativeTimeRange:
from: 600
to: 0
datasourceUid: __expr__
model:
conditions:
- evaluator:
params:
- 25
type: gt
operator:
type: and
query:
params:
- C
reducer:
params: []
type: last
type: query
datasource:
type: __expr__
uid: __expr__
expression: A
intervalMs: 1000
maxDataPoints: 43200
refId: B
type: threshold
noDataState: OK
execErrState: Error
for: 5m
annotations:
Subdomain: {{ .Subdomain }}
Project Name: {{ .ProjectName }}
summary: |
The service {{ print "{{ index $labels \"ingress\" }}" }} is experiencing, or has experienced, a high error rate. Current error rate is at {{ print "{{ index $values \"A\" }}" }}%.
description: |
A high error rate can be caused by a number of factors, including but not limited to:
- High traffic
- Inefficient code/queries
- Inadequate resources
- Network issues
- Code errors
- Permission issues
To resolve this issue, consider the following:
- Observe the service logs for more information
A high error rate means there is something fundamentally wrong with the service or your application. It can lead to service instability, increased latency and downtime.
For more information, see the [Nhost documentation](https://docs.nhost.io/platform/compute-resources)
labels: {}
isPaused: false

View File

@@ -0,0 +1,11 @@
#!/usr/bin/env sh
set -euf
mkdir -p /var/lib/grafana/provisioning/datasources
TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)
APP_ID=$(sed "s/nhost-//g" /var/run/secrets/kubernetes.io/serviceaccount/namespace)
sed "s/\${TOKEN}/$TOKEN/g; s/\${APP_ID}/$APP_ID/g" \
< /datasources.yaml.tmpl \
> /var/lib/grafana/provisioning/datasources/datasources.yaml

View File

@@ -83,7 +83,7 @@
"turbo": "1.11.3",
"typedoc": "^0.22.18",
"typescript": "4.9.5",
"vite": "^5.2.13",
"vite": "^5.4.6",
"vite-plugin-dts": "^3.9.1",
"vite-tsconfig-paths": "^4.3.2",
"vitest": "^0.32.4"
@@ -154,7 +154,10 @@
"nth-check": "^2.0.1",
"react": "18.2.0",
"react-dom": "18.2.0",
"@graphiql/react": "^0.22.3"
"@graphiql/react": "^0.22.3",
"send": "^0.19.0",
"dset": "^3.1.4",
"rollup": "^4.22.4"
}
}
}

View File

@@ -1,5 +1,11 @@
# @nhost/hasura-auth-js
## 2.6.0
### Minor Changes
- 55d8bb5: feat: support custom headers in sign-up and deanonymize requests
## 2.5.6
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/hasura-auth-js",
"version": "2.5.6",
"version": "2.6.0",
"description": "Hasura-auth client",
"license": "MIT",
"keywords": [

View File

@@ -1,6 +1,7 @@
import type {
NhostSession,
PasswordlessOptions,
RequestOptions,
SignUpOptions,
SignUpSecurityKeyOptions
} from '../../types'
@@ -23,7 +24,13 @@ export type AuthEvents =
options?: PasswordlessOptions
}
| { type: 'PASSWORDLESS_SMS_OTP'; phoneNumber?: string; otp?: string }
| { type: 'SIGNUP_EMAIL_PASSWORD'; email?: string; password?: string; options?: SignUpOptions }
| {
type: 'SIGNUP_EMAIL_PASSWORD'
email?: string
password?: string
options?: SignUpOptions
requestOptions?: RequestOptions
}
| { type: 'SIGNUP_SECURITY_KEY'; email?: string; options?: SignUpSecurityKeyOptions }
| { type: 'SIGNOUT'; all?: boolean }
| { type: 'SIGNIN_MFA_TOTP'; ticket?: string; otp?: string }

View File

@@ -34,6 +34,7 @@ import {
PasswordlessSmsOtpResponse,
PasswordlessSmsResponse,
RefreshSessionResponse,
RequestOptions,
SignInAnonymousResponse,
SignInMfaTotpResponse,
SignInPATResponse,
@@ -92,9 +93,10 @@ export const createAuthMachine = ({
const postRequest = async <T = any, D = any>(
url: string,
data?: D,
token?: string | null
token?: string | null,
headers?: Record<string, string>
): Promise<T> => {
const result = await postFetch<T>(`${backendUrl}${url}`, data, token)
const result = await postFetch<T>(`${backendUrl}${url}`, data, token, headers)
return result.data
}
@@ -910,13 +912,14 @@ export const createAuthMachine = ({
return signOutResponse
},
signUpEmailPassword: async (context, { email, password, options }) => {
signUpEmailPassword: async (context, { email, password, options, requestOptions }) => {
if (!isValidEmail(email)) {
return Promise.reject<SignUpResponse>({ error: INVALID_EMAIL_ERROR })
}
if (!isValidPassword(password)) {
return Promise.reject<SignUpResponse>({ error: INVALID_PASSWORD_ERROR })
}
if (context.user?.isAnonymous) {
return postRequest<SignUpResponse>(
'/user/deanonymize',
@@ -926,14 +929,20 @@ export const createAuthMachine = ({
password,
options: rewriteRedirectTo(clientUrl, options)
},
context.accessToken.value
context.accessToken.value,
requestOptions?.headers
)
} else {
return postRequest<SignUpResponse>('/signup/email-password', {
email,
password,
options: rewriteRedirectTo(clientUrl, options)
})
return postRequest<SignUpResponse>(
'/signup/email-password',
{
email,
password,
options: rewriteRedirectTo(clientUrl, options)
},
null,
requestOptions?.headers
)
}
},
signUpSecurityKey: async (_, { email, options }) => {

View File

@@ -1,6 +1,6 @@
import { USER_ALREADY_SIGNED_IN } from '../errors'
import { AuthInterpreter } from '../machines'
import { SignUpOptions } from '../types'
import { RequestOptions, SignUpOptions } from '../types'
import {
AuthActionLoadingState,
@@ -20,13 +20,15 @@ export const signUpEmailPasswordPromise = (
interpreter: AuthInterpreter,
email: string,
password: string,
options?: SignUpOptions
options?: SignUpOptions,
requestOptions?: RequestOptions
): Promise<SignUpEmailPasswordHandlerResult> =>
new Promise<SignUpEmailPasswordHandlerResult>((resolve) => {
const { changed, context } = interpreter.send('SIGNUP_EMAIL_PASSWORD', {
email,
password,
options
options,
requestOptions
})
if (!changed) {
return resolve({

View File

@@ -57,3 +57,8 @@ export interface WorkOsOptions extends CommonProviderOptions {
provider?: string
}
export interface ProviderOptions extends CommonProviderOptions, WorkOsOptions {}
export interface RequestOptions {
// optional extra headers to be sent with request (ex: x-cf-turnstile-response)
headers?: Record<string, string>
}

View File

@@ -17,7 +17,11 @@ if (typeof EdgeRuntime !== 'string') {
const fetchWrapper = async <T>(
url: string,
method: 'GET' | 'POST',
{ token, body }: { token?: string | null; body?: any } = {}
{
token,
body,
extraHeaders
}: { token?: string | null; body?: any; extraHeaders?: HeadersInit } = {}
): Promise<FetcResponse<T>> => {
const headers: HeadersInit = {
'Content-Type': 'application/json',
@@ -26,9 +30,12 @@ const fetchWrapper = async <T>(
if (token) {
headers['Authorization'] = `Bearer ${token}`
}
const mergedHeaders = { ...headers, ...extraHeaders }
const options: RequestInit = {
method,
headers
headers: mergedHeaders
}
if (body) {
options.body = JSON.stringify(body)
@@ -59,8 +66,9 @@ const fetchWrapper = async <T>(
export const postFetch = async <T>(
url: string,
body: any,
token?: string | null
): Promise<FetcResponse<T>> => fetchWrapper<T>(url, 'POST', { token, body })
token?: string | null,
extraHeaders?: HeadersInit
): Promise<FetcResponse<T>> => fetchWrapper<T>(url, 'POST', { token, body, extraHeaders })
export const getFetch = <T>(url: string, token?: string | null): Promise<FetcResponse<T>> =>
fetchWrapper<T>(url, 'GET', { token })

View File

@@ -1,5 +1,18 @@
# @nhost/nextjs
## 2.1.22
### Patch Changes
- Updated dependencies [55d8bb5]
- @nhost/react@3.6.0
## 2.1.21
### Patch Changes
- 52a38fe: chore: update dependencies to address security vulnerabilities
## 2.1.20
### Patch Changes

Some files were not shown because too many files have changed in this diff Show More