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

devspace init -> Docker-Compose migration ignores ENVs/--vars #2853

Open
excalq opened this issue May 10, 2024 · 1 comment
Open

devspace init -> Docker-Compose migration ignores ENVs/--vars #2853

excalq opened this issue May 10, 2024 · 1 comment
Labels
kind/bug Something isn't working

Comments

@excalq
Copy link

excalq commented May 10, 2024

What happened?

When running devspace init in an existing codebase having docker-compose.yaml, Devspace prompts for migration from Docker Compose. However, it seems to ignore either locally sourced/exported ENVs as well as use of --vars. When docker-compose.yaml uses ENVs for the ports values, the migration crashes.

set -a; source .env
# Same result with or without using --var=... below
devspace init --var=DB_PORT=27017 --var=EXPRESS_PORT=1337

? Docker Compose configuration detected. Do you want to create a DevSpace configuration based on Docker Compose? Convert existing docker-compose.yml to devspace.yaml
WARN[0001] The "EXPRESS_PORT" variable is not set. Defaulting to a blank string.
WARN[0001] The "EXPRESS_PORT" variable is not set. Defaulting to a blank string.
...
WARN[0001] The "DB_PORT" variable is not set. Defaulting to a blank string.
WARN[0001] The "DB_PORT" variable is not set. Defaulting to a blank string.
fatal 1 error(s) decoding:

* error decoding 'Ports': No port specified: :<empty>

What did you expect to happen instead?

Devspace would create a configuration respecting ENV setting of service's ports, and populate ENVs from the .env file.

How can we reproduce the bug? (as minimally and precisely as possible)

No devspace.yaml exist yet, new project in a small existing node.js codebase, with MongoDB and Redis DBs.

Local Environment:

  • DevSpace Version: [use devspace --version]
    devspace version 6.3.12
  • Operating System: windows | linux | mac
    MacOS
  • ARCH of the OS: AMD64 | ARM64 | i386
    ARM64
    Kubernetes Cluster:
  • Cloud Provider: google | aws | azure | other
    N/A
  • Kubernetes Version: [use kubectl version]
    (Minikube, k8s 1.28)

Anything else we need to know?

@excalq excalq added the kind/bug Something isn't working label May 10, 2024
@lizardruss
Copy link
Collaborator

Can you try setting the environment variables like this and report back?

DB_PORT=27017 EXPRESS_PORT=1337 devspace init

IIRC --var values won't be picked up by the docker-compose libraries used internally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants