🚨 READ BEFORE PROCEEDING 🚨
We encourage developers to use the self-hosted version of Rivet, but we're still working on improving the self-hosted developer experience.
At the moment, all the services need to be built from scratch and deployed to a fully loaded Kubernetes cluster, which requires a beefy Linux machine. (Ideally 8 CPU cores, 32 GB RAM to build the required components for the cluster & run Rust Analyzer at the same time.)
Once running, Rivet itself is very lightweight since it's all Rust. If you want to help make Rivet easier to run, please reach out and we can help provide guidance on Discord when implementing the following issues:
There are two methods to set up a development environment:
- Using Devcontainers/Codespaces (instructions)
- Directly on a virtual machine (instructions)
Devcontainers are the primary choice as they're more supported by the Rivet team. This is because their setup is consistant across Linux, MacOS, and Windows, since devcontainers run inside of a Docker container. The Devcontainer spec also allows you to use GitHub Codespaces if that is easier.
- Visual Studio Code
Windows Note: If you're on Windows, you'll also need WSL installed. Because the default settings only give 16GB of ram to WSL, you'll need to change the WSL config, and allocate at least 24GB of ram to WSL. This is needed for the Rivet's source code to build without running out of memory.
Codespaces Notes At this point, you can either run a Devcontainer locally, or set up a GitHub Codespace. Codespaces cost money to use, but are a zero-configuration setup in case you might not have good hardware to use. You can start a Codespace from Rivet's main repo, though you will need to configure it so that it has at least 32GB of ram.
The rest of this section will assist you in setting up a Devcontainer locally.
Docker is required to run Rivet services.
See here for install instructions.
Devcontainers are a feature of Visual Studio Code, so you won't be able to use them in other editors. To set up your editor to work with Devcontainers, you can follow this official guide
We need to clone the repository for the Devcontainer configuration to work. Run:
git clone /~https://github.com/rivet-gg/rivet.git
See here for install instructions.
Windows Note: If you're on Windows, you'll need to run a script that will set up symlinks properly. This command needs to be run from inside WSL, or inside the Devcontainer. Run:
rm -rf "infra/helm/clickhouse/charts"
ln -s ../charts "infra/helm/clickhouse/charts"
rm -rf "infra/helm/redis/charts"
ln -s ../charts "infra/helm/redis/charts"
rm -rf "infra/helm/redis-cluster/charts"
ln -s ../charts "infra/helm/redis-cluster/charts"
Open the repository in Visual Studio Code. You should see a prompt to "Reopen in Container". Click this to start the Devcontainer. If you don't see this prompt, you can open the command palette (Ctrl+Shift+P or Cmd+Shift+P on Mac) and run and run "Remote-Containers: Reopen in Container".
You can now skip to the Common steps section.
The following should be installed in a dedicated VM for Rivet.
- Debian 11 (other Linux distros untested)
- Accessible from public IP
- Recommended: Firewalls
Docker is required to run Rivet services.
See here for install instructions.
Nix is required to set up the development environment.
Run:
sh <(curl -L https://nixos.org/nix/install) --daemon
Run:
git clone /~https://github.com/rivet-gg/rivet.git
See here for install instructions.
Now that you have the environment set up either in a Devcontainer or VM, we can start setting up the Rivet cluster.
Warp compatibility
Warp may have issues with the Nix installer since it does not use the default shell. Read more.
Run:
nix-shell --run "bolt init dev --yes"
This will:
- Prompt you for parameters to generate your cluster's config
- Provision required infrastructure for the cluster
Run this command any time you update to a new version of Rivet.
Tip
See the
namespaces/dev.toml
andsecrets/dev.toml
file to see the generated namespace configs.
Now, you have to start the hub frontend.
- Clone the Rivet Hub with
- Create a file called
.env
in the root of thehub
repo- Set
RIVET_API_ENDPOINT=http://localhost:8080
in the.env
file
- Set
- Start the hub
- Visit http://localhost:5080
- Register an account with your email
nix-shell --run "bolt db sh db-user --query 'UPDATE users SET is_admin = true'"
You may need to clear the local cache for this change to appear. (Related issue)
This command sets all users to admin. We're assuming you're the only user in the cluster. Do not run this command again.
You should now see a "Create Group" button on the hub. Proceed to create a group and start developing.
Read more about working with Bolt or see other helpful docs