mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-06-16 09:39:09 +00:00
chore: add backend-y bits of heartbeats
This commit is contained in:
parent
f65779f925
commit
a34aebabe3
12 changed files with 174 additions and 2 deletions
|
@ -3,6 +3,14 @@ locals {
|
|||
botRegion = var.gcp_region
|
||||
}
|
||||
|
||||
resource "random_password" "bot_heartbeat_token" {
|
||||
length = 64
|
||||
keepers = {
|
||||
vmName = locals.vmName // Always regenerate this on a new deploy.
|
||||
envtag = var.environment_tag
|
||||
}
|
||||
}
|
||||
|
||||
data "google_compute_zones" "gcp_zones" {
|
||||
region = local.botRegion
|
||||
status = "UP"
|
||||
|
@ -40,9 +48,17 @@ locals {
|
|||
name = "BOT_CLIENT_ID",
|
||||
value = var.bot_client_id
|
||||
},
|
||||
{
|
||||
name = "BOT_HEARTBEAT_TOKEN",
|
||||
value = resource.random_password.bot_heartbeat_token.result
|
||||
},
|
||||
{
|
||||
name = "UI_PUBLIC_URI",
|
||||
value = var.ui_public_uri
|
||||
},
|
||||
{
|
||||
name = "API_PUBLIC_URI",
|
||||
value = var.api_public_uri
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -88,4 +104,4 @@ resource "google_compute_instance" "bot" {
|
|||
labels = {
|
||||
container-vm = module.gce_container.vm_container_label
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,10 @@ resource "cloudflare_workers_kv_namespace" "guild_data" {
|
|||
title = "roleypoly-guild_data-${var.environment_tag}"
|
||||
}
|
||||
|
||||
resource "cloudflare_workers_kv_namespace" "infrastructure" {
|
||||
title = "roleypoly-infrastructure-${var.environment_tag}"
|
||||
}
|
||||
|
||||
resource "cloudflare_worker_script" "backend" {
|
||||
name = "roleypoly-backend-${var.environment_tag}"
|
||||
content = file("${path.module}/${var.api_path_to_worker}")
|
||||
|
@ -29,6 +33,11 @@ resource "cloudflare_worker_script" "backend" {
|
|||
namespace_id = cloudflare_workers_kv_namespace.guild_data.id
|
||||
}
|
||||
|
||||
kv_namespace_binding {
|
||||
name = "KV_INFRASTRUCTURE"
|
||||
namespace_id = cloudflare_workers_kv_namespace.infrastructure.id
|
||||
}
|
||||
|
||||
plain_text_binding {
|
||||
name = "BOT_CLIENT_ID"
|
||||
text = var.bot_client_id
|
||||
|
@ -44,6 +53,11 @@ resource "cloudflare_worker_script" "backend" {
|
|||
text = var.bot_token
|
||||
}
|
||||
|
||||
secret_text_binding {
|
||||
name = "BOT_HEARTBEAT_TOKEN"
|
||||
text = resource.random_password.bot_heartbeat_token.result
|
||||
}
|
||||
|
||||
plain_text_binding {
|
||||
name = "UI_PUBLIC_URI"
|
||||
text = var.ui_public_uri
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue