Skip to content

fix: embed compose files, fix PostgreSQL refs, align Go module path#46

Open
mohit-nagaraj wants to merge 4 commits intomainfrom
fix/embed-compose-and-bugs
Open

fix: embed compose files, fix PostgreSQL refs, align Go module path#46
mohit-nagaraj wants to merge 4 commits intomainfrom
fix/embed-compose-and-bugs

Conversation

@mohit-nagaraj
Copy link
Copy Markdown
Member

Summary

  • Embed docker-compose files into the binary via go:embed so orchcli init writes them to docker/ — fixes the broken orchcli init + orchcli start flow
  • Replace all PostgreSQL references with MongoDB (waitForMongoDB, exec service map, next-steps output) to match actual compose files
  • Align Go module path from github.com/kubeorchestra/cli to github.com/kubeorch/cli to match the GitHub org and fix version injection via ldflags in the release workflow

Test plan

  • go build compiles successfully
  • orchcli init creates compose files in docker/
  • orchcli start -d starts services without "compose file not found" error
  • orchcli status shows MongoDB health, not PostgreSQL
  • orchcli exec mongodb opens mongosh
  • After next release: orchcli --version shows actual version instead of dev

Fixes #45
Related: KubeOrch/docs#14

- Embed docker-compose files into binary via go:embed and write them
  during orchcli init (both production and dev modes)
- Replace all PostgreSQL references with MongoDB (waitForMongoDB,
  container names, exec service map, next-steps output)
- Change Go module path from github.com/kubeorchestra/cli to
  github.com/kubeorch/cli to match the GitHub org and fix version
  injection via ldflags in release workflow
- Update all imports, Makefile, and test files accordingly

Fixes #45
@github-advanced-security
Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

for i := 0; i < maxRetries; i++ {
for _, name := range containerNames {
cmd := exec.Command("docker", "exec", name, "pg_isready", "-U", "kubeorchestra", "-d", "kubeorchestra")
cmd := exec.Command("docker", "exec", name, "mongosh", "--eval", "db.adminCommand('ping')")
return fmt.Errorf("failed to read embedded file %s: %w", entry.Name(), err)
}
dest := filepath.Join(targetDir, entry.Name())
if err := os.WriteFile(dest, data, 0644); err != nil {
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request renames the project organization from kubeorchestra to kubeorch, updates the database from PostgreSQL to MongoDB, and introduces embedded Docker Compose configurations for various development and production environments. Key feedback includes updating image registry paths in the new Compose files to reflect the organization change, ensuring consistent environment variable naming for the UI service, and addressing hardcoded container names in the exec command that currently prevent it from working correctly in development or hybrid modes.

command: air

ui:
image: ghcr.io/kubeorchestra/ui:latest
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The image registry path should be updated to use the new organization name kubeorch to match the Go module path alignment and the output messages in cmd/init.go.

    image: ghcr.io/kubeorch/ui:latest

start_period: 10s

core:
image: ghcr.io/kubeorchestra/core:latest
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The image registry path should be updated to use the new organization name kubeorch to match the Go module path alignment.

    image: ghcr.io/kubeorch/core:latest

start_period: 10s

core:
image: ghcr.io/kubeorchestra/core:latest
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The image registry path should be updated to use the new organization name kubeorch to match the Go module path alignment.

    image: ghcr.io/kubeorch/core:latest

condition: service_healthy

ui:
image: ghcr.io/kubeorchestra/ui:latest
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The image registry path should be updated to use the new organization name kubeorch to match the Go module path alignment.

    image: ghcr.io/kubeorch/ui:latest

environment:
# Both use internal Docker network names
NEXT_PUBLIC_API_URL: http://localhost:3000
API_URL: http://core:3000
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Inconsistent environment variable name. In docker-compose.prod.yml, the internal API URL is provided via API_URL_INTERNAL. It should be consistent across all compose files to ensure the UI container can correctly connect to the core service.

      API_URL_INTERNAL: http://core:3000

containerName, valid := validServices[service]
if !valid {
return fmt.Errorf("invalid service: %s. Valid services: postgres, core, ui", service)
return fmt.Errorf("invalid service: %s. Valid services: mongodb, core, ui", service)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The exec command logic currently uses hardcoded container names (e.g., kubeorchestra-mongodb) which will fail when running in development or hybrid modes where containers have suffixes like -dev or -hybrid. Consider updating the logic to detect the actual running container name based on the service prefix.

- Auto-generate core/config.yaml with random JWT_SECRET and
  ENCRYPTION_KEY during orchcli init (dev modes with --fork-core)
- Auto-generate ui/.env.local with NEXT_PUBLIC_API_URL during
  orchcli init (dev modes with --fork-ui)
- Update all compose files: ghcr.io/kubeorchestra/* -> ghcr.io/kubeorch/*
  to match the GitHub org and new GHCR workflows
- Config files are skipped if they already exist (safe to re-run)
return nil // already exists, don't overwrite
}

if err := os.WriteFile(targetPath, []byte(envLocalTemplate), 0644); err != nil {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix broken orchcli init/start flow, PostgreSQL refs, version injection, and module path

2 participants