diff --git a/internal/command/deploy/deploy.go b/internal/command/deploy/deploy.go index d203c6a802..6952f067f9 100644 --- a/internal/command/deploy/deploy.go +++ b/internal/command/deploy/deploy.go @@ -83,11 +83,6 @@ var CommonFlags = flag.Set{ Default: false, Hidden: true, }, - flag.Bool{ - Name: "ha", - Description: "Create spare machines that increases app availability", - Default: true, - }, flag.Bool{ Name: "smoke-checks", Description: "Perform smoke checks during deployment", @@ -192,6 +187,11 @@ func New() *Command { flag.App(), flag.AppConfig(), // Not in CommonFlags because it's not relevant to a first deploy + flag.Bool{ + Name: "ha", + Description: "Create spare machines that increases app availability", + Default: true, + }, flag.Bool{ Name: "update-only", Description: "Do not create Machines for new process groups", diff --git a/internal/command/launch/launch.go b/internal/command/launch/launch.go index 0816e24f9a..09b8f9d205 100644 --- a/internal/command/launch/launch.go +++ b/internal/command/launch/launch.go @@ -35,15 +35,6 @@ func (state *launchState) Launch(ctx context.Context) error { return err } - org, err := state.Org(ctx) - if err != nil { - return err - } - if !planValidateHighAvailability(ctx, state.Plan, org, !state.warnedNoCcHa) { - state.Plan.HighAvailability = false - state.warnedNoCcHa = true - } - app, err := state.createApp(ctx) if err != nil { return err diff --git a/internal/command/launch/plan/plan.go b/internal/command/launch/plan/plan.go index d8d4eeeb53..6a4a152223 100644 --- a/internal/command/launch/plan/plan.go +++ b/internal/command/launch/plan/plan.go @@ -10,8 +10,9 @@ type LaunchPlan struct { AppName string `json:"name"` OrgSlug string `json:"org"` - RegionCode string `json:"region"` - HighAvailability bool `json:"ha"` + RegionCode string `json:"region"` + // Deprecated: The UI exposes this for now so we'll honor it, but we're moving towards always HA for Fly Launch apps + HighAvailability bool `json:"ha"` // Deprecated: The UI currently returns this instead of Compute, but new development should use Compute. CPUKind string `json:"vm_cpukind,omitempty"` diff --git a/internal/command/launch/plan_builder.go b/internal/command/launch/plan_builder.go index 0fa51e1609..56f3ed9da7 100644 --- a/internal/command/launch/plan_builder.go +++ b/internal/command/launch/plan_builder.go @@ -60,9 +60,8 @@ const recoverableSpecifyInUi = "must be specified in UI" // Doing this can lead to double-calculation, especially of scanners which could // have a lot of processing to do. Hence, a cache :) type planBuildCache struct { - appConfig *appconfig.Config - sourceInfo *scanner.SourceInfo - warnedNoCcHa bool // true => We have already warned that deploying ha is impossible for an org with no payment method + appConfig *appconfig.Config + sourceInfo *scanner.SourceInfo } func appNameTakenErr(appName string) error { @@ -184,7 +183,7 @@ func buildManifest(ctx context.Context, recoverableErrors *recoverableErrorBuild AppName: appName, OrgSlug: org.Slug, RegionCode: region.Code, - HighAvailability: flag.GetBool(ctx, "ha"), + HighAvailability: true, Compute: compute, CPUKind: guest.CPUKind, CPUs: guest.CPUs, @@ -207,13 +206,8 @@ func buildManifest(ctx context.Context, recoverableErrors *recoverableErrorBuild } buildCache := &planBuildCache{ - appConfig: appConfig, - sourceInfo: srcInfo, - warnedNoCcHa: false, - } - - if planValidateHighAvailability(ctx, lp, org, true) { - buildCache.warnedNoCcHa = true + appConfig: appConfig, + sourceInfo: srcInfo, } if srcInfo != nil { @@ -264,11 +258,9 @@ func stateFromManifest(ctx context.Context, m LaunchManifest, optionalCache *pla var ( appConfig *appconfig.Config copiedConfig bool - warnedNoCcHa bool ) if optionalCache != nil { appConfig = optionalCache.appConfig - warnedNoCcHa = optionalCache.warnedNoCcHa } else { appConfig, copiedConfig, err = determineBaseAppConfig(ctx) if err != nil { @@ -348,9 +340,8 @@ func stateFromManifest(ctx context.Context, m LaunchManifest, optionalCache *pla }, env: envVars, planBuildCache: planBuildCache{ - appConfig: appConfig, - sourceInfo: srcInfo, - warnedNoCcHa: warnedNoCcHa, + appConfig: appConfig, + sourceInfo: srcInfo, }, cache: map[string]interface{}{}, }, nil @@ -652,13 +643,3 @@ func determineCompute(ctx context.Context, config *appconfig.Config, srcInfo *sc } return []*appconfig.Compute{guestToCompute(guest)}, reason, nil } - -func planValidateHighAvailability(ctx context.Context, p *plan.LaunchPlan, org *fly.Organization, print bool) bool { - if !org.Billable && p.HighAvailability { - if print { - fmt.Fprintln(iostreams.FromContext(ctx).ErrOut, "Warning: This organization has no payment method, turning off high availability") - } - return false - } - return true -}