Discord Gateway Service
Personal message command
Production activation and its website extraction repair are recorded in the activation checkpoint.
The personal message entry uses this same Gateway connection and intake service
credential. It adds the global message command Add event, supporting user
installation in guilds, bot DMs, other DMs and group DMs. Existing /vrdex
management commands remain guild-only and require Manage Server. No additional
gateway intents or channel permissions are needed for a selected message.
This feature's implementation does not establish that user installation or its
command has been activated on the live app. Before activation, check the app's
current installation settings and command registration. Enable User Install with
applications.commands only, preserving Guild Install and existing permissions.
Keep the HTTP Interactions Endpoint URL unset for this Gateway-first app.
Record the portal setting and application identity in the operator handoff, since
it is not managed by the existing Terraform. Do not collect actual private messages
as an installation test without the user's authorization.
The gateway calls POST /discord-intake/selected-message through the existing
DISCORD_INTAKE_SECRET and VRDEX_DISCORD_INTAKE_ENABLED gate. Convex's existing
SITE_URL builds the private website link; the gateway needs no new environment
variable. Unlinked selections retain no source text and link to the existing
Discord verification flow, which requires verified email and identify guilds.
The user returns to Discord and invokes the command again after linking.
Personal message preparation runs on the website, so its production environment
also needs VRDEX_EVENT_INTAKE_AI_ENABLED=true and the existing OPENAI_API_KEY.
The Vercel Terraform stack manages the non-secret flag. Redeploy the web app
after changing it; Convex flags alone do not enable this adapter.
The draft opens the existing intake editor. A single supported poster is selected by default; multiple posters require a choice. The website prepares private bytes and tentative extraction with a five-minute version-bound lease. Failed or expired preparation can be retried or continued through manual editing. Discord interaction tokens do not determine draft lifetime. Replies and logs never echo message content or signed URLs. Source edits/deletions do not synchronize automatically.
Activation requires the reviewed command-registration diff and separately approved
provider/deployment actions. register-commands replaces the global command list,
so confirm both vrdexCommand and personalEventCommand are present before running
it. Test only owned fixtures in a guild without bot membership, a DM and a group
DM, including denied public external-app replies, on desktop/browser, iOS and Android.
Local browser screenshots do not prove those Discord-client behaviors.
Rollback removes the personal command from registration and disables its handler
through the normal release process. Preserve /vrdex, announcement connectors,
the existing intake flag and saved private drafts. Do not switch off all intake to
roll back this one entry point. Saved drafts retain the documented expiry rules.
The new utility labels longer than two words requiring exact-copy review before
shipping are Continue without poster and Keep current artwork. Other new
controls use short utility labels, including Add event, Link Discord, Review,
Source changed, New event, Update event, Select poster and Remove artwork.
Status
Deployed by infra/terraform/discord-gateway, production only. Staging has no gateway.
The process relays announcement messages, scheduled event changes, and /vrdex commands to Convex. Media controls in the checked-in runtime are ACK/routing-only; they do not enqueue Convex commands or mutate live media.
Runtime
apps/discord-gateway is a dedicated long-running Discord Gateway adapter for VRDex media controls and Discord announcement intake. It uses discord.js v14 on Node 24 and requests the Guilds, GuildMessages, MessageContent, and GuildScheduledEvents intents. MessageContent is privileged, and BASIC approved it for this design. Verification is not needed under 100 servers.
The service is intentionally Gateway-first. Do not configure a Discord HTTP Interactions Endpoint URL for this app while interactions are delivered through Gateway events.
The runtime entrypoint acknowledges interactions quickly and keeps provider mutation out of the package:
- It does not create or update Discord applications.
- It does not mutate guild state.
- It does not register commands at startup;
pnpm --filter @vrdex/discord-gateway register-commandsis the separate step that does.
It runs as one Fargate task (256 CPU, 512 MiB) in cluster and service vrdex-discord-gateway:
- It sits in the collector's NAT-routed subnet
vrdex-group-telemetry-egresswith security groupvrdex-discord-gateway-egress(outbound 443 only, no ingress, no public IP). - Logs go to
/aws/ecs/vrdex-discord-gateway, kept for 30 days. - Deploys stop the old task before starting the new one, so two gateway connections never overlap. Posts made during that gap of a minute or two are relayed by the catch-up on start, described under Announcement Intake.
Announcement Intake
- Posts are relayed only from channels with an active
discord_announcementsconnector, looked up per channel and cached for 60 seconds. Creates, edits, deletes, and each message of a bulk delete all follow this path. Convex ignores a create or update whose content and attachments match the stored row, and a repeat delete, so link unfurls, pins, and redelivery start no run. - Bot posts, system messages, and posts with neither text nor an image are dropped. Image attachments are the only attachments relayed.
- At startup the runtime replays up to 100 posts per connected channel made while it was down, starting from the newest stored post. Channels with no stored post are skipped. Replays are safe to repeat because Convex upserts by message ID.
- A relay failure logs one JSON line with the message ID and is not retried. The post is recovered only if a later restart's replay still reaches it.
GUILD_SCHEDULED_EVENT_CREATE,GUILD_SCHEDULED_EVENT_UPDATE, andGUILD_SCHEDULED_EVENT_DELETEdispatches are relayed exactly as received for guilds with an activeimportorbidirectionaldiscord_scheduled_eventsconnector, looked up per guild and cached for 60 seconds. Creates authored by the bot are dropped, because the export writes that link itself. A relay failure logs one JSON line and is not retried. This path never writes to Discord./vrdex connect,/vrdex disconnect, and/vrdex statusneed Manage Server by default.pnpm --filter @vrdex/discord-gateway register-commandsregisters them globally throughDISCORD_APPLICATION_IDandDISCORD_BOT_TOKEN. Rerun it when the command tree changes.- The runtime posts a heartbeat to Convex every minute while its Discord session is ready, so a dropped session stops the beat. Heartbeat failures log one JSON line and never stop the process.
- A failed interaction handler and a Discord client error each log one JSON line and never stop the process.
- Each failure logs one JSON line. It may carry a message ID, a connector ID, an HTTP status, and a Discord numeric error code. Logs never carry the bot token, the intake secret, URLs, or message content.
Deployment is under Bootstrap, and the heartbeat alert is under Alarms.
Shared Media Command Routing
Discord controls route to the existing Convex media command model:
startmaps tostart_program.stopmaps tostop_program.holdmaps toswitch_hold.nextmaps tonext_slot.previousmaps toprevious_slot.sourcemaps toswitch_sourcewithtargetSourceKeyfrom a select menu.fallbackmaps toforce_direct_link_fallbackwith submitted public fallback links.publish_watch_linkmaps topublish_current_public_watch_link.refreshupdates the Discord panel and does not enqueue a media command.
Component custom_id values use compact routing hints in the form vrdex:mc:<action>:<eventId>:r<revision>. They are limited to Discord's 100-character custom_id cap and must not be treated as trusted authorization state.
ACK And Stale Panel Behavior
Buttons and selects should immediately use deferUpdate() only when the server has loaded the current panel revision and verified that the component is current. Slash commands and modal submissions should immediately use ephemeral deferred replies.
If a component carries an old panel revision, or the runtime cannot verify freshness, the bot should send an ephemeral warning and avoid enqueueing a media command. Operators must refresh the panel before sending live controls from stale Discord components.
Dangerous live actions such as stop and fallback are marked confirmation-gated in the routing layer and do not expose an enqueueable command until confirmation succeeds. The first implementation records the routing contract; the confirmation UI and Convex enqueue call are follow-on integration work.
Environment
| Name | Source | Owner | Rotation |
|---|---|---|---|
DISCORD_BOT_TOKEN | Secrets Manager vrdex/discord-gateway/DISCORD_BOT_TOKEN | BASIC | Three places, below |
DISCORD_APPLICATION_ID | Secrets Manager vrdex/discord-gateway/DISCORD_APPLICATION_ID | BASIC | Changes only when the gateway moves to another Discord application |
DISCORD_INTAKE_SECRET | Secrets Manager vrdex/discord-gateway/DISCORD_INTAKE_SECRET | BASIC | Two places, below |
CONVEX_SITE_URL | Terraform variable convex_site_url, from GitHub variable GROUP_TELEMETRY_CONVEX_SITE_URL in releases | BASIC | Not a secret. Update the GitHub variable and release |
Startup throws when DISCORD_BOT_TOKEN, CONVEX_SITE_URL, or DISCORD_INTAKE_SECRET is missing. ECS also refuses to start a task while any of the three secrets has no value.
ECS injects secrets at task start, so a running task keeps its old values until it is replaced. This is how a task picks up a new secret:
aws ecs update-service --region us-east-1 --cluster vrdex-discord-gateway --service vrdex-discord-gateway --force-new-deployment
A release does not replace this step: with no image change it leaves the running task alone.
Rotate the bot token by resetting it in the Discord developer portal, which revokes the old value at once, then writing the new value to all three holders and forcing a new deployment:
- Secrets Manager
vrdex/discord-gateway/DISCORD_BOT_TOKEN. DISCORD_BOT_TOKENin GitHub environmentdiscord-gateway-commands, used by command registration.- Convex
DISCORD_BOT_TOKEN, used by the Integrations page. It must be the same application's token.
Rotate DISCORD_INTAKE_SECRET by writing the new value to Secrets Manager and Convex, then forcing a new deployment. The value must equal the Convex env value. Heartbeats and relays return 401 in between, and an outage longer than five minutes raises the heartbeat alert.
Future media enqueue integration should add a scoped service credential. Do not store stream keys, ingest URLs, or provider credentials in Discord messages, command payloads, logs, or ordinary event records.
Values BASIC Provides
| Name | Where | How to generate or find it | Required |
|---|---|---|---|
vrdex/discord-gateway/DISCORD_BOT_TOKEN | Secrets Manager | The production Convex DISCORD_BOT_TOKEN. Resetting it in the portal revokes every copy | Yes |
vrdex/discord-gateway/DISCORD_APPLICATION_ID | Secrets Manager | Portal, General Information page | Yes |
vrdex/discord-gateway/DISCORD_INTAKE_SECRET | Secrets Manager | openssl rand -base64 32 | Yes |
DISCORD_BOT_TOKEN | GitHub environment discord-gateway-commands secret | Same value as Secrets Manager | Yes, for command registration |
DISCORD_APPLICATION_ID | GitHub environment discord-gateway-commands secret | Same value as Secrets Manager | Yes, for command registration |
AWS_DISCORD_GATEWAY_RELEASE_ROLE_ARN | GitHub variable | terraform output -raw discord_gateway_release_role_arn in infra/terraform/state-mgmt | Yes |
DISCORD_GATEWAY_RELEASE_ENABLED | GitHub variable | true. Anything else skips every release | Yes |
GROUP_TELEMETRY_CONVEX_SITE_URL | GitHub variable | Production Convex HTTP actions origin. Shared with the collector release | Yes |
DISCORD_INTAKE_SECRET | Convex production | Same value as Secrets Manager | Yes |
DISCORD_APPLICATION_ID | Convex production | Same value as Secrets Manager. The Integrations page builds the bot invite from it | Yes |
DISCORD_BOT_TOKEN | Convex production | The gateway application's bot token | Yes |
VRDEX_DISCORD_POSTER_TOKEN | Web app first, then Convex production | openssl rand -base64 32. Web side is GitHub secret TERRAFORM_DISCORD_POSTER_TOKEN, which the Terraform workflow passes to the Vercel stack | For posters. Unset on either side, runs continue with the post text |
OPENAI_API_KEY | Convex production and web production | OpenAI project API keys | Yes |
VRDEX_EVENT_INTAKE_AI_ENABLED | Convex production and web production | true | Yes |
VRDEX_EVENT_INTAKE_MODEL | Convex production | A model name | No, defaults to gpt-6-luna |
LANGFUSE_PUBLIC_KEY, LANGFUSE_SECRET_KEY, LANGFUSE_BASE_URL | Convex production | Langfuse project settings | No. Missing keys disable tracing |
VRDEX_EVENT_CONNECTORS_ENABLED | Convex production | true. While it is off, runs close as connector_inactive | Yes |
VRDEX_DISCORD_INTAKE_ENABLED | Convex production | true, at step 9 of the bootstrap | Yes |
SITE_URL | Convex production | https://vrdex.net. Runs use it as the poster bridge origin | Yes |
Convex environments describes what each Convex value does.
BASIC owns every value here. Rotation for the release settings:
AWS_DISCORD_GATEWAY_RELEASE_ROLE_ARN: not a secret. It changes only if the role is recreated; rerun thegh variable setin step 2.DISCORD_GATEWAY_RELEASE_ENABLED: not a secret, nothing to rotate. Any value buttruestops releases.DISCORD_APPLICATION_IDin GitHub environmentdiscord-gateway-commands: changes only when the gateway moves to another Discord application. Update it with the Secrets Manager and Convex values.
With extraction off or OPENAI_API_KEY unset, every run fails with extraction_unavailable. After three failed runs in a row the discord-intake:<connectorId> ops alert fires. Set the extraction values before binding a channel.
A new TERRAFORM_DISCORD_POSTER_TOKEN reaches Vercel on the next vercel stack apply, and serving deployments only after the next web deploy.
Alarms
vrdex-discord-gateway-missing-task reads ECS RunningTaskCount with Maximum over five minutes, with missing data breaching.
- It means no running task for a whole five-minute window. Allow up to ten minutes for it to fire.
- A deploy's gap of a minute or two does not trip it.
- A crash-looping task that runs at all in each window does not trip it. The heartbeat alert covers that case once the Discord session stops being ready.
- It may fire once right after the service is first created, before metrics exist.
- It emails alarm and recovery through SNS topic
vrdex-group-telemetry-alerts, the collector topic subscribed tobasic@basicbit.net. - That topic exists only while the collector stack is enabled. Disabling the collector stack removes the topic and leaves this alarm with no action. Every plan of this stack, release plans included, then fails at the topic lookup until the topic exists again. The heartbeat email still works.
internal.discordIntake.checkHeartbeat runs every five minutes.
- It emails through
notifyOps(keydiscord_gateway_heartbeat_stale, at most once per six hours) when the newest heartbeat received is older than 300 seconds, or when none exists. - It sends one resolved email through
resolveOpswhen heartbeats return. - It is silent while
VRDEX_DISCORD_INTAKE_ENABLEDis off.
internal.discordIntake.sweepStalledRuns runs every five minutes.
- A run still
running15 minutes after it started is closed asstalled. Only the sweep closes stalled runs. - Its posts are requeued once, and it emails
discord-intake:<connectorId>, resolved by the connector's next finished run. A retry counts against the connector's daily cap of 20 runs. - When posts are not requeued, because the retry also stalled or the connector is paused or off, it emails
discord-intake-dropped:<runId>. Those posts need a real edit to run again.
All three Convex alerts use the ops alert path.
Releases
.github/workflows/discord-gateway-release.yml rolls the image. It runs on a push to main that touches apps/discord-gateway/** or the workflow file, and on dispatch, and only while DISCORD_GATEWAY_RELEASE_ENABLED is true. A change outside those paths, such as a lockfile bump, needs a dispatch:
gh workflow run discord-gateway-release.yml --ref main
Each run:
- Builds and pushes the image tagged
git-plus the commit SHA, or reuses it if already published. - Saves a Terraform plan and refuses it unless it changes only
aws_ecs_task_definition.gatewayandaws_ecs_service.gateway[0]. - Applies that saved plan and waits for the rollout. A circuit-breaker rollback fails the job, even though ECS reports the rollout complete, because the job compares the running task definition with the one it applied.
- Registers slash commands in its own job after the roll, from the
discord-gateway-commandsenvironment, including while the service is disabled. A failed roll registers nothing.
Any failed or cancelled job emails through vrdex-group-telemetry-alerts: a failed roll, a plan guard refusal, a rollback, a failed registration, or a timeout.
CI validates and tests this stack and never plans or applies it. Any infrastructure change is a manual apply, which must pass the image and origin, or validation rejects the plan once enable_service = true. Reuse the running image so the apply does not roll it:
cd infra/terraform/discord-gateway
TASK_DEFINITION=$(aws ecs describe-services --region us-east-1 --cluster vrdex-discord-gateway --services vrdex-discord-gateway --query 'services[0].taskDefinition' --output text | tr -d '\r')
CONTAINER_IMAGE=$(aws ecs describe-task-definition --region us-east-1 --task-definition "$TASK_DEFINITION" --query 'taskDefinition.containerDefinitions[0].image' --output text | tr -d '\r')
CONVEX_SITE_URL=$(gh variable get GROUP_TELEMETRY_CONVEX_SITE_URL)
terraform apply -var-file=environments/production.tfvars -var "container_image=$CONTAINER_IMAGE" -var "convex_site_url=$CONVEX_SITE_URL"
Bootstrap
BASIC runs this once, from Git Bash at the root of a main checkout. Before starting:
- Run
pnpm installin that checkout. - Have
CONVEX_DEPLOYMENT_PRODandCONVEX_DEPLOY_KEY_PRODin the main checkout's.env.local, whichscripts/cx.tsreads for theprodtarget. - Sign in to
gh, with admin access to the repository: this creates an environment and sets secrets and variables.gh auth statusshows the account. - Have Terraform 1.10 or later, and AWS credentials for the production account.
Export these first. Path conversion would otherwise rewrite values that start with a slash.
export MSYS_NO_PATHCONV=1 AWS_REGION=us-east-1
-
Developer portal. Confirm the production Discord application still has:
- Bot page: Message Content Intent on, Presence and Server Members off.
- Installation: guild install with scopes
botandapplications.commands, and permission integer17600776072192. That integer isDISCORD_BOT_PERMISSIONSfromconvex/_discordRest.ts, the same value the Integrations invite uses. It grants seven permissions: View Channel, Send Messages, Manage Messages, Embed Links, Read Message History, Manage Events, and Create Events. - Interactions Endpoint URL empty.
- A server count under 100. Above 100, message content needs Discord's verification.
-
Release role. Work in the checkout that holds the local state of
infra/terraform/state-mgmt, on currentmain. Find thevrdex.netpublic zone ID: the part after/hostedzone/in this output.aws route53 list-hosted-zones-by-name --dns-name vrdex.net --query 'HostedZones[0].Id' --output textAdd
enable_discord_gateway_release_permissions = truetoinfra/terraform/state-mgmt/terraform.tfvars. If that file does not exist, create it with only this line androute53_zone_id; everything else defaults. Do not copyterraform.tfvars.example.cd infra/terraform/state-mgmt
terraform init
terraform planExpect two additions: the role and its policy. Other changes may be pending, including a policy update on the CI role. Those are a separate decision, so read them. The targets below apply only this step.
terraform apply -target='aws_iam_role.discord_gateway_release[0]' -target='aws_iam_role_policy.discord_gateway_release[0]'
gh variable set AWS_DISCORD_GATEWAY_RELEASE_ROLE_ARN --body "$(terraform output -raw discord_gateway_release_role_arn)"
cd ../../.. -
Confirm the shared resources exist. Expect exactly one subnet, and a
basic@basicbit.netemail subscription whoseSubscriptionArnis notPendingConfirmation.aws ec2 describe-subnets --filters Name=tag:Name,Values=vrdex-group-telemetry-egress --query 'Subnets[].SubnetId'
TOPIC_ARN=$(aws sns list-topics --query "Topics[?ends_with(TopicArn, ':vrdex-group-telemetry-alerts')].TopicArn | [0]" --output text | tr -d '\r')
aws sns list-subscriptions-by-topic --topic-arn "$TOPIC_ARN" -
First stack apply. With
enable_service = false, this creates the repository, secrets, roles, network, cluster, log group, and a task definition holding the placeholder image. No image exists yet, so this is the one apply withoutcontainer_image.cd infra/terraform/discord-gateway
terraform init
CONVEX_SITE_URL=$(gh variable get GROUP_TELEMETRY_CONVEX_SITE_URL)
terraform apply -var-file=environments/production.tfvars -var "convex_site_url=$CONVEX_SITE_URL"
cd ../../.. -
Write secret values. Set
APPLICATION_IDfrom the portal. The bot token comes from production Convex, because a reset would revoke the copy already there. Values read by$(...)carry no trailing newline. See setting secret values.Create the
discord-gateway-commandsenvironment first and restrict it tomain. Only it holds the GitHub copies of these two values.gh api --method PUT repos/BASIC-BIT/VRDex/environments/discord-gateway-commands \
--input - <<< '{"deployment_branch_policy":{"protected_branches":false,"custom_branch_policies":true}}'
gh api --method POST repos/BASIC-BIT/VRDex/environments/discord-gateway-commands/deployment-branch-policies -f name=main -f type=branch
BOT_TOKEN=$(pnpm --silent cx -- prod env get DISCORD_BOT_TOKEN)
INTAKE_SECRET=$(openssl rand -base64 32)
aws secretsmanager put-secret-value --secret-id vrdex/discord-gateway/DISCORD_BOT_TOKEN --secret-string "$BOT_TOKEN"
aws secretsmanager put-secret-value --secret-id vrdex/discord-gateway/DISCORD_APPLICATION_ID --secret-string "$APPLICATION_ID"
aws secretsmanager put-secret-value --secret-id vrdex/discord-gateway/DISCORD_INTAKE_SECRET --secret-string "$INTAKE_SECRET"
pnpm cx -- prod env set DISCORD_INTAKE_SECRET "$INTAKE_SECRET"
pnpm cx -- prod env set DISCORD_APPLICATION_ID "$APPLICATION_ID"
gh secret set DISCORD_BOT_TOKEN --env discord-gateway-commands --body "$BOT_TOKEN"
gh secret set DISCORD_APPLICATION_ID --env discord-gateway-commands --body "$APPLICATION_ID"Then run the check under "Always verify after writing a secret" in that section for each Convex value written here.
CRmust be0. -
First release. This pushes the first image and registers commands. There is no service yet, so the workflow reports nothing to roll.
GROUP_TELEMETRY_CONVEX_SITE_URLmust already be set.gh variable set DISCORD_GATEWAY_RELEASE_ENABLED --body true
gh workflow run discord-gateway-release.yml --ref main
sleep 10
RUN_ID=$(gh run list --workflow discord-gateway-release.yml --event workflow_dispatch --limit 1 --json databaseId --jq '.[0].databaseId')
gh run watch "$RUN_ID" --exit-status
aws ecs describe-task-definition --task-definition vrdex-discord-gateway --query 'taskDefinition.containerDefinitions[0].image' --output textDo not move on until the run succeeds and the image ends in
@sha256:plus 64 hex characters.:bootstrap-placeholdermeans the release did not apply. Once the enable PR in step 8 has merged, a re-dispatched release fails the plan guard, so revert that PR, or read the digest fromaws ecr describe-images --repository-name vrdex-discord-gatewayand join it toterraform output -raw repository_urlwith@for step 10. -
Set extraction and poster values. Set these before any channel is bound; see Values BASIC Provides. Set
OPENAI_KEYto the OpenAI key andPOSTER_TOKENto the output ofopenssl rand -base64 32, and writePOSTER_TOKENto the web app first: store it as GitHub secretTERRAFORM_DISCORD_POSTER_TOKEN, then dispatch the Terraform workflow for thevercelstack with apply, and redeploy the web app so serving deployments read it. The first Convex command must printhttps://vrdex.net, the poster bridge origin.gh secret set TERRAFORM_DISCORD_POSTER_TOKEN --body "$POSTER_TOKEN"
gh workflow run terraform.yml --ref main -f stack=vercel -f apply=true
pnpm --silent cx -- prod env get SITE_URL
pnpm cx -- prod env set OPENAI_API_KEY "$OPENAI_KEY"
pnpm cx -- prod env set VRDEX_EVENT_INTAKE_AI_ENABLED true
pnpm cx -- prod env set VRDEX_EVENT_CONNECTORS_ENABLED true
pnpm cx -- prod env set VRDEX_DISCORD_POSTER_TOKEN "$POSTER_TOKEN"Then run the same check for each Convex value written here.
CRmust be0. -
Enable the service in git. Open a PR setting
enable_service = trueininfra/terraform/discord-gateway/environments/production.tfvarsand merge it. A release that runs before step 10 fails at the plan guard, because the plan would create the service and its alarm. -
Turn on intake. Do this immediately before step 10. While the flag is off the gateway's connector lookups answer 503, so every guild message would log a failed lookup.
pnpm cx -- prod env set VRDEX_DISCORD_INTAKE_ENABLED trueWith the flag on and no gateway yet,
checkHeartbeatusually emails one stale alert within five minutes, then one resolved email once heartbeats arrive. That pair is expected and proves the email path. If the first heartbeat lands before the next check, no pair arrives at all. Keep this step and step 10 close together.The flag is global: it reveals the Integrations connect flow to every community.
-
Create the service. This also creates the running-task alarm, which may send the alarm and OK email pair described under Alarms. Run it from an updated
main, so the merged tfvars apply. The image is the one step 6 released. Check the plan for a task definition replacement: with the image unchanged it meanslinuxParametersshows a perpetual diff, and every manual apply then rolls the task.cd infra/terraform/discord-gateway
CONTAINER_IMAGE=$(aws ecs describe-task-definition --task-definition vrdex-discord-gateway --query 'taskDefinition.containerDefinitions[0].image' --output text | tr -d '\r')
CONVEX_SITE_URL=$(gh variable get GROUP_TELEMETRY_CONVEX_SITE_URL)
terraform apply -var-file=environments/production.tfvars -var "container_image=$CONTAINER_IMAGE" -var "convex_site_url=$CONVEX_SITE_URL"
aws ecs wait services-stable --cluster vrdex-discord-gateway --services vrdex-discord-gateway
cd ../../.. -
Confirm a heartbeat. One should land within two minutes of the task running. Check that
receivedAtis recent, and read the logs if no row appears.pnpm cx -- prod data discordGatewayHeartbeats
aws logs tail /aws/ecs/vrdex-discord-gateway --since 10m
Rollout
The first binding is BASIC's own community, in hold mode, moving to autopublish after a week of clean runs.
Local Control Demo
Use the local demo before provider setup to inspect the route-to-command contract and public media state projection:
pnpm proof:restream:control
The demo writes artifacts/restream-control-demo/<timestamp>/report.html and control-demo-summary.json. It simulates fresh Discord controls, stale-panel rejection, confirmation-gated stop behavior, sanitized media commands, and public-safe state snapshots. It does not connect to Discord, enqueue Convex commands, or mutate event records.