Skip to content

Commit 3f39a87

Browse files
authored
Merge pull request #487 from kool-dev/tweaks-cloud-setup
Fixes & Improved output for `kool cloud setup`
2 parents df31408 + 67bfbe5 commit 3f39a87

File tree

2 files changed

+27
-10
lines changed

2 files changed

+27
-10
lines changed

commands/cloud_setup.go

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"kool-dev/kool/services/compose"
1111
"os"
1212
"path/filepath"
13+
"slices"
1314
"strconv"
1415
"strings"
1516

@@ -86,7 +87,15 @@ func (s *KoolCloudSetup) Execute(args []string) (err error) {
8687

8788
var hasPublicPort bool = false
8889

90+
var serviceNames []string
91+
8992
for serviceName = range composeConfig.Services {
93+
serviceNames = append(serviceNames, serviceName)
94+
}
95+
96+
slices.Sort[[]string](serviceNames)
97+
98+
for _, serviceName = range serviceNames {
9099
var (
91100
confirmed bool
92101
isPublic bool = false
@@ -188,14 +197,18 @@ func (s *KoolCloudSetup) Execute(args []string) (err error) {
188197

189198
_ = dockerfile.Close()
190199

191-
postInstructions = append(postInstructions, func() {
192-
s.Shell().Info(fmt.Sprintf("⇒ New Dockerfile was created to build service '%s' for deploy. Review and make sure it has all the required steps. ", serviceName))
193-
})
200+
postInstructions = append(postInstructions, func(serviceName string) func() {
201+
return func() {
202+
s.Shell().Info(fmt.Sprintf("⇒ New Dockerfile was created to build service '%s' for deploy. Review and make sure it has all the required steps. ", serviceName))
203+
}
204+
}(serviceName))
194205
}
195206
} else {
196-
postInstructions = append(postInstructions, func() {
197-
s.Shell().Info(fmt.Sprintf("⇒ Service '%s' uses volumes. Make sure to create the necessary Dockerfile and build it to deploy if necessary.", serviceName))
198-
})
207+
postInstructions = append(postInstructions, func(serviceName string) func() {
208+
return func() {
209+
s.Shell().Info(fmt.Sprintf("⇒ Service '%s' uses volumes. Make sure to create the necessary Dockerfile and build it to deploy if necessary.", serviceName))
210+
}
211+
}(serviceName))
199212
}
200213
}
201214
}
@@ -261,6 +274,10 @@ func (s *KoolCloudSetup) Execute(args []string) (err error) {
261274
s.Shell().Println("")
262275
s.Shell().Success("Setup completed. Please review the generated configuration file before deploying.")
263276
s.Shell().Println("")
277+
s.Shell().Println("Configuration file: " + s.setupParser.ConfigFilePath())
278+
s.Shell().Println("")
279+
s.Shell().Println("Reference: https://kool.dev/docs/deploy-to-kool-cloud/kool-cloud-yml-reference")
280+
s.Shell().Println("")
264281

265282
return
266283
}

docs/3-Deploy-to-Kool-Cloud/2-kool.deploy.yml-Reference.md renamed to docs/3-Deploy-to-Kool-Cloud/2-kool.cloud.yml-Reference.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
`kool.deploy.yml` will hold all the extra configuration needed to move your application from `docker-compose.yml` and run it in the cloud.
1+
`kool.cloud.yml` will hold all the extra configuration needed to move your application from `docker-compose.yml` and run it in the cloud.
22

33
## The basics
44

5-
The `kool.deploy.yml` file is an extension to your already familiar `docker-compose.yml`, having the same basic structure but introducing some configuration entries to enable you to fine-tune your deployment container needs.
5+
The `kool.cloud.yml` file is an extension to your already familiar `docker-compose.yml`, having the same basic structure but introducing some configuration entries to enable you to fine-tune your deployment container needs.
66

77
Suppose you have the following `docker-compose.yml` file:
88

@@ -14,7 +14,7 @@ services:
1414
- 80:80 # maps the container port 80 to your localhost
1515
```
1616
17-
Now, if you want to deploy this single-container app to the cloud using Kool, you need the following `kool.deploy.yml` file:
17+
Now, if you want to deploy this single-container app to the cloud using Kool, you need the following `kool.cloud.yml` file:
1818

1919
```yaml
2020
services:
@@ -29,7 +29,7 @@ Provided you have already signed up and obtained your access token for Kool Clou
2929

3030
## Full example
3131

32-
Here's an example of `kool.deploy.yml` file showcasing all the features and configuration entries available:
32+
Here's an example of `kool.cloud.yml` file showcasing all the features and configuration entries available:
3333

3434
```yaml
3535
services:

0 commit comments

Comments
 (0)