-
Notifications
You must be signed in to change notification settings - Fork 276
Add selfhosted railway template and documentation #57
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
Closed
orenaksakal
wants to merge
5
commits into
get-convex:main
from
orenaksakal:oren/railway-self-hosted-doc
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
7c1f3dd
Add selfhosted railway template and documentation
orenaksakal 6a7fd6a
Add quotes to convex-dashboard text
orenaksakal 4055cb8
Update self-hosted/railway/README.md
orenaksakal 977a126
Update self-hosted/railway/README.md
orenaksakal e87a465
add community link
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ node_modules/ | |
target/ | ||
convex_local_backend*.sqlite3 | ||
convex_local_storage/ | ||
.DS_Store | ||
# testing 123 |
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,94 @@ | ||
# Self-hosting Convex with [Railway.com](https://railway.com/) | ||
|
||
## Deploying to Railway.com | ||
|
||
You can view the ready to deploy [template here](https://railway.com/template/OKpPqB) | ||
|
||
or use one click deploy button below: | ||
|
||
[](https://railway.com/template/OKpPqB) | ||
|
||
## Setup | ||
|
||
The template comes with pre-configured env-variables and you need to follow some setup steps to make it fully work. | ||
|
||
1. Setting up ports for the deployment | ||
2. Generating admin key with railway ssh | ||
|
||
Steps: | ||
|
||
1. Setting up ports for the deployment | ||
|
||
Go to your railway deployment | ||
|
||
- Select `convex-backend` service | ||
- Select Settings tab and scroll to `Public Networking` section | ||
- Hover on the domain and delete auto assigned domain | ||
- Click on `Generate Domain` for auto generated one or `Custom Domain` if you want to setup custom domain | ||
- Make sure to select port `3210` and add your domain | ||
- Re-deploy both `convex-dashboard` and `convex-backend` services | ||
|
||
2. Generating admin key with railway ssh | ||
|
||
Follow [these](https://blog.railway.com/p/ssh#how-to-ssh-on-railway) instructions to setup railway SSH on your machine | ||
|
||
- Link your convex deployment project | ||
- Run `railway ssh` and select `convex-backend` when prompted | ||
- Run `ls` and then `./generate_admin_key.sh` | ||
- Copy the whole admin key logged on the screen | ||
- This is your admin key keep it secret | ||
|
||
### HTTP Actions | ||
|
||
Note that HTTP actions run on your railway app url under the `/http` path. For | ||
example: | ||
|
||
- If your railway app is deployed at `https://self-hosted-backend.railway.app` | ||
- And you have an HTTP action routed to `/sendEmail` | ||
- You would call it at `https://self-hosted-backend.railway.app/http/sendEmail` | ||
|
||
### Database | ||
|
||
At this point, your data is stored in SQLite and your files are stored in the | ||
Railway volume. You can see them in the `data` folder if you run: | ||
|
||
``` | ||
railway ssh | ||
ls | ||
``` | ||
|
||
To store your data in a SQL database of your choice, see | ||
[these instructions](https://github.com/get-convex/convex-backend/tree/main/self-hosted/README.md#running-the-database-on-postgres--or-mysql). | ||
|
||
## Accessing the deployed dashboard | ||
|
||
The dashboard allows you to see logs, read/write data, run functions, and more. | ||
You can run the dashboard locally with Docker, or deploy it to Railway. | ||
|
||
- Head over to your railway app | ||
- Select `convex-dashboard` | ||
- Visit its public url | ||
- Paste the admin key when prompted | ||
- Enjoy | ||
|
||
### Running the dashboard locally | ||
|
||
```sh | ||
docker run -e 'NEXT_PUBLIC_DEPLOYMENT_URL=<backend-url>' -p '6791:6791' 'ghcr.io/get-convex/convex-dashboard:latest' | ||
``` | ||
|
||
## Deploying your frontend app | ||
|
||
See | ||
[these instructions](https://github.com/get-convex/convex-backend/tree/main/self-hosted/README.md#deploying-your-frontend-app). | ||
|
||
## Troubleshooting | ||
|
||
- **Performance issues**: The default railway configuration allocates the minimum | ||
possible resources to get up and running. If your app has high load, you may | ||
see ratelimiting from railway and poor performance. We recommend increasing your | ||
memory and CPU. | ||
- **Running out of disk space**: The hobby railway configuration allocates 5GB to | ||
the `convex_data` volume where your SQLite database and storage lives. If you | ||
run out of space, you can increase the volume to 50GB by upgrading plan. | ||
- If you need more help feel free to join our discord [community discord](https://convex.dev/community) |
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.