website/src/content/docs/self-hosting/docker-container.mdx
docker run -d \
--name rivet-engine \
-p 6420:6420 \
-v rivet-data:/data \
-e RIVET__FILE_SYSTEM__PATH="/data" \
rivetdev/engine:latest
curl http://localhost:6420/health
Once the engine is running, connect your app to it.
<Steps> <Step title="Create your server">Follow the quickstart to create a working server with actors.
</Step> <Step title="Start your app with RIVET_ENDPOINT">Set RIVET_ENDPOINT to tell your app to connect to the engine as a runner instead of running standalone:
RIVET_ENDPOINT="http://default:[email protected]:6420" npm start
If running your app outside of Docker, use localhost instead of host.docker.internal:
RIVET_ENDPOINT="http://default:admin@localhost:6420" npm start
See Endpoints for all options.
</Step> <Step title="Register your runner with the engine"> <Tabs> <Tab title="Dashboard">http://localhost:6420.Register your runner programmatically via the engine API:
curl -X PUT "http://localhost:6420/runner-configs/default?namespace=default" \
-H "Content-Type: application/json" \
-d '{
"datacenters": {
"default": {
"normal": {}
}
}
}'
Configure Rivet using environment variables:
docker run -d \
--name rivet-engine \
-p 6420:6420 \
-v rivet-data:/data \
-e RIVET__FILE_SYSTEM__PATH="/data" \
-e RIVET__POSTGRES__URL="postgresql://postgres:password@localhost:5432/db" \
rivetdev/engine:latest
Mount a JSON configuration file:
docker run -d \
--name rivet-engine \
-p 6420:6420 \
-v rivet-data:/data \
-v $(pwd)/rivet-config.json:/etc/rivet/config.json:ro \
rivetdev/engine:latest
Create rivet-config.json in your working directory. See the Configuration docs for all available options and the full JSON Schema.
{
"postgres": {
"url": "postgresql://postgres:password@localhost:5432/db"
}
}
# Create network
docker network create rivet-net
# Run PostgreSQL
docker run -d \
--name postgres \
--network rivet-net \
-e POSTGRES_DB=rivet \
-e POSTGRES_USER=rivet \
-e POSTGRES_PASSWORD=rivet_password \
-v postgres-data:/var/lib/postgresql/data \
postgres:15
# Run Rivet Engine
docker run -d \
--name rivet-engine \
--network rivet-net \
-p 6420:6420 \
-e RIVET__POSTGRES__URL="postgresql://rivet:rivet_password@postgres:5432/rivet" \
rivetdev/engine