-
Notifications
You must be signed in to change notification settings - Fork 396
docs(self-hosting): add Railway one-click deploy template #2873
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
Open
orenaksakal
wants to merge
4
commits into
instantdb:main
Choose a base branch
from
orenaksakal:docs/railway-deploy-template
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
dcdb276
docs(self-hosting): add Railway one-click deploy template
orenaksakal a9373d9
docs(self-hosting): move Railway template to bottom of Hosting Guides
orenaksakal 52e8e8b
docs(self-hosting): add Railway hosting guide
orenaksakal fe2a91d
docs(self-hosting): limit Railway scaling to vertical, add Railway to…
orenaksakal 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| --- | ||
| nextjs: | ||
| metadata: | ||
| title: 'Self Hosting Instant on Railway' | ||
| description: 'Deploy Instant with a one-click Railway template.' | ||
| --- | ||
|
|
||
| The quickest way to self-host Instant is the [Railway one-click | ||
| template](https://railway.com/deploy/instantdb). It provisions a full Instant | ||
| deployment—backend, dashboard, PostgreSQL, and object storage—in a single | ||
| Railway project, so you can go from zero to a working instance without | ||
| provisioning servers yourself. | ||
|
|
||
| ## What gets deployed | ||
|
|
||
| The template creates four resources: | ||
|
|
||
| - **`server`**: The Instant backend API, running | ||
| [`ghcr.io/instantdb/server:latest`](https://github.com/instantdb/instant/pkgs/container/server). | ||
| - **`dashboard`**: The Instant dashboard UI, running | ||
| `ghcr.io/instantdb/dashboard:latest`. | ||
| - **`postgres`**: PostgreSQL with the settings and extensions Instant needs, | ||
| including `pg_hint_plan`. | ||
| - **`instantdb-storage`**: A [Railway Bucket](https://docs.railway.com/storage-buckets) | ||
| that provides S3-compatible object storage for Instant Storage. | ||
|
|
||
| The template wires everything together with reference variables. The server | ||
| receives `DATABASE_URL` from Postgres plus `AWS_ACCESS_KEY_ID`, | ||
| `AWS_SECRET_ACCESS_KEY`, `AWS_REGION`, `S3_ENDPOINT`, `S3_PUBLIC_ENDPOINT`, and | ||
| `S3_BUCKET` from the bucket, so you don't have to copy credentials around. | ||
|
|
||
| ## Deploy the template | ||
|
|
||
| Open [railway.com/deploy/instantdb](https://railway.com/deploy/instantdb) and | ||
| click **Deploy Now**. Railway creates the project and starts all services. | ||
|
|
||
| ## Add public domains | ||
|
|
||
| Add public domains to the `server` and `dashboard` services. You can use the | ||
| generated `*.up.railway.app` domains or attach your own custom domains. | ||
|
|
||
| Then set your public URLs in the server's variables: | ||
|
|
||
| ```shell {% showCopy=true %} | ||
| INSTANT_BACKEND_URL=https://your-server-domain | ||
| INSTANT_DASHBOARD_URL=https://your-dashboard-domain | ||
| ``` | ||
|
|
||
| Make sure the URLs match the domains you created, including the scheme. | ||
|
|
||
| {% callout type="note" %} | ||
| If you attach custom domains, update these URLs to use them. Clients and the | ||
| dashboard both read `INSTANT_BACKEND_URL`, so changing it later means updating | ||
| every connected app. | ||
| {% /callout %} | ||
|
|
||
| ## Configure email | ||
|
|
||
| Until you configure an email provider, Instant writes magic code emails to the | ||
| backend logs. To deliver real login emails, set a `POSTMARK_TOKEN` or | ||
| `SENDGRID_TOKEN` on the `server` service along with the sender variables. See | ||
| [Configure email](/docs/self-hosting#configure-email-with-postmark) for details. | ||
|
|
||
| ## Create the superuser | ||
|
|
||
| Set `INSTANT_SUPERUSER_EMAIL` on the `server` service before first login. | ||
| Instant creates this dashboard user at startup and it can manage deployment | ||
| settings such as restricting signups. | ||
|
|
||
| ## Scaling and costs | ||
|
|
||
| Each service can be scaled independently from its Railway service settings: | ||
| add more replicas of `server`, increase memory, or upgrade the Postgres | ||
| instance as your workload grows. Railway bills per usage, so costs depend on | ||
| the resources you allocate. | ||
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.