Ephemeral CPU Droplet fleet that horizontally scales the iteration loop:
- infra/terraform/test-fleet: cattle Droplets from a golden image (auto-discovered
by name via digitalocean_images), grouped under the mc:dev DO project, with a
mocked-provider test suite (no token/spend).
- infra/packer: golden-image builder reusing scripts/dev-setup/linux.sh.
- scripts/run/dist.sh: ./run dist:{check,up,sim,train,down} — shard sim/test
batches across workers via autoplay-batch AUTOPLAY_HOST+SEED_OFFSET.
GPU intentionally absent (workload is CPU-bound per docs/ai-production.md).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
80 lines
1.9 KiB
HCL
80 lines
1.9 KiB
HCL
// Bakes a DigitalOcean custom image (snapshot) with the full toolchain + a warm
|
|
// clone + a prebuilt GDExtension + a warm Godot import cache, so fleet workers
|
|
// boot build-ready in ~30s instead of running rustup/godot-install per spin-up.
|
|
//
|
|
// Build once:
|
|
// export DIGITALOCEAN_TOKEN=... // or pass -var do_token=...
|
|
// packer init infra/packer/golden-image.pkr.hcl
|
|
// packer build -var git_remote=https://gitlab.com/<you>/magic-civilization.git \
|
|
// infra/packer/golden-image.pkr.hcl
|
|
//
|
|
// The image is named mc-golden-<timestamp>; the test-fleet Terraform module
|
|
// auto-discovers the newest one by the "mc-golden" name substring.
|
|
|
|
packer {
|
|
required_plugins {
|
|
digitalocean = {
|
|
source = "github.com/digitalocean/digitalocean"
|
|
version = ">= 1.4.0"
|
|
}
|
|
}
|
|
}
|
|
|
|
variable "do_token" {
|
|
type = string
|
|
sensitive = true
|
|
default = env("DIGITALOCEAN_TOKEN")
|
|
}
|
|
|
|
variable "region" {
|
|
type = string
|
|
default = "nyc3"
|
|
}
|
|
|
|
# A one-off CPU-Optimized box builds fast (cargo + godot import are CPU-heavy);
|
|
# it only exists for the duration of the build.
|
|
variable "build_size" {
|
|
type = string
|
|
default = "c-8"
|
|
}
|
|
|
|
variable "git_remote" {
|
|
type = string
|
|
}
|
|
|
|
variable "git_ref" {
|
|
type = string
|
|
default = "main"
|
|
}
|
|
|
|
variable "remote_user" {
|
|
type = string
|
|
default = "mc"
|
|
}
|
|
|
|
locals {
|
|
ts = formatdate("YYYYMMDDhhmmss", timestamp())
|
|
}
|
|
|
|
source "digitalocean" "golden" {
|
|
api_token = var.do_token
|
|
region = var.region
|
|
size = var.build_size
|
|
image = "ubuntu-24-04-x64"
|
|
ssh_username = "root"
|
|
snapshot_name = "mc-golden-${local.ts}"
|
|
}
|
|
|
|
build {
|
|
sources = ["source.digitalocean.golden"]
|
|
|
|
provisioner "shell" {
|
|
environment_vars = [
|
|
"GIT_REMOTE=${var.git_remote}",
|
|
"GIT_REF=${var.git_ref}",
|
|
"BUILD_USER=${var.remote_user}",
|
|
]
|
|
execute_command = "chmod +x {{ .Path }}; env {{ .Vars }} bash {{ .Path }}"
|
|
script = "${path.root}/provision.sh"
|
|
}
|
|
}
|