Skip to content

Commit 90e0edc

Browse files
CLI Copy Edits (#1380)
* refer to deploying and configuring projects instead of services * capitalize Heroku * logging heroku API calls * avoid mentioning heroku cli in help text for flow that only occurs when the cli is not installed * typo fix Co-authored-by: Lio李歐 <[email protected]> * link to heroku migration docs for next steps --------- Co-authored-by: Lio李歐 <[email protected]>
1 parent dffa2cd commit 90e0edc

File tree

3 files changed

+33
-25
lines changed

3 files changed

+33
-25
lines changed

src/cmd/cli/command/commands.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,9 +500,9 @@ func afterGenerate(ctx context.Context, result setup.SetupResult) {
500500
}
501501

502502
if len(envInstructions) > 0 {
503-
printDefangHint("Check the files in your favorite editor.\nTo configure the service, do "+cd, envInstructions...)
503+
printDefangHint("Check the files in your favorite editor.\nTo configure this project, run "+cd, envInstructions...)
504504
} else {
505-
printDefangHint("Check the files in your favorite editor.\nTo deploy the service, do "+cd, "compose up")
505+
printDefangHint("Check the files in your favorite editor.\nTo deploy this project, run "+cd, "compose up")
506506
}
507507
}
508508

src/pkg/migrate/heroku.go

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,37 @@ type HerokuApplicationInfo struct {
2828

2929
func collectHerokuApplicationInfo(ctx context.Context, client HerokuClientInterface, appName string) (HerokuApplicationInfo, error) {
3030
var applicationInfo HerokuApplicationInfo
31+
32+
term.Info("Identifying deployed dynos")
3133
dynos, err := client.ListDynos(ctx, appName)
3234
if err != nil {
3335
return HerokuApplicationInfo{}, fmt.Errorf("failed to list dynos: %w", err)
3436
}
35-
applicationInfo.Dynos = dynos
3637

38+
applicationInfo.Dynos = dynos
3739
term.Debugf("Dynos for the selected application: %+v\n", dynos)
3840

41+
dynoSizes := make(map[string]HerokuDynoSize)
42+
for _, dyno := range dynos {
43+
dynoSize, err := client.GetDynoSize(ctx, dyno.Size)
44+
if err != nil {
45+
return HerokuApplicationInfo{}, fmt.Errorf("failed to get dyno size for dyno %s: %w", dyno.Name, err)
46+
}
47+
dynoSizes[dyno.Name] = dynoSize
48+
}
49+
50+
applicationInfo.DynoSizes = dynoSizes
51+
term.Debugf("Dyno sizes for the selected application: %+v\n", dynoSizes)
52+
53+
releaseTasks, err := client.GetReleaseTasks(ctx, appName)
54+
if err != nil {
55+
return HerokuApplicationInfo{}, fmt.Errorf("failed to get Heroku release tasks: %w", err)
56+
}
57+
58+
applicationInfo.ReleaseTasks = releaseTasks
59+
term.Debugf("Release tasks for the selected application: %+v\n", releaseTasks)
60+
61+
term.Info("Identifying configured addons")
3962
addons, err := client.ListAddons(ctx, appName)
4063
if err != nil {
4164
return HerokuApplicationInfo{}, fmt.Errorf("failed to list Heroku addons: %w", err)
@@ -54,39 +77,21 @@ func collectHerokuApplicationInfo(ctx context.Context, client HerokuClientInterf
5477
}
5578

5679
term.Debugf("Postgres info for the selected application: %+v\n", applicationInfo.PGInfo)
57-
dynoSizes := make(map[string]HerokuDynoSize)
58-
59-
// for each dyno, get the dyno size,
60-
for _, dyno := range dynos {
61-
dynoSize, err := client.GetDynoSize(ctx, dyno.Size)
62-
if err != nil {
63-
return HerokuApplicationInfo{}, fmt.Errorf("failed to get dyno size for dyno %s: %w", dyno.Name, err)
64-
}
65-
dynoSizes[dyno.Name] = dynoSize
66-
}
67-
68-
applicationInfo.DynoSizes = dynoSizes
6980

7081
configVars, err := client.ListConfigVars(ctx, appName)
7182
if err != nil {
7283
return HerokuApplicationInfo{}, fmt.Errorf("failed to list Heroku config vars: %w", err)
7384
}
7485
applicationInfo.ConfigVars = configVars
7586

76-
releaseTasks, err := client.GetReleaseTasks(ctx, appName)
77-
if err != nil {
78-
return HerokuApplicationInfo{}, fmt.Errorf("failed to get Heroku release tasks: %w", err)
79-
}
80-
applicationInfo.ReleaseTasks = releaseTasks
81-
8287
return applicationInfo, nil
8388
}
8489

8590
func selectSourceApplication(surveyor surveyor.Surveyor, appNames []string) (string, error) {
8691
var selectedApp string
8792
for {
8893
err := surveyor.AskOne(&survey.Select{
89-
Message: "Select the Heroku application to use as a source:",
94+
Message: "Select the Heroku application you would like to migrate:",
9095
Options: appNames, // This should be a list of app names, but for simplicity, we use the whole string
9196
}, &selectedApp)
9297
if err != nil {
@@ -383,7 +388,7 @@ func getHerokuAuthToken() (string, error) {
383388
for {
384389
err := survey.AskOne(&survey.Password{
385390
Message: "Please paste a Heroku auth token, so Defang can collect information about your applications",
386-
Help: "Run `heroku authorizations:create --expires-in=300` or visit https://dashboard.heroku.com/account/applications/authorizations/new",
391+
Help: "Visit https://dashboard.heroku.com/account/applications/authorizations/new",
387392
}, &token)
388393
if err != nil {
389394
return "", fmt.Errorf("failed to prompt for Heroku token: %w", err)

src/pkg/setup/setup.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func (s *SetupClient) Start(ctx context.Context) (SetupResult, error) {
3636
Options: []string{
3737
"Generate with AI",
3838
"Clone a sample",
39-
"Migrate from heroku",
39+
"Migrate from Heroku",
4040
},
4141
}, &response)
4242
if err != nil {
@@ -48,7 +48,7 @@ func (s *SetupClient) Start(ctx context.Context) (SetupResult, error) {
4848
return s.AIGenerate(ctx)
4949
case "Clone a sample":
5050
return s.CloneSample(ctx, "")
51-
case "Migrate from heroku":
51+
case "Migrate from Heroku":
5252
return s.MigrateFromHeroku(ctx)
5353
}
5454

@@ -243,6 +243,9 @@ func (s *SetupClient) MigrateFromHeroku(ctx context.Context) (SetupResult, error
243243
}
244244

245245
term.Info("Compose file written to", composeFilePath)
246+
term.Info("Your application is now ready to deploy with Defang.")
247+
term.Info("For next steps, visit https://docs.defang.io/docs/tutorials/migrate-from-heroku")
248+
246249
return SetupResult{Folder: "."}, nil
247250
}
248251

0 commit comments

Comments
 (0)