From f57d76034a98fbb173e17df760ae11318e238e00 Mon Sep 17 00:00:00 2001 From: fabriciojs Date: Wed, 15 Nov 2023 22:45:16 -0300 Subject: [PATCH 1/4] rename reference doc --- ...loy.yml-Reference.md => 2-kool.cloud.yml-Reference.md} | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) rename docs/3-Deploy-to-Kool-Cloud/{2-kool.deploy.yml-Reference.md => 2-kool.cloud.yml-Reference.md} (91%) diff --git a/docs/3-Deploy-to-Kool-Cloud/2-kool.deploy.yml-Reference.md b/docs/3-Deploy-to-Kool-Cloud/2-kool.cloud.yml-Reference.md similarity index 91% rename from docs/3-Deploy-to-Kool-Cloud/2-kool.deploy.yml-Reference.md rename to docs/3-Deploy-to-Kool-Cloud/2-kool.cloud.yml-Reference.md index 1acedc1f..4c01b968 100644 --- a/docs/3-Deploy-to-Kool-Cloud/2-kool.deploy.yml-Reference.md +++ b/docs/3-Deploy-to-Kool-Cloud/2-kool.cloud.yml-Reference.md @@ -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: @@ -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: @@ -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: From 3b2982bd575ef5c4ad3e28785fbaa4cbc44c37be Mon Sep 17 00:00:00 2001 From: fabriciojs Date: Wed, 15 Nov 2023 22:45:52 -0300 Subject: [PATCH 2/4] increase setup verbiage + fix volume service name display --- commands/cloud_setup.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/commands/cloud_setup.go b/commands/cloud_setup.go index e5ad9a7e..8b3e0e9a 100644 --- a/commands/cloud_setup.go +++ b/commands/cloud_setup.go @@ -193,9 +193,9 @@ func (s *KoolCloudSetup) Execute(args []string) (err error) { }) } } else { - postInstructions = append(postInstructions, func() { + postInstructions = append(postInstructions, func(serviceName string) { 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)) } } } @@ -261,6 +261,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 } From 0e9431f4b45255508d20794e9e4572115c0a06b4 Mon Sep 17 00:00:00 2001 From: fabriciojs Date: Wed, 15 Nov 2023 22:55:34 -0300 Subject: [PATCH 3/4] fix cloud setup tips display --- commands/cloud_setup.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/commands/cloud_setup.go b/commands/cloud_setup.go index 8b3e0e9a..e7da33fb 100644 --- a/commands/cloud_setup.go +++ b/commands/cloud_setup.go @@ -188,13 +188,17 @@ 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(serviceName string) { - 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)) } } From 67bfbe5b49840396cb04781a48639b427d97b3c2 Mon Sep 17 00:00:00 2001 From: fabriciojs Date: Wed, 15 Nov 2023 23:03:31 -0300 Subject: [PATCH 4/4] guarantee stable sorting of services - alphabetical --- commands/cloud_setup.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/commands/cloud_setup.go b/commands/cloud_setup.go index e7da33fb..59e34c5e 100644 --- a/commands/cloud_setup.go +++ b/commands/cloud_setup.go @@ -10,6 +10,7 @@ import ( "kool-dev/kool/services/compose" "os" "path/filepath" + "slices" "strconv" "strings" @@ -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