Skip to content

Commit

Permalink
chore: apply prettier formatting (#849)
Browse files Browse the repository at this point in the history
<!-- Please make sure there is an issue that this PR is correlated to. -->

## Changes

<!-- If there are frontend changes, please include screenshots. -->
  • Loading branch information
AngelOnFira committed Jun 4, 2024
1 parent dc9812c commit 5caada5
Show file tree
Hide file tree
Showing 112 changed files with 8,829 additions and 8,579 deletions.
12 changes: 6 additions & 6 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ labels: bug

## Environment

- [ ] Rivet Cloud
- Game ID: [please provide]
- [ ] Rivet self-hosted local
- Version/commit: [please provide]
- [ ] Rivet self-hosted cluster
- Version/commit: [please provide]
- [ ] Rivet Cloud
- Game ID: [please provide]
- [ ] Rivet self-hosted local
- Version/commit: [please provide]
- [ ] Rivet self-hosted cluster
- Version/commit: [please provide]

## Description

Expand Down
14 changes: 14 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,26 @@
"printWidth": 110,
"endOfLine": "lf",
"overrides": [
{
"files": "*.md",
"options": {
"proseWrap": "always",
"tabWidth": 2,
"embeddedLanguageFormatting": "off"
}
},
{
"files": ["*.yml", "*.yaml"],
"options": {
"tabWidth": 2,
"useTabs": false
}
},
{
"files": "*.json",
"options": {
"tabWidth": 2
}
}
]
}
8 changes: 4 additions & 4 deletions .vscode/rivet.code-workspace
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"folders": [
{
"path": ".."
"path": "..",
},
{
"path": "../lib/bolt"
}
"path": "../lib/bolt",
},
],
}
}
244 changes: 125 additions & 119 deletions README.md

Large diffs are not rendered by default.

30 changes: 19 additions & 11 deletions docs/about/TELEMETRY.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
# Telemetry

By default, Rivet automatically makes API requests to a centralized server (currently [PostHog](https://posthog.com/)) to provide rudimentary information about how Rivet OSS is being used in the wild.
By default, Rivet automatically makes API requests to a centralized server (currently
[PostHog](https://posthog.com/)) to provide rudimentary information about how Rivet OSS is being used in the
wild.

This document is intended to be as transparent as possible about what we collect and our motivations behind it.
This document is intended to be as transparent as possible about what we collect and our motivations behind
it.

## Why does Rivet include telemetry?

Rivet collects telemetry for three main reasons:

- **Diagnose issues** Help us diagnose issues users are having on non-standard setups
- **Focus on widely used features** Let us know which services are being used & require more attention
- **Track growth** We invest day and night in to building open source software that anyone can use to distribute multiplayer games; tracking the project's growth in the wild helps us get an accurate sense of our reach
- **Diagnose issues** Help us diagnose issues users are having on non-standard setups
- **Focus on widely used features** Let us know which services are being used & require more attention
- **Track growth** We invest day and night in to building open source software that anyone can use to
distribute multiplayer games; tracking the project's growth in the wild helps us get an accurate sense of
our reach

These metrics are never shared publicly without explicit consent.

## Disabling telemetry

**If you disable telemetry, please let us know why in our [Discord](https://discord.gg/BG2vqsJczH). We work hard to make sure we respect your privacy & security.**
**If you disable telemetry, please let us know why in our [Discord](https://discord.gg/BG2vqsJczH). We work
hard to make sure we respect your privacy & security.**

Add the following to your namespace config:

Expand All @@ -35,10 +41,11 @@ Then run `bolt up telemetry-beacon` to disable the beacon service.

**Global**

- `git_remotes` helps us understand what fork is being used
- `git_rev` helps us understand what version is being used
- `os_release` & `uname` help us diagnose issues caused by the host OS
- `services` help us understand what functionality is being added when modifying Rivet and what we need to focus on improving
- `git_remotes` helps us understand what fork is being used
- `git_rev` helps us understand what version is being used
- `os_release` & `uname` help us diagnose issues caused by the host OS
- `services` help us understand what functionality is being added when modifying Rivet and what we need to
focus on improving

```typescript
{
Expand Down Expand Up @@ -164,7 +171,8 @@ Helps us understand if developers are running multiple games on a single Rivet c

**Game namespaces**

- `player_count` helps us understand how well the system is performing under load on the provided configuration & providers
- `player_count` helps us understand how well the system is performing under load on the provided
configuration & providers

```typescript
{
Expand Down
16 changes: 8 additions & 8 deletions docs/benchmarks/START_TIMES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

> System
>
> - Debian GNU/Linux 11
> - Shared VM, 4 VCPUs (of AMD EPYC 7713 16-Core 2GHz)
> - 8GB memory
> - Debian GNU/Linux 11
> - Shared VM, 4 VCPUs (of AMD EPYC 7713 16-Core 2GHz)
> - 8GB memory
### `nix-shell` setup time (fresh)

- Before building `bolt`: 1m31s
- Building `bolt`: 2m15s
- Before building `bolt`: 1m31s
- Building `bolt`: 2m15s

### Services (Minimal setup)

Expand Down Expand Up @@ -56,9 +56,9 @@ _First loki, promtail, and prometheus are provisioned then the rest follow_

> System
>
> - Debian GNU/Linux 11
> - AMD EPYC 7713 16-Core 2GHz
> - 32GB memory
> - Debian GNU/Linux 11
> - AMD EPYC 7713 16-Core 2GHz
> - 32GB memory
### Services (Complex setup)

Expand Down
143 changes: 68 additions & 75 deletions docs/getting_started/ADDING_AN_ENDPOINT.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,95 +2,88 @@

## Adding a new endpoint to Rivet Core

1. Update the respective `__package.yml__` file with the new endpoint you want
to add. This may require adding something to the `common.yml` file that
should be at `../common.yml` relative to the package file.

1. Run the script `./scripts/fern/gen.sh`. Currently that might look something
like:

`FERN_REPO_PATH=/home/forest/data/git/fern ./scripts/fern/gen.sh`

This will generate new files in `sdks/`. We'll mostly care about the new Rust
files in `sdks/rust/full/rust/src/...`.

1. If you added any enums or structs to the `common.yml` file, you'll need to
add/update the impls in `lib/convert/src/impls`. This allows enums to be
mapped from the generated API type to an internal mapping. For example, in
`lib/convert/src/impls/admin.rs`:

```rust
impl ApiFrom<models::AdminProvider> for backend::cluster::Provider {
fn api_from(value: models::AdminProvider) -> backend::cluster::Provider {
match value {
models::AdminProvider::Linode => backend::cluster::Provider::Linode,
}
}
}
```

1. Add the api endpoint in the related route file for the api. Say
`svc/api/admin/src/route/mod.rs`:

```rust
define_router! {
routes: {
"cluster": {
POST: cluster::create(
body: models::AdminClusterCreateRequest,
),
},
},
}
```
1. Update the respective `__package.yml__` file with the new endpoint you want to add. This may require adding
something to the `common.yml` file that should be at `../common.yml` relative to the package file.

1. Run the script `./scripts/fern/gen.sh`. Currently that might look something like:

`FERN_REPO_PATH=/home/forest/data/git/fern ./scripts/fern/gen.sh`

This will generate new files in `sdks/`. We'll mostly care about the new Rust files in
`sdks/rust/full/rust/src/...`.

1. If you added any enums or structs to the `common.yml` file, you'll need to add/update the impls in
`lib/convert/src/impls`. This allows enums to be mapped from the generated API type to an internal mapping.
For example, in `lib/convert/src/impls/admin.rs`:

```rust
impl ApiFrom<models::AdminProvider> for backend::cluster::Provider {
fn api_from(value: models::AdminProvider) -> backend::cluster::Provider {
match value {
models::AdminProvider::Linode => backend::cluster::Provider::Linode,
}
}
}
```

1. Add the api endpoint in the related route file for the api. Say `svc/api/admin/src/route/mod.rs`:

```rust
define_router! {
routes: {
"cluster": {
POST: cluster::create(
body: models::AdminClusterCreateRequest,
),
},
},
}
```

1. Create the handler for the new endpoint in the related handler file. Say
`svc/api/admin/src/handler/cluster.rs`:

```rust
pub async fn create(
ctx: Ctx<Auth>,
body: models::AdminClusterCreateRequest,
) -> GlobalResult<models::AdminClusterCreateResponse> {
// Your handler code here
}
```
```rust
pub async fn create(
ctx: Ctx<Auth>,
body: models::AdminClusterCreateRequest,
) -> GlobalResult<models::AdminClusterCreateResponse> {
// Your handler code here
}
```

Some tips for this:
Some tips for this:

- Mapping from an enum in the model to an integer in the protobuf-generated
model can be done with `as i32` (or conversely `from_i32`)
- Mapping from an enum in the model to an integer in the protobuf-generated model can be done with `as i32`
(or conversely `from_i32`)

## Connecting to the endpoint with Bolt

If Bolt needs a new CLI command that will interface with this api, these are the
steps you'll need to take:
If Bolt needs a new CLI command that will interface with this api, these are the steps you'll need to take:

1. Add the new command to the respective existing or new bolt command.

1. Openapi requests are generated for each endpoint defined in the
`__package.yml__` file. Here's an example of calling one of these requests:
1. Openapi requests are generated for each endpoint defined in the `__package.yml__` file. Here's an example
of calling one of these requests:

_Note: These current docs only make use of the cloud token, hub and cli
endpoint docs to come later._
_Note: These current docs only make use of the cloud token, hub and cli endpoint docs to come later._

```rust
admin_clusters_api::admin_clusters_create(
&ctx.openapi_config_cloud().await?,
models::AdminClustersCreateRequest {
name_id: cluster_name_id,
owner_team_id: Some(Uuid::parse_str(&owner_team_id).unwrap()),
},
)
.await?;
```
```rust
admin_clusters_api::admin_clusters_create(
&ctx.openapi_config_cloud().await?,
models::AdminClustersCreateRequest {
name_id: cluster_name_id,
owner_team_id: Some(Uuid::parse_str(&owner_team_id).unwrap()),
},
)
.await?;
```

This also makes use of the same `models` that are generated by the Openapi,
allowing ser/de data to be passed across the wire.
This also makes use of the same `models` that are generated by the Openapi, allowing ser/de data to be
passed across the wire.

Some tips for this:
Some tips for this:

- In some cases, you might need to write a custom request instead of using a
generated one. For example, Fern allows get requests to `allow-multiple` of
the same repeated parameter. The generated request does not interpret this
correctly, so you'll need to write a custom request for this case.
- In some cases, you might need to write a custom request instead of using a generated one. For example,
Fern allows get requests to `allow-multiple` of the same repeated parameter. The generated request does
not interpret this correctly, so you'll need to write a custom request for this case.
Loading

0 comments on commit 5caada5

Please sign in to comment.