diff --git a/cmd/beach/cmd/helpers.go b/cmd/beach/cmd/helpers.go index 5d8f935..1ac9163 100644 --- a/cmd/beach/cmd/helpers.go +++ b/cmd/beach/cmd/helpers.go @@ -85,6 +85,8 @@ func retrieveCloudStorageCredentials(instanceIdentifier string, projectNamespace } if len(bucketName) == 0 { + log.Debug("Received the following output while fetching BEACH_GOOGLE_CLOUD_STORAGE_* variables:") + log.Debug(output) return errors.New("could not determine cloud storage bucket name from instance variables"), "", []byte("") } log.Debug("Using cloud storage bucket " + bucketName) diff --git a/cmd/beach/cmd/start.go b/cmd/beach/cmd/start.go index 7ececd4..c6357a1 100644 --- a/cmd/beach/cmd/start.go +++ b/cmd/beach/cmd/start.go @@ -18,6 +18,7 @@ import ( "errors" "github.com/flownative/localbeach/pkg/path" "os" + "path/filepath" "strings" "time" @@ -107,6 +108,22 @@ func startLocalBeach() error { } if len(nginxStatusOutput) == 0 || len(databaseStatusOutput) == 0 { + composeFileContent := readFileFromAssets("local-beach/docker-compose.yml") + composeFileContent = strings.ReplaceAll(composeFileContent, "{{databasePath}}", path.Database) + composeFileContent = strings.ReplaceAll(composeFileContent, "{{certificatesPath}}", path.Certificates) + + destination, err := os.Create(filepath.Join(path.Base, "docker-compose.yml")) + if err != nil { + log.Error("failed creating docker-compose.yml: ", err) + } else { + _, err = destination.WriteString(composeFileContent) + if err != nil { + log.Error(err) + } + + } + _ = destination.Close() + log.Info("Starting reverse proxy and database server ...") commandArgs := []string{"-f", path.Base + "docker-compose.yml", "up", "--remove-orphans", "-d"} err = exec.RunInteractiveCommand("docker-compose", commandArgs)