Skip to content

Commit

Permalink
docs: reorganize self-hosting documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanFlurry committed Jan 17, 2025
1 parent edcf200 commit 235fe43
Show file tree
Hide file tree
Showing 7 changed files with 163 additions and 106 deletions.
49 changes: 49 additions & 0 deletions docker/dev-full/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,52 @@
# Full Development Docker Compose

## Operating

Find our docs [here](https://rivet.gg/docs/self-hosting/docker-compose).

## Development

### Rebuilding

To rebuild all services, run:

```bash
docker compose -f docker/dev-full/docker-compose.yml up -d --build
```

To rebuild just the server, run:

```bash
docker compose -f docker/dev-full/docker-compose.yml up -d --build rivet-server
```

### Logs

To fetch logs for a service, run:

```bash
docker compose -f docker/dev-full/docker-compose.yml logs {name}
```

#### Following

To follow logs, run:

```bash
docker compose -f docker/dev-full/docker-compose.yml logs -f {name}
```

#### Grep

It's common to use grep (or the more modern
[ripgrep](https://www.google.com/search?q=ripgrep&oq=ripgrep&sourceid=chrome&ie=UTF-8)) to filter logs.

For example, to find all errors in `rivet-server` with the 10 preceding lines, run:

```bash
docker compose -f docker/dev-full/docker-compose.yml logs rivet-server | grep -B 10 level=error
```

Logs for `rivet-server` and `rivet-client` can also be configured via the environment. See [here](/docs/self-hosting/client-config) for
more information.

80 changes: 28 additions & 52 deletions docker/monolith/README.md
Original file line number Diff line number Diff line change
@@ -1,56 +1,46 @@
# Monolith Development Container

This container is intended for quickly running Rivet with a single `docker run` command or integrating Rivet
in to an existing Docker Compose environment.
## Operating

## Running
Find our docs [here](https://rivet.gg/docs/self-hosting/single-container).

### Build image
## Development

### Build & run

Before running the image, it needs to be built:
Build & run the monolith container with extra logs enabled with:

```bash
docker build -f docker/universal/Dockerfile --target monolith -t rivet .
./scripts/docker/monolith_dev.ts
```

### Run via `docker run`
Flags:

```bash
docker run -v "$(pwd)/rivet-data:/data" -p 8080:8080 -p 9000:9000 -p 7080:7080 -p 7443:7443 -p 7500-7599:7500-7599 -p 7600-7699:7600-7699 --platform linux/amd64 rivetgg/rivet
```
- `--no-build` Skip build step
- `--no-clean` Skips removing data dir

Data will be stored in `/tmp/rivet-data`.

### Build & run manually

### Run via Docker Compose

```yaml
services:
rivet:
image: rivetgg/rivet
platform: linux/amd64
volumes:
- rivet-data:/data
ports:
- "8080:8080"
- "9000:9000"
- "7080:7080"
- "7443:7443"
- "7500-7599:7500-7599"
- "7600-7699:7600-7699"

volumes:
rivet-data:
To build & run without using external scripts, run:

```bash
docker build -f docker/universal/Dockerfile --target monolith -t rivet .
docker run --name rivet -v "$(pwd)/rivet-data:/data" -p 8080:8080 -p 9000:9000 -p 7080:7080 -p 7443:7443 -p 7500-7599:7500-7599 -p 7600-7699:7600-7699 --platform linux/amd64 rivet
```

## Logs
### Logs

Logs live in the `/var/log/{service name}` directory.

You can read the logs by running:

```bash
docker exec mycontainer cat /var/log/rivet-server/current
docker exec rivet cat /var/log/rivet-server/current
```

## Monitoring Vector
### Monitoring Vector

Monitor `vector-server`:

Expand All @@ -64,31 +54,17 @@ Monitor `vector-client`:
vector top --url http://0.0.0.0:9510/graphql
```

## Development

Build & run the monolith container with extra logs enabled with:

```bash
./scripts/docker/monolith_dev.ts
```

Flags:
### `s6-overlay` & generating services

- `--no-build` Skip build step
- `--no-clean` Skips removing data dir
All required services run inside the container by default using `s6-overlay`.

Data will be stored in `/tmp/rivet-data`.
These services are auto-generated by the `./scripts/docker/generate.ts` script.

## Port collisions
### Port collisions

Because all services live in the same address space, a lot of ports for dependent services are remapped.
Because all services live in the same address space, a lot of ports for dependent services are remapped internally.

If a port uses numbers non-standard ports (e.g. ClickHouse has
[many ports](https://clickhouse.com/docs/en/guides/sre/network-ports) while Redis uses a single well-known
port 6379). TODO
port 6379).

## `s6-overlay` & generating services

All required services run inside the container by default using `s6-overlay`.

These services are auto-generated by the `./scripts/docker/generate.ts` script.
53 changes: 1 addition & 52 deletions site/src/content/docs/self-hosting/docker-compose.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -61,58 +61,6 @@ To destroy all containers & volumes immediately, run:
docker compose -f docker/dev-full/docker-compose.yml down -v -t 0
```

## Development

### Rebuilding

To rebuild all services, run:

```bash
docker compose -f docker/dev-full/docker-compose.yml up -d --build
```

To rebuild just the server, run:

```bash
docker compose -f docker/dev-full/docker-compose.yml up -d --build rivet-server
```

### Logs

To fetch logs for a service, run:

```bash
docker compose -f docker/dev-full/docker-compose.yml logs {name}
```

#### Following

To follow logs, run:

```bash
docker compose -f docker/dev-full/docker-compose.yml logs -f {name}
```

#### Grep

It's common to use grep (or the more modern
[ripgrep](https://www.google.com/search?q=ripgrep&oq=ripgrep&sourceid=chrome&ie=UTF-8)) to filter logs.

For example, to find all errors in `rivet-server` with the 10 preceding lines, run:

```bash
docker compose -f docker/dev-full/docker-compose.yml logs rivet-server | grep -B 10 level=error
```

Logs for `rivet-server` and `rivet-client` can also be configured via the environment. See [here](/docs/self-hosting/client-config) for
more information.

## Caveats

The docker compose currently only supports host networking and host ports.

Read more about host networking and ports <Link href='/docs/networking'>here</Link>.

## Troubleshooting

### Have you tried turning it off and on again?
Expand All @@ -124,3 +72,4 @@ docker compose -f docker/dev-full/docker-compose.yml down -v -t 0
```

This will destroy all containers & volumes immediately.

5 changes: 3 additions & 2 deletions site/src/content/docs/self-hosting/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ Join <Link href='/discord'>our Discord</Link> if you have any questions, we're h
## Deployment Methods

<CardGroup>
<Card title="Docker Compose" href="/docs/self-hosting/docker-compose">Best for quick, hobby setups. Easy to set up.</Card>
<Card title="Local Dev & Single Container" href="/docs/self-hosting/single-container">Best for local dev, including in existing Docker Compose, and single-node deployments.</Card>
<Card title="Docker Compose" href="/docs/self-hosting/docker-compose">Best for quick hobby setups.</Card>
<Card title="Manual Deployment" href="/docs/self-hosting/manual-deployment">Best for complex architectures. Requires familiarity with Linux systems.</Card>
</CardGroup>

Expand All @@ -21,4 +22,4 @@ Join <Link href='/discord'>our Discord</Link> if you have any questions, we're h
<CardGroup>
<Card title="Server Config" href="/docs/self-hosting/server-config" />
<Card title="Client Config" href="/docs/self-hosting/client-config" />
</CardGroup>
</CardGroup>
6 changes: 6 additions & 0 deletions site/src/content/docs/self-hosting/manual-deployment.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ import Link from 'next/link';

Manual deployment of Rivet is meant for advanced use cases. For a simpler solution, try <Link href='/docs/self-hosting/docker-compose'>our Docker Compose</Link>.

<Tip title="Get started faster with a single container">
If you're deploying Rivet on a single machine or just want to try it, Rivet
can be started with a single `docker run` command. See [Single Container
Deployments](/docs/self-hosting/single-container) for more information.
</Tip>

## Prerequisites

- <Link href='https://git-scm.com/downloads'>Git</Link>
Expand Down
72 changes: 72 additions & 0 deletions site/src/content/docs/self-hosting/single-container.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Local Development & Single Container

A full Rivet cluster can be ran in a single container for use cases like:

- Develop your app with a local Rivet cluster
- Including in an existing Docker Compose project
- Quick, single-node deployments

## Prerequisites

- Docker

## Operation

### Run with Docker CLI

Start a Rivet cluster:

<Tabs>
<Tab title="Recommended">

Run Rivet with:

```sh
docker run --name rivet -v "$(pwd)/rivet-data:/data" -p 8080:8080 -p 9000:9000 -p 7080:7080 -p 7443:7443 -p 7500-7599:7500-7599 -p 7600-7699:7600-7699 --platform linux/amd64 rivetgg/rivet
```

This runs Rivet with HTTP, TCP, and UDP networking support.

</Tab>
<Tab title="Limited Networking">

If you don't need TCP & UDP support (which is common), you can run Rivet with just HTTP support:

```sh
docker run --name rivet -v "$(pwd)/rivet-data:/data" -p 8080:8080 -p 9000:9000 -p 7080:7080 -p 7443:7443 --platform linux/amd64 rivetgg/rivet
```

This is sometimes needed if the port ranges required above have port conflicts with other software on your computer.

</Tab>
</Tabs>

Data will be stored in a folder named `rivet-data` in your current directory.

Next, follow the [setup guide](/docs/setup).

### Integrate in to existing Docker Compose

Integrate in to an existing project's Docker Compose with:

```yaml
services:
rivet:
image: rivetgg/rivet
platform: linux/amd64
volumes:
- rivet-data:/data
ports:
- "8080:8080"
- "9000:9000"
- "7080:7080"
- "7443:7443"
# Optional: Rivet Guard TCP & UDP
- "7500-7599:7500-7599"
# Optional: Host networking TCP & UDP
- "7600-7699:7600-7699"

volumes:
rivet-data:
```
4 changes: 4 additions & 0 deletions site/src/sitemap/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,10 @@ export const sitemap = [
title: "Overview",
href: "/docs/self-hosting",
},
{
title: "Local Dev & Single Container",
href: "/docs/self-hosting/single-container",
},
{
title: "Docker Compose",
href: "/docs/self-hosting/docker-compose",
Expand Down

0 comments on commit 235fe43

Please sign in to comment.