Files
zopu-code/.agents/skills/rivetkit/reference/self-hosting/render.md

132 lines
4.0 KiB
Markdown

# Render Deployment
> Source: `src/content/docs/self-hosting/render.mdx`
> Canonical URL: https://rivet.dev/docs/self-hosting/render
> Description: Deploy Rivet Engine to Render with managed PostgreSQL and automatic HTTPS, using the experimental PostgreSQL backend.
---
PostgreSQL is the recommended backend for multi-node self-hosted deployments today, but it remains experimental. For a production-ready single-node Rivet deployment, use the file system backend (RocksDB-based). Enterprise teams can contact [enterprise support](https://rivet.dev/sales) about FoundationDB for the most scalable production-ready deployment.
## Prerequisites
1. A [Render account](https://render.com)
2. A GitHub repository
## Deploy Rivet Engine
### Create the Blueprint Files
Add these three files to the root of your GitHub repository:
**render.yaml**
```yaml
databases:
- name: rivet-db
plan: basic-256mb
databaseName: rivet
user: rivet
services:
- type: web
name: rivet-engine
runtime: docker
dockerfilePath: ./Dockerfile.render
plan: starter
healthCheckPath: /health
envVars:
- key: DATABASE_URL
fromDatabase:
name: rivet-db
property: connectionString
- key: RIVET__AUTH__ADMIN_TOKEN
generateValue: true
```
**Dockerfile.render**
```dockerfile
FROM rivetdev/engine:latest
COPY entrypoint.render.sh /entrypoint.render.sh
RUN chmod +x /entrypoint.render.sh
ENTRYPOINT ["/entrypoint.render.sh"]
```
**entrypoint.render.sh**
```bash
#!/bin/sh
if [ -n "$DATABASE_URL" ]; then
export RIVET__POSTGRES__URL="${DATABASE_URL}?sslmode=disable"
fi
exec /usr/bin/rivet-engine start
```
Commit and push these files to your repository.
### Deploy to Render
1. Go to the [Render Dashboard](https://dashboard.render.com/)
2. Click **Blueprints** in the left sidebar
3. Click **New Blueprint Instance**
4. Connect your GitHub account if you haven't already
5. Select the repository containing the files from the previous step
6. Click **Apply**
Render will automatically create the PostgreSQL database and deploy the Rivet Engine.
### Get Your Admin Token
1. Once deployed, go to your **rivet-engine** service in the Render Dashboard
2. Click the **Environment** tab
3. Find `RIVET__AUTH__ADMIN_TOKEN` and click the eye icon to reveal the value
4. Copy this token — you'll need it to access the dashboard
### Access the Rivet Dashboard
Open your service URL in a browser:
```
https://rivet-engine-xxxx.onrender.com/ui/
```
Replace `rivet-engine-xxxx` with your actual service name from the Render Dashboard.
Enter the admin token from the previous step to log in.
## WebSocket Timeouts
Rivet uses long-lived WebSocket connections for both client traffic (browsers, SDKs) and envoy traffic (actor hosts connecting back to the engine). Render's HTTP proxy supports WebSockets, but its default idle timeout will close connections that have no traffic for too long.
If you front the engine with your own reverse proxy (NGINX, Caddy, etc.) on Render, raise its idle / read timeout to at least 1 hour (`3600` seconds). The same guidance applies to the Render service hosting your RivetKit app, since envoys connect to it over WebSocket.
## Connecting Your Application
To connect a RivetKit application to your self-hosted engine, set these environment variables in your app:
```bash
RIVET_ENDPOINT=https://<namespace>:<admin-token>@rivet-engine-xxxx.onrender.com
RIVET_PUBLIC_ENDPOINT=https://<namespace>@rivet-engine-xxxx.onrender.com
```
See the [Connect guide](/docs/deploy/custom) for more details on connecting your application.
## Next Steps
- Review the [Production Checklist](/docs/self-hosting/production-checklist) before going live
- See [Configuration](/docs/self-hosting/configuration) for all options
_Source doc path: /docs/self-hosting/render_