Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions infra/tf/dns/cert_packs.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
locals {
# Required if:
#
# - OpenGB is enabled so requires access to `*.backend.{domain_main}`
# - Backend is enabled so requires access to `*.backend.{domain_main}`
# - Main domain is not at the root of the zone, we need to provide a cert pack for the domain.
# - Using the old `{service}.api.{domain}` format, which requires two levels of subdomains.
needs_main_cert_pack = var.opengb_enabled || var.dns_deprecated_subdomains || data.cloudflare_zone.main.name != var.domain_main
needs_main_cert_pack = var.backend_enabled || var.dns_deprecated_subdomains || data.cloudflare_zone.main.name != var.domain_main

# If CDN is not at the root of the zone, we need to provide a cert pack for the CDN.
#
Expand Down Expand Up @@ -40,7 +40,7 @@ resource "cloudflare_certificate_pack" "main" {
# TODO: Only if we use deprecated subdomains
"*.api.${var.domain_main}",
],
var.opengb_enabled ? [
var.backend_enabled ? [
"*.backend.${var.domain_main}",
] : []
])
Expand Down
4 changes: 2 additions & 2 deletions infra/tf/dns/vars.tf
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ variable "extra_dns" {
}))
}

# MARK: OpenGB
variable "opengb_enabled" {
# MARK: Backend
variable "backend_enabled" {
type = bool
}

Expand Down
2 changes: 1 addition & 1 deletion infra/tf/tls/cloudflare.tf
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ resource "cloudflare_origin_ca_certificate" "rivet_gg" {
"*.api.${var.domain_main}",
"api.${var.domain_main}",
],
var.opengb_enabled ? [
var.backend_enabled ? [
"*.backend.${var.domain_main}",
] : []
])
Expand Down
4 changes: 2 additions & 2 deletions infra/tf/tls/vars.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ variable "prometheus_enabled" {
type = bool
}

# MARK: OpenGB
variable "opengb_enabled" {
# MARK: Backend
variable "backend_enabled" {
type = bool
}

Expand Down
8 changes: 4 additions & 4 deletions infra/tf/vector/vector.tf
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@ resource "helm_release" "vector" {
EOF
}

opengb_worker = {
backend_worker = {
type = "filter"
inputs = ["http_json"]
condition = {
type = "vrl"
source = ".path == \"/opengb\""
source = ".path == \"/backend\""
}
}
}
Expand Down Expand Up @@ -160,9 +160,9 @@ resource "helm_release" "vector" {
}
}

clickhouse_opengb_logs = {
clickhouse_backend_logs = {
type = "clickhouse"
inputs = ["opengb_worker"]
inputs = ["backend_worker"]
compression = "gzip"
database = "db_cf_log"
endpoint = "https://${var.clickhouse_host}:${var.clickhouse_port_https}"
Expand Down
4 changes: 2 additions & 2 deletions lib/bolt/config/src/ns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ pub struct Rivet {
#[serde(default)]
pub billing: Option<RivetBilling>,
#[serde(default)]
pub opengb: Option<RivetOpenGb>,
pub backend: Option<RivetBackend>,
}

#[derive(Serialize, Deserialize, Clone, Debug, Default)]
Expand All @@ -549,7 +549,7 @@ pub struct Telemetry {

#[derive(Serialize, Deserialize, Clone, Debug, Default)]
#[serde(deny_unknown_fields)]
pub struct RivetOpenGb {}
pub struct RivetBackend {}

#[derive(Serialize, Deserialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
Expand Down
6 changes: 3 additions & 3 deletions lib/bolt/core/src/context/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,11 @@ impl ProjectContextData {
}
}

// MARK: OpenGB
if self.ns().rivet.opengb.is_some() {
// MARK: Backend
if self.ns().rivet.backend.is_some() {
assert!(
self.ns().dns.is_some(),
"must have DNS configured with for OpenGB"
"must have DNS configured with for backend"
);
}

Expand Down
8 changes: 4 additions & 4 deletions lib/bolt/core/src/context/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -897,13 +897,13 @@ impl ServiceContextData {
(*infra_artifacts_output.job_runner_binary_key).clone(),
);

// OpenGB
if project_ctx.ns().rivet.opengb.is_some() {
let opengb_output = terraform::output::read_opengb(&project_ctx).await;
// Backend
if project_ctx.ns().rivet.backend.is_some() {
let backend_output = terraform::output::read_backend(&project_ctx).await;

env.insert(
"CLOUDFLARE_BACKEND_DISPATCHER_NAMESPACE".into(),
opengb_output.dispatcher_namespace_name.to_string(),
backend_output.dispatcher_namespace_name.to_string(),
);
}

Expand Down
8 changes: 4 additions & 4 deletions lib/bolt/core/src/dep/terraform/gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,10 @@ async fn vars(ctx: &ProjectContext) {
json!(config.rivet.provisioning.is_some()),
);

// OpenGB
// Backend
vars.insert(
"opengb_enabled".into(),
json!(config.rivet.opengb.is_some()),
"backend_enabled".into(),
json!(config.rivet.backend.is_some()),
);

// Tunnels
Expand Down Expand Up @@ -324,7 +324,7 @@ async fn vars(ctx: &ProjectContext) {
"name": domain_main_api,
}));

// OpenGB
// Backend
extra_dns.push(json!({
"zone_name": "main",
"name": format!("*.backend.{domain_main}"),
Expand Down
6 changes: 3 additions & 3 deletions lib/bolt/core/src/dep/terraform/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub struct InfraArtifacts {
}

#[derive(Debug, Clone, Deserialize)]
pub struct OpenGb {
pub struct Backend {
pub dispatcher_namespace_name: TerraformOutputValue<String>,
}

Expand Down Expand Up @@ -153,8 +153,8 @@ pub async fn read_infra_artifacts(ctx: &ProjectContext) -> InfraArtifacts {
read_plan::<InfraArtifacts>(ctx, "infra_artifacts").await
}

pub async fn read_opengb(ctx: &ProjectContext) -> OpenGb {
read_plan::<OpenGb>(ctx, "opengb").await
pub async fn read_backend(ctx: &ProjectContext) -> Backend {
read_plan::<Backend>(ctx, "backend").await
}

/// Reads a Terraform plan's output and decodes in to type.
Expand Down
2 changes: 1 addition & 1 deletion lib/bolt/core/src/dep/terraform/remote_states.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub fn dependency_graph(ctx: &ProjectContext) -> HashMap<&'static str, Vec<Remot
"grafana" => vec![
RemoteStateBuilder::default().plan_id(crdb_plan).data_name("cockroachdb").build().unwrap(),
],
"opengb" => vec![
"backend" => vec![
RemoteStateBuilder::default().plan_id("dns").build().unwrap(),
],
}
Expand Down
8 changes: 4 additions & 4 deletions lib/bolt/core/src/tasks/infra/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,12 +285,12 @@ pub fn build_plan(
}
}

// OpenGB
if ctx.ns().rivet.opengb.is_some() {
// Backend
if ctx.ns().rivet.backend.is_some() {
plan.push(PlanStep {
name_id: "opengb",
name_id: "backend",
kind: PlanStepKind::Terraform {
plan_id: "opengb".into(),
plan_id: "backend".into(),
needs_destroy: true,
},
});
Expand Down