Skip to content

Commit 5c08ad7

Browse files
committed
Update Vercel tutorial for Cloud 2.0
1 parent 1c7c35b commit 5c08ad7

File tree

1 file changed

+28
-64
lines changed

1 file changed

+28
-64
lines changed

src/current/v24.2/deploy-app-vercel.md

Lines changed: 28 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,29 @@ This tutorial shows you how to use [Vercel](https://vercel.com/) to deploy a web
1616

1717
## Before you begin
1818

19-
Before starting the tutorial, do the following:
19+
Before starting the tutorial, create a [Vercel](https://vercel.com/signup) account and sign in.
2020

21-
1. Create a [CockroachDB {{ site.data.products.cloud }}](https://cockroachlabs.cloud/signup?referralId={{page.referral_id}}) account.
21+
## Step 1. Create a CockroachDB {{ site.data.products.standard }} cluster
2222

23-
1. Create a [Vercel](https://vercel.com/signup) account.
23+
{% include_cached cockroachcloud/quickstart/create-free-trial-standard-cluster.md %}
2424

25-
<section class="filter-content" markdown="1" data-scope="browser">
25+
{% include_cached cockroachcloud/connection-string-standard.md %}
26+
27+
# Step 2. Get the code
2628

27-
## Step 1. Get the code
29+
1. Open the code repository's [GitHub repository](https://github.com/cockroachdb/prisma-examples).
30+
1. Fork it by clicking **Fork** at the top. Netlify requires you to own a Netlify app's repository.
31+
- Set **Owner** to your GitHub identity or an organization.
32+
- Disable **Copy the master branch only**.
33+
- Click **Fork**.
2834

29-
1. Create a [GitHub](https://github.com/) account if you haven't already.
30-
1. In GitHub, [create your own fork](https://docs.github.com/get-started/quickstart/fork-a-repo#forking-a-repository) of CockroachDB's [`prisma-examples` repo](https://github.com/cockroachdb/prisma-examples).
35+
You now have an exact copy of the code repository in the GitHub location you chose.
36+
1. Copy the fork's address, which you will use to clone it locally. Click **Code**, then in the **Local** tab, click **SSH** if you have added SSH keys to GitHub, or **HTTPS** if not. Click the copy symbol to copy the address.
37+
1. Clone your fork locally. Replace `{ADDRESS}` with the full address of your fork, which will end with `prisma-examples.git`.
38+
39+
<section class="filter-content" markdown="1" data-scope="browser">
3140

32-
## Step 2. Create a Vercel project
41+
## Step 3. Create a Vercel project
3342

3443
1. From the [Vercel dashboard](https://vercel.com/dashboard), click **Add new...** > **Project**.
3544
1. Select the `prisma-examples` repository you forked in [Step 1](#step-1-get-the-code) to import.
@@ -43,22 +52,19 @@ Before starting the tutorial, do the following:
4352

4453
Your deployment will fail until you integrate CockroachDB in the next step, so you can leave this screen without waiting for it to finish.
4554

46-
## Step 3. Integrate CockroachDB
55+
## Step 4. Integrate your project with CockroachDB
4756

4857
1. Navigate to the [CockroachDB page](https://vercel.com/integrations/cockroachdb) of Vercel's integration marketplace.
4958
1. Click **Add Integration**.
5059
1. Select your Vercel account and click **Continue**.
5160
1. Select the project you just created and click **Continue**.
5261
1. Accept the permissions and click **Add Integration**.
62+
1. When prompted, log into CockroachDB Cloud and select the organization and cluster to integrate with.
63+
1. Click **Create** to finish the integration.
5364

54-
A window will pop up prompting you to log in to CockroachDB {{ site.data.products.cloud }} if you haven't already.
55-
56-
1. In the CockroachDB {{ site.data.products.cloud }} pop-up window, select the organization in which you want to create a new CockroachDB {{ site.data.products.standard }} cluster.
57-
1. Click **Create**.
65+
After a few seconds, the window will close automatically and your Vercel project will have the `DATABASE_URL` environment variable configured with the cluster's connection string.
5866

59-
After a few seconds, your cluster will be created and the pop-up window will close automatically. Once this is done, your Vercel project will have the `DATABASE_URL` environment variable automatically populated with the connection string for your new cluster.
60-
61-
## Step 3. Deploy the application
67+
## Step 5. Deploy the application
6268

6369
1. Navigate to the **Overview** page for your Vercel project.
6470
1. Select the **Deployments** tab.
@@ -69,56 +75,14 @@ Before starting the tutorial, do the following:
6975

7076
</section>
7177
<section class="filter-content" markdown="1" data-scope="local">
72-
73-
## Step 1. Create a CockroachDB {{ site.data.products.standard }} cluster
74-
75-
{% include cockroachcloud/quickstart/create-free-trial-standard-cluster.md %}
76-
77-
<a name="connection-string"></a>
78-
79-
After the cluster is created, the **Connection info** window appears. Click the **Connection string** tab and copy the connection string to a secure location. You will use this connection string to connect to CockroachDB later in the tutorial.
80-
81-
{{site.data.alerts.callout_info}}
82-
The connection string is pre-populated with your username, cluster name, and other details, including your password. Your password, in particular, will be provided only once. Save it in a secure place (we recommend a password manager) to connect to your cluster in the future. If you forget your password, you can reset it by going to the **SQL Users** page for the cluster, found at `https://cockroachlabs.cloud/cluster/<CLUSTER ID>/users`.
83-
{{site.data.alerts.end}}
84-
85-
## Step 2. Get the code
86-
87-
1. Clone the `cockroachdb` fork of the `prisma-examples` repo:
88-
89-
{% include_cached copy-clipboard.html %}
90-
~~~ shell
91-
$ git clone [email protected]:cockroachdb/prisma-examples.git
92-
~~~
93-
94-
1. Navigate to the `rest-nextjs-api-routes` directory:
95-
96-
{% include_cached copy-clipboard.html %}
97-
~~~ shell
98-
$ cd typescript/rest-nextjs-api-routes
99-
~~~
100-
101-
1. Install the application dependencies:
102-
103-
{% include_cached copy-clipboard.html %}
104-
~~~ shell
105-
$ npm install
106-
~~~
107-
108-
1. Install the `vercel` and `prisma` CLI tools:
109-
110-
{% include_cached copy-clipboard.html %}
111-
~~~ shell
112-
$ npm install --global vercel prisma
113-
~~~
11478

11579
## Step 3. Initialize the database
11680

11781
1. Save [the connection string](#connection-string) you obtained earlier from the CockroachDB {{ site.data.products.cloud }} Console to the `DATABASE_URL` environment variable in an `.env` file in your project:
11882

11983
{% include_cached copy-clipboard.html %}
12084
~~~ shell
121-
$ echo "DATABASE_URL=<connection-string>" >> .env
85+
echo "DATABASE_URL=<connection-string>" >> .env
12286
~~~
12387

12488
Prisma loads the variables defined in `.env` to the project environment. By default, Prisma uses the `DATABASE_URL` environment variable as the connection string to the database.
@@ -127,7 +91,7 @@ The connection string is pre-populated with your username, cluster name, and oth
12791

12892
{% include_cached copy-clipboard.html %}
12993
~~~ shell
130-
$ prisma migrate dev --name init
94+
prisma migrate dev --name init
13195
~~~
13296

13397
You should see the following output:
@@ -146,7 +110,7 @@ The connection string is pre-populated with your username, cluster name, and oth
146110

147111
{% include_cached copy-clipboard.html %}
148112
~~~ shell
149-
$ npm run dev
113+
npm run dev
150114
~~~
151115

152116
You should see the following output:
@@ -159,7 +123,7 @@ The connection string is pre-populated with your username, cluster name, and oth
159123

160124
{% include_cached copy-clipboard.html %}
161125
~~~ shell
162-
$ vercel deploy --confirm
126+
vercel deploy --confirm
163127
~~~
164128

165129
You will be asked to sign into your Vercel account. When you authenticate your credentials, you should see the following message:
@@ -179,7 +143,7 @@ The connection string is pre-populated with your username, cluster name, and oth
179143
~~~
180144

181145
Follow the links provided to view and manage your deployed application.
182-
146+
183147
</section>
184148

185149
## See also
@@ -188,4 +152,4 @@ The connection string is pre-populated with your username, cluster name, and oth
188152
- [How to build a Complete Webapp with React, TypeScript & CockroachDB](https://www.cockroachlabs.com/blog/react-typescript-cockroachdb-sample-app/#deploy-the-application-to-netlify)
189153
- [Build a Simple CRUD Node.js App with CockroachDB and Prisma Client]({% link {{ page.version.version }}/build-a-nodejs-app-with-cockroachdb-prisma.md %})
190154
191-
{% include {{page.version.version}}/app/see-also-links.md %}
155+
{% include_cached {{page.version.version}}/app/see-also-links.md %}

0 commit comments

Comments
 (0)