Documentation
¶
Overview ¶
internal/bootstrap/azure/admininit.go
internal/bootstrap/azure/bootstrap.go
internal/bootstrap/azure/deploy.go
internal/bootstrap/azure/health.go
internal/bootstrap/azure/image.go
internal/bootstrap/azure/inputs.go
internal/bootstrap/azure/params.go
internal/bootstrap/azure/preflight.go
internal/bootstrap/azure/prompt.go
Package azure implements the `cronfoundry bootstrap azure` interactive installer.
Index ¶
- func AdminInit(ctx context.Context, r Runner, binary, dsn, masterKey, orgName string) error
- func AllowOperatorIP(ctx context.Context, r Runner, env, ip string) error
- func Deploy(ctx context.Context, r Runner, region, templateFile, paramsFile string) error
- func GeneratePostgresPassword() (string, error)
- func Preflight(ctx context.Context, r Runner) error
- func ProbeImage(ctx context.Context, owner, tag string) error
- func RestartServe(ctx context.Context, r Runner, env string) error
- func WaitHealthy(ctx context.Context, fqdn string, timeout time.Duration) error
- func WriteParams(in Inputs, masterKey, paramsPath string) error
- type Bootstrap
- type ExecRunner
- type Inputs
- type MockCall
- type MockEnvCall
- type MockResponse
- type MockRunner
- type Runner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AdminInit ¶
AdminInit shells out to `<binary> admin init --org-name <org>` with CRONFOUNDRY_DATABASE_URL and CRONFOUNDRY_MASTER_KEY set in the env.
func AllowOperatorIP ¶
AllowOperatorIP creates a Postgres firewall rule for the operator's IP. The rule name embeds a UTC timestamp so repeated runs don't collide.
func GeneratePostgresPassword ¶
GeneratePostgresPassword returns a 24-character alphanumeric password. Postgres ends up in a connection-string URL where @ : / etc. would need encoding, so we keep it simple.
func Preflight ¶
Preflight verifies az is logged in and bicep is installed. Returns a typed error with a remediation hint.
func ProbeImage ¶
ProbeImage checks ghcr.io/<owner>/cronfoundry:<tag> exists anonymously. On 404 it returns an error suggesting the operator push a v* tag.
func RestartServe ¶
RestartServe forces a new revision so the migrated schema is picked up. (Failed revisions don't auto-heal after admin init.)
func WaitHealthy ¶
WaitHealthy polls https://<fqdn>/healthz until 200 OK or timeout.
func WriteParams ¶
WriteParams writes a Bicep deployment parameters file with every required field set, ingressExternal=true, and the PEM contents inlined.
Types ¶
type Bootstrap ¶
type Bootstrap struct {
Runner Runner
Inputs Inputs
MasterKey string
ParamsPath string // where to write the Bicep params file
TemplateFile string // path to deploy/main.bicep
Binary string // path to the cronfoundry binary (for admin init)
DryRun bool // skip deploy + everything after
ImageRoot string // override ghcr.io for testing; defaults to ghcrRoot
HealthScheme string // "https" by default
HealthHost string // test-only: override fqdn used for /healthz polling
IPDetector func(ctx context.Context) (string, error) // override for tests; nil → detectPublicIPDefault
Stdout io.Writer
}
Bootstrap orchestrates the end-to-end Azure deploy flow.
type ExecRunner ¶
ExecRunner is the production Runner, backed by os/exec.
func (*ExecRunner) RunStreaming ¶
func (*ExecRunner) RunWithEnv ¶
type Inputs ¶
type Inputs struct {
Env string // resource-name suffix, e.g. "prod"
Region string // azure region
ImageOwner string // ghcr owner, default "gambtho"
ImageTag string // ghcr tag, default "latest"
GithubAppID string
OAuthClientID string
OAuthClientSecret string
PEMContents string // raw PEM contents (with BEGIN/END headers)
AdminLogins string // comma-separated github logins
PostgresPassword string
}
Inputs is everything bootstrap needs to deploy.
type MockEnvCall ¶
type MockResponse ¶
type MockRunner ¶
type MockRunner struct {
Responses []MockResponse
Calls []MockCall
EnvCalls []MockEnvCall
Stdout io.Writer
}
MockRunner is a test double recording calls and returning canned responses.
func (*MockRunner) RunStreaming ¶
func (*MockRunner) RunWithEnv ¶
type Runner ¶
type Runner interface {
Run(ctx context.Context, name string, args ...string) ([]byte, error)
RunStreaming(ctx context.Context, name string, args ...string) error
RunWithEnv(ctx context.Context, env []string, name string, args ...string) error
}
Runner abstracts shell-outs so tests can stub them.