Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes & Improved output for kool cloud setup #487

Merged
merged 4 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 23 additions & 6 deletions commands/cloud_setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"kool-dev/kool/services/compose"
"os"
"path/filepath"
"slices"
"strconv"
"strings"

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

var hasPublicPort bool = false

var serviceNames []string

for serviceName = range composeConfig.Services {
serviceNames = append(serviceNames, serviceName)
}

slices.Sort[[]string](serviceNames)

for _, serviceName = range serviceNames {
var (
confirmed bool
isPublic bool = false
Expand Down Expand Up @@ -188,14 +197,18 @@ func (s *KoolCloudSetup) Execute(args []string) (err error) {

_ = dockerfile.Close()

postInstructions = append(postInstructions, func() {
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))
})
postInstructions = append(postInstructions, func(serviceName string) func() {
return func() {
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))
}
}(serviceName))
}
} else {
postInstructions = append(postInstructions, func() {
s.Shell().Info(fmt.Sprintf("⇒ Service '%s' uses volumes. Make sure to create the necessary Dockerfile and build it to deploy if necessary.", serviceName))
})
postInstructions = append(postInstructions, func(serviceName string) func() {
return func() {
s.Shell().Info(fmt.Sprintf("⇒ Service '%s' uses volumes. Make sure to create the necessary Dockerfile and build it to deploy if necessary.", serviceName))
}
}(serviceName))
}
}
}
Expand Down Expand Up @@ -261,6 +274,10 @@ func (s *KoolCloudSetup) Execute(args []string) (err error) {
s.Shell().Println("")
s.Shell().Success("Setup completed. Please review the generated configuration file before deploying.")
s.Shell().Println("")
s.Shell().Println("Configuration file: " + s.setupParser.ConfigFilePath())
s.Shell().Println("")
s.Shell().Println("Reference: https://kool.dev/docs/deploy-to-kool-cloud/kool-cloud-yml-reference")
s.Shell().Println("")

return
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
`kool.deploy.yml` will hold all the extra configuration needed to move your application from `docker-compose.yml` and run it in the cloud.
`kool.cloud.yml` will hold all the extra configuration needed to move your application from `docker-compose.yml` and run it in the cloud.

## The basics

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.
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.

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

Expand All @@ -14,7 +14,7 @@ services:
- 80:80 # maps the container port 80 to your localhost
```

Now, if you want to deploy this single-container app to the cloud using Kool, you need the following `kool.deploy.yml` file:
Now, if you want to deploy this single-container app to the cloud using Kool, you need the following `kool.cloud.yml` file:

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

## Full example

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

```yaml
services:
Expand Down
Loading