Skip to content

Commit

Permalink
enhance: improve neon docs DA-1235 (#6235)
Browse files Browse the repository at this point in the history
* enhance: imporve neon docs

* feat: add more clarity

* feat: add more context on advanced setup for pulse

* fix: fix broken links
  • Loading branch information
ankur-arch committed Sep 10, 2024
1 parent e500af5 commit ad9955b
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ toc_max_heading_level: 6
toc: true
---

<Admonition>
:::note

Prisma Pulse requires a PostgreSQL (**version 12+**) database with logical replication enabled. To configure specific database providers for Prisma Pulse, visit [here](/pulse/database-setup#provider-specific-instructions).

</Admonition>
:::

Database replication is the process of creating copies of a database and storing them across various on-premises or cloud destinations. Prisma Pulse uses logical replication to monitor your database for changes.

Expand Down Expand Up @@ -69,7 +69,7 @@ ALTER TABLE public."User" REPLICA IDENTITY FULL;

## Manage your own publication slot

If you want to enable replication for _specific models_ or use a database provider that restricts superuser access for Prisma Pulse you can configure your own publication slot and use it to enable Pulse.
By default, Pulse monitors all tables for changes in your database. If you want to enable replication for *specific models* or if you use a database provider that restricts superuser access for Prisma Pulse, you can configure your own publication slot. If you want to configure your own publication slot and enable Pulse, you'll need to opt for one of [our paid plans](https://www.prisma.io/pricing#pulse).

### Creating a publication slot

Expand Down Expand Up @@ -150,9 +150,17 @@ You can submit the publication name in the [Console](https://console.prisma.io/l
SELECT * FROM pg_publication_tables;
```

2. Then you can submit the desired publication name in the Console:
2. Navigate to [Prisma Data Platform](https://pris.ly/pdp) to enable Pulse.

![Submit the publication name in the Console](/img/pulse/replication-slot-submission.png)
3. Submit the database connection string and region in the **Database connection** section.

4. In your project environment configuration for Pulse, enter the publication name in the **Publication name** field. To access this, toggle the **Automatic setup** button in the **Database replication** section (available with a [paid plan](https://www.prisma.io/pricing#pulse)).

5. After toggling **Automatic setup**, the button will transition to **Advanced setup**, and a textbox labeled **Publication name** will appear.

6. Copy and paste the publication name from *step 2*.

7. Click **Enable Pulse**.

### Removing publications

Expand Down
45 changes: 27 additions & 18 deletions content/400-pulse/250-database-setup/400-neon.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,41 @@ This section provides step-by-step instructions to make a [Neon](https://neon.te

To enable logical replication on Neon, follow these steps:

1. Navigate to your project in the [Neon console](https://console.neon.tech/).
2. Go to the **Project settings** section from the Neon Dashboard.
3. Go to the **Beta** section in **Project Settings**.
4. Click on **Enable**.

<Admonition type="info">
You may be restricted from enabling logical replications due to an Enrollment Pause for the Neon logical replication beta phase. Learn more about enabling logical replication in Neon [here](https://neon.tech/docs/guides/logical-replication-neon#enabling-logical-replication-in-neon).
</Admonition>
1. Open your project in the [Neon console](https://console.neon.tech/).
2. In your project dashboard, go to the **Settings** section from the left panel.
3. Navigate to the **Logical Replication** tab in the **Settings** section.
4. Click the **Enable** button to enable logical replication.

You have successfully enabled Logical replication for Neon. Now, follow the steps below to configure your Neon database to work with Pulse.

## 2. Create publications in Neon

After enabling logical replication on Neon, follow these steps:

1. Create a publication to listen to database events from your Neon database. Use the **SQL Editor** in your Neon project to execute the SQL query to create a publication to listen to database change events from all tables:
1. Create a publication to track database change events in your Neon database. Open the **SQL Editor** from the left panel of your project dashboard in Neon, and run the following SQL query to create a publication that listens to events from all tables:

```sql
CREATE Publication $PUBLICATION_NAME FOR ALL TABLES;
-- Replace $PUBLICATION_NAME with a custom name for your publication
CREATE PUBLICATION $PUBLICATION_NAME FOR ALL TABLES;
```
<br />
<Admonition type="info">
You can also create a publication to subscribe to database events from *specific tables*. To learn more on managing publications refer to [this](/pulse/database-setup/general-database-instructions#manage-your-own-publication-slot) section.
</Admonition>

2. Before enabling Prisma Pulse, make sure to insert the publication name (e.g., `$PUBLICATION_NAME`) in the **Publication name** field in your project environment configuration for Pulse in the [Console](https://pris.ly/pdp):

![Submit the publication name in the Console](/img/pulse/replication-slot-submission.png)
<br/>
:::warning
To manage your own publication slot while enabling Prisma Pulse, you'll need to be on one of our paid plans. Since managing your own publication slot is required when using Neon, upgrading to a paid plan will allow you to seamlessly use Pulse with Neon. For more information, please visit our [pricing page](https://www.prisma.io/pricing#pulse).
:::
:::info
You can also create a publication to subscribe to database events from *specific tables*. For more details on managing publications, refer to [this section](/pulse/database-setup/general-database-instructions#manage-your-own-publication-slot).
:::
2. Navigate to [Prisma Data Platform](https://pris.ly/pdp) to enable Pulse.
3. Submit the database connection string and region in the **Database connection** section.
4. In your project environment configuration for Pulse, enter the publication name (e.g., `$PUBLICATION_NAME`) in the **Publication name** field. To access this, toggle the **Automatic setup** button in the **Database replication** section (available with a [paid plan](https://www.prisma.io/pricing#pulse)).
5. After toggling **Automatic setup**, the button will transition to **Advanced setup**, and a textbox labeled **Publication name** will appear.
6. Paste the publication name you created in Neon in *step 1*.
7. Click **Enable Pulse**.
Your Neon database is now Pulse-ready! Follow our [getting started](/pulse/getting-started#21-install-the-pulse-client-extension) guide to see how to use Pulse in your application.

0 comments on commit ad9955b

Please sign in to comment.