Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.
This repository was archived by the owner on Feb 8, 2021. It is now read-only.

Field env_file in compose-file crashes cli #239

Open

Description

@adius

Only occurs when I set the env_file field

version: '2'
services:
  mongo:
    image: mongo
    expose:
      - 27017
  app:
    image: node-app
    fip: 123.123.123.123
    depends_on:
      - mongo
    links:
      - mongo
    ports:
      - 80:3000
    env_file:
      - secrets.env
    environment:
      NODE_ENV: production
$ hyper compose up --file=hyper-compose.yaml
panic: interface conversion: interface {} is map[interface {}]interface {}, not []interface {}

goroutine 1 [running]:
github.com/hyperhq/libcompose/config.readEnvFile(0x195aaa0, 0x19c8a18, 0x7fff5fbff560, 0x12, 0xc4202f1740, 0xc4202f1700, 0x0, 0x0)
	/private/tmp/hyper-20171001-70598-1bvplja/vendor/src/github.com/hyperhq/libcompose/config/merge.go:84 +0xa54
github.com/hyperhq/libcompose/config.parseV2(0x195aaa0, 0x19c8a18, 0x1955ca0, 0xc4201f5c00, 0x7fff5fbff560, 0x12, 0xc4202f1740, 0xc4202f16e0, 0xc4202f1710, 0x0, ...)
	/private/tmp/hyper-20171001-70598-1bvplja/vendor/src/github.com/hyperhq/libcompose/config/merge_v2.go:95 +0x81
github.com/hyperhq/libcompose/config.MergeServicesV2(0xc4201f5c40, 0x1955ca0, 0xc4201f5c00, 0x195aaa0, 0x19c8a18, 0x7fff5fbff560, 0x12, 0xc420332380, 0x127, 0x327, ...)
	/private/tmp/hyper-20171001-70598-1bvplja/vendor/src/github.com/hyperhq/libcompose/config/merge_v2.go:36 +0x219
github.com/hyperhq/libcompose/config.Merge(0xc4201f5c40, 0x1955ca0, 0xc4201f5c00, 0x195aaa0, 0x19c8a18, 0x7fff5fbff560, 0x12, 0xc420332380, 0x127, 0x327, ...)
	/private/tmp/hyper-20171001-70598-1bvplja/vendor/src/github.com/hyperhq/libcompose/config/merge.go:32 +0x323
github.com/hyperhq/libcompose/project.(*Project).load(0xc420271ea0, 0x7fff5fbff560, 0x12, 0xc420332380, 0x127, 0x327, 0x31, 0xc4201ab848)
	/private/tmp/hyper-20171001-70598-1bvplja/vendor/src/github.com/hyperhq/libcompose/project/project.go:163 +0xb0
github.com/hyperhq/libcompose/project.(*Project).Parse(0xc420271ea0, 0xc420271c20, 0xc4201061c0)
	/private/tmp/hyper-20171001-70598-1bvplja/vendor/src/github.com/hyperhq/libcompose/project/project.go:88 +0x16f
github.com/hyperhq/libcompose/docker.NewProject(0xc4201061c0, 0xc42032e290, 0x1, 0x1, 0x1)
	/private/tmp/hyper-20171001-70598-1bvplja/vendor/src/github.com/hyperhq/libcompose/docker/project.go:55 +0xab
github.com/hyperhq/hypercli/api/client.(*DockerCli).CmdComposeUp(0xc420271c20, 0xc420010170, 0x1, 0x1, 0x0, 0x0)
	/private/tmp/hyper-20171001-70598-1bvplja/src/github.com/hyperhq/hypercli/api/client/compose.go:142 +0x593
reflect.callMethod(0xc4202f1110, 0xc4201abd60)
	/usr/local/Cellar/go/1.9/libexec/src/reflect/value.go:640 +0x17e
reflect.methodValueCall(0xc420010170, 0x1, 0x1, 0x3, 0xc4202f1110, 0x0, 0x0, 0x1663a9a, 0xc4202f0a80, 0xc4201abf70, ...)
	/usr/local/Cellar/go/1.9/libexec/src/reflect/asm_amd64.s:29 +0x33
github.com/hyperhq/hypercli/cli.(*Cli).Run(0xc4202f0a50, 0xc420010150, 0x3, 0x3, 0x19568e0, 0xc42000e020)
	/private/tmp/hyper-20171001-70598-1bvplja/src/github.com/hyperhq/hypercli/cli/cli.go:81 +0x296
main.main()
	/private/tmp/hyper-20171001-70598-1bvplja/hyper/hyper.go:85 +0x41f

Activity

  1. carmark commented on Oct 3, 2017

    @carmark
    Contributor

    Would you please provide the format of secrets.env file?

    The hyper compose accepts environment format is defined at compose document, such as:

    # Set Rails/Rack environment
    RACK_ENV=development
    

    The panic will be fixed, and you can use that format as a workaround.

    Thanks,

  2. adius commented on Oct 3, 2017

    @adius
    Author
    SESSION_SECRET=sdfmsjheflskehf
    SENDGRID_API_KEY=asdjfalksejfdfe
    
  3. carmark commented on Oct 3, 2017

    @carmark
    Contributor

    Hello @adius ,

    I put your content into /tmp/tmp.env and used it into the compose file, the test is like:

    [lei@h8s-single hypercli]$ hyper compose up -d -f hyper-compose.yml
    Project [hypercli]: Starting project
    [1/1] [web]: Starting
    [1/1] [web]: Started
    
    Project [hypercli]: Project started
    [lei@h8s-single hypercli]$ hyper ps -a
    CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                                              NAMES                PUBLIC IP
    38e092007b51        busybox:latest      "sh"                     7 seconds ago       Up 4 seconds                                                           hypercli-web-1
    [lei@h8s-single hypercli]$ hyper exec -ti hypercli-web-1 env
    HOME=/root
    TERM=xterm
    PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
    HOSTNAME=38e092007b51
    SESSION_SECRET=sdfmsjheflskehf
    SENDGRID_API_KEY=asdjfalksejfdfe
    

    The compose file is:

    $ cat hyper-compose.yml
    version: '2'
    services:
      web:
        image: busybox:latest
        env_file:
          - /tmp/tmp.env
    
  4. gbogard commented on May 16, 2018

    @gbogard

    Hello
    Any update on this ? I'm facing the exact same issue :/ My compose file and my env-file are located in the same folder, and I'm sure the env_file is properly formatted

  5. ptptptptptpt commented on May 16, 2018

    @ptptptptptpt
    Contributor

    Hi, @gbogard ,
    It turns out that when using 'env_file', the 'environment' items (if exist in compose file) must be in the same format, e.g. XXXXX=xxxxx

  6. gbogard commented on May 22, 2018

    @gbogard

    Alright, thanks for your reply. This can be closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions