Render
Render is a cloud infrastructure and web hosting platform.
Electric and Render
You can use Render to deploy an Electric sync service and your client application.
Postgres on Render and logical replication
Render does provide managed Postgres hosting. However, this doesn't yet support logical replication, so you can't currently use Electric with it.
If you need Postgres hosting to use with Render, Neon and Supabase both work great.
Need context?
See the Deployment guide for more details.
Deploy Electric
Deploy Electric as a Web Service using their deploy from a container registry option.
In the Render dashboard, create a new Web Service, select Existing Image and paste electricsql/electric
as the image URL. Then on the next screen set a DATABASE_URL
and any other config as environment variables.
You can also optionally enter /v1/health
as the path for a health check.
Under "Advanced" make sure you add a Persistent Disk and set the Mount path to e.g.: /var/electric
. Then also set the ELECTRIC_STORAGE_DIR
environment variable to the same mount path, e.g.: ELECTRIC_STORAGE_DIR=/var/electric
.
Deploy your app
You can deploy your app on Render as a Static Site. For example, you can deploy our standalone-basic-example by:
- selecting "Public GitHub Repository" and pasting
https://github.com/electric-sql/standalone-basic-example
as the value - setting the publish directory to
dist
- setting a
VITE_ELECTRIC_URL
environment variable to the URL of your Electric web service, such ashttps://YOUR_WEB_SERVICE_NAME.onrender.com
Then make sure that your Postgres database has an items
table with an id
column and insert some data into it.
Example
Render supports Blueprints to deploy infrastructure as code. The following example shows how to deploy Electric and an example web app that connects to it.
Requires an existing Postgres running somewhere else
The Blueprint above requires a DATABASE_URL
to an existing Postgres database hosted somewhere else.
Also, as per the example above, the example app it deploys assumes you have an items
table in your database.
render.yaml
Blueprint
Clone github.com/electric-sql/render-blueprint or copy the following config into a render.yaml
file:
services:
- type: web
runtime: image
name: electric
image:
url: electricsql/electric:latest
disk:
name: storage
mountPath: /var/electric
sizeGB: 20
envVars:
- key: DATABASE_URL
sync: false
- key: ELECTRIC_STORAGE_DIR
value: "/var/electric"
- type: web
runtime: static
name: app
buildCommand: VITE_ELECTRIC_URL="https://${ELECTRIC_HOST}.onrender.com" npm run build
staticPublishPath: ./dist
envVars:
- key: ELECTRIC_HOST
fromService:
name: electric
type: web
property: host
You can then follow the instructions here to deploy the Blueprint on Render.
In short, you push the render.yaml
to a repo, open the Render Dashboard, click "New > Blueprint", connect the repo and enter your DATABASE_URL
when prompted.