Skip to content

Commit

Permalink
feat: add pulse railway starter app+ db docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ankur-arch committed Mar 19, 2024
1 parent db1fa64 commit dec6280
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 3 deletions.
42 changes: 39 additions & 3 deletions content/400-pulse/250-database-setup/300-railway.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ toc: true

4. Click the most recent build's **View Logs** button.

5. Click on the **Deploy Logs** tab.
5. Click on the **Deploy Logs** tab. If the service ran correctly, you should see a message in the logs that says "All done please restart the database" along with your `DATABASE_URL` connection string.

> If the service ran correctly, you should see a message in the logs that says "All done please restart the database" along with your `DATABASE_URL` connection string.
> **Note**:
> The `DATABASE_URL` can also be found by clicking on the **Postgres** Service and navigating to the **Variables** tab, then clicking the copy icon next to `DATABASE_URL` environment variable value.
> ![](../images/railway-database-url.png)
6. Copy the `DATABASE_URL` connection string and save it for later. Then restart your Railway database.

Expand All @@ -43,7 +45,7 @@ toc: true

8. Scroll down to the bottom and click the red **Delete Service** button.

> Note: If you would like to use this service and the corresponding repository to create a new Prisma Pulse project. You can do so by cloning the repo from your GitHub account to your local machine.
> **Note**: If you would like to use this service and the corresponding repository to create a new Prisma Pulse project. You can do so by cloning the repo from your GitHub account to your local machine.
- Once you have cloned the repository, you can run the following command:

Expand All @@ -57,6 +59,40 @@ toc: true

> This is to prevent the script from running every time you push up to the repo associated with the `restart-db-then-delete-me` service.
### Setup using the template including the starter app

If you're using the [Prisma Pulse DB & App](https://railway.app/template/pulse-starter) template on Railway and have set up the database on Railway following the steps [above](/pulse/database-setup/railway#setup-using-the-template), proceed with setting up the `pulse-starter` service on Railway by following these steps:

1. Click on the **pulse-starter** service.
> **Note**: You'll likely find that the build failed for the **pulse-starter** service. This is because the Prisma Pulse API key wasn't provided as the database wasn’t Prisma Pulse ready.
> Do not worry, this is to be expected and not a problem for the next steps.
2. Click on the **Variables** tab.
3. Manage your `PULSE_API_KEY` environment variable:
1. If you do not have the variable, click the **New Variable** button, create the `PULSE_API_KEY` environment variable, and then paste the `API_KEY`. Then save the changes by clicking the **Add** button.
2. If you see a variable called `PULSE_API_KEY`. Click the three vertical dots on the `PULSE_API_KEY` row and select **Edit**. Paste in the `API_KEY` and click the check mark icon (☑️).
4. Rebuild the **pulse-starter** service
1. Click on the **Deployments** tab.
2. Click on the three verticle dots on the deployment that failed. Then click **Redeploy**.
3. When the deployment starts, click the **View Logs** button.
4. Then click on the **Deploy Logs** tab.
5. See an event in action
- Click on the **Postgres** service on your railway.app project.
- Click on the **Data** tab.
- Click the `User` table and click **Add Row**.
- Fill out an email and a name, then click **Insert**.
- Return to the **Deploy Logs** of your **pulse-starter** service.
- You should be able to see an output from Prisma Pulse for the user being created:
```json
just received an event: {
action: "create",
created: { id: 1, email: "test", name: "[email protected]" },
id: 03/34334,
modelName: "User"
}
```

- Congrats 🎉! You should have a Prisma Pulse project up and running on **[railway.app](https://railway.app/template/railway.app)**.

## Setup without using a template

<br />
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit dec6280

Please sign in to comment.