-
Notifications
You must be signed in to change notification settings - Fork 876
DC-5179 Railway docs page #7102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
858a561
"Deploy to Railway" docs page created
aidankmcalister 524582a
Optimised images with calibre/image-actions
github-actions[bot] 042f7d0
template mention added
aidankmcalister b2cedf2
Optimised images with calibre/image-actions
github-actions[bot] ec2761e
minor text change
aidankmcalister bba91a0
Optimised images with calibre/image-actions
github-actions[bot] 70fbb3a
code rabbit changes applied
aidankmcalister 6247ab8
Merge branch 'main' into DC-5179-railway-docs-page
aidankmcalister 76e1759
dangerous link fixed
aidankmcalister 0297c3a
code rabbit update
aidankmcalister d68a18e
more dangerous links fixed
aidankmcalister ced53d7
dead link removed
aidankmcalister 65c6042
.app -> .com
aidankmcalister File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
87 changes: 87 additions & 0 deletions
87
...-orm/200-prisma-client/500-deployment/101-traditional/325-deploy-to-railway.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| --- | ||
| title: 'Deploy to Railway' | ||
| metaTitle: 'Deploy a Prisma app to Railway' | ||
| metaDescription: 'Learn how to deploy an app that uses Prisma ORM and Prisma Postgres to Railway.' | ||
| --- | ||
|
|
||
| This guide explains how to deploy an app that uses Prisma ORM and Prisma Postgres to [Railway](https://railway.com). The app exposes a REST API and uses Prisma Client to query a Prisma Postgres database. Your app will run on Railway and connect to a managed Prisma Postgres database. | ||
|
|
||
| Railway is a deployment platform that simplifies the software development lifecycle with instant deployments, built-in observability, and effortless scaling. It supports code repositories and container images from popular registries. Railway handles configuration management, environment variables, and provides private networking between services. | ||
|
|
||
| To get a pre-wired Next.js Project with Prisma ORM, Prisma Postgres, and Railway, use the [Official Prisma Railway Template](https://railway.com/deploy/prisma-postgres). | ||
|
|
||
| This template automates the provisioning and setup of a Prisma Postgres database, linking it directly to your Next.js application upon deployment, making the entire project ready with just one click. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| To get started, all you need is: | ||
|
|
||
| * A [Railway account](https://railway.com) | ||
| * A GitHub repository with your application code. | ||
|
|
||
| :::note | ||
| If you don't have a project ready, you can use our [example Prisma project](https://github.com/prisma/prisma-examples/tree/latest/deployment-platforms/railway). It's a simple Hono application that uses Prisma ORM and includes a REST API, a frontend for testing endpoints, and a defined Prisma schema with migrations. | ||
| ::: | ||
|
|
||
| ## Deploy your application | ||
|
|
||
| ### 1. Create a new Railway project | ||
|
|
||
| 1. Go to the [Railway dashboard](https://railway.com/dashboard) | ||
| 2. Click **Create a New Project** | ||
| 3. Select **GitHub Repo** | ||
| 4. Click **Configure GitHub App** and authorize Railway | ||
| 5. Select your repository | ||
|
|
||
| Your application is now deploying to Railway, but it won't properly run without a database connection. | ||
|
|
||
| In the next section, you'll configure a database and set the `DATABASE_URL` environment variable in Railway. | ||
|
|
||
|  | ||
|
|
||
| ## Configure your database | ||
|
|
||
| ### 1. Get your database connection string | ||
|
|
||
| You'll need a Prisma Postgres connection string. There are two ways to obtain one: | ||
|
|
||
| - Create a new database on [Prisma Data Platform](https://console.prisma.io) | ||
| - Run `npx create-db` for a temporary database _(no account required)_ | ||
|
|
||
| ### 2. Add the database URL to Railway | ||
|
|
||
| 1. In your Railway project, open your service | ||
| 2. Go to the **Variables** tab | ||
| 3. Click **New Variable** | ||
| 4. Set the name to `DATABASE_URL` | ||
| 5. Paste your database connection string as the value | ||
| 6. Click **Deploy** to redeploy your application with the new environment variable | ||
|
|
||
|  | ||
|
|
||
| ### 3. Access your application | ||
|
|
||
| Once the deployment completes with the database URL configured: | ||
|
|
||
| 1. Navigate to the **Settings** tab | ||
| 2. Under **Networking**, click **Generate Domain** | ||
| 3. Your application will be available at the generated URL | ||
|
|
||
|  | ||
|
|
||
| Go to the generated URL and you'll see your deployed app! | ||
|
|
||
| If you used the example project, you should see three api endpoints already set up: | ||
| - Check API status (`/api`) | ||
| - Load feed (`/api/feed`) | ||
| - Seed data (`/api/seed`) | ||
|
|
||
|  | ||
|
|
||
| If you see any errors: | ||
| - Wait a minute and refresh | ||
| - Ensure `DATABASE_URL` is set | ||
| - Check the service logs | ||
| - Redeploy | ||
|
|
||
| To learn more about the various features Railway offers for your application, visit the [Railway documentation](https://docs.railway.app). | ||
Binary file added
BIN
+26.9 KB
...m/200-prisma-client/500-deployment/101-traditional/images/railway-deploying.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.8 KB
...rm/200-prisma-client/500-deployment/101-traditional/images/railway-env-vars.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+16.2 KB
...0-prisma-client/500-deployment/101-traditional/images/railway-final-product.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+7.27 KB
.../200-prisma-client/500-deployment/101-traditional/images/railway-networking.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.