azukiapp / azk

azk is a lightweight open source development environment orchestration tool. Instantly & safely run any environment on your local machine.
http://azk.io
Apache License 2.0
897 stars 63 forks source link

On Azkfile, system.name resolves to children's system name instead of parent's. #513

Open jturolla opened 9 years ago

jturolla commented 9 years ago

When extending a system that uses #{system.name} on any path on any mount, this value resolves to the children's name:

  apollo: {
    depends            : ['postgres'],
    image              : { docker: "jturolla/phoenix" },
    provision          : [
      "npm install",
      "mix deps.get",
      "mix ecto.create",
      "mix ecto.migrate",
    ],
    workdir            : "/azk/#{system.name}",
    shell              : "/bin/bash",
    command            : "mix phoenix.server --no-deps-check",
    wait               : { retry: 20, timeout: 2000 },
    mounts             : {
      '/azk/#{system.name}'               : path("./#{system.name}"),   // system.name becomes apollo-test when running the system below, breaking the app.
      '/azk/#{system.name}/deps'          : persistent("#{system.name}/deps"),
      '/azk/#{system.name}/_build'        : persistent("#{system.name}/_build"),
      '/root/.hex'                        : path(env.HOME + '/.hex'),
      '/azk/#{system.name}/node_modules'  : persistent("#{system.name}/node_modules"),
      '/azk/#{system.name}/web/static/js' : path("./#{system.name}/web/static/js"),
      '/azk/#{system.name}/web/static/css': path("./#{system.name}/web/static/css"),
    },
    scalable           : { "default": 1 },
    http               : {
      domains: [ "#{system.name}.#{azk.default_domain}" ]
    },
    ports              : { http: "4000" },
    envs               : { MIX_ENV: "dev" },
  },
  "apollo-test": {
    extends: "apollo",
    depends: ["postgres"],
    command: "exit 0",
    scalable: { default: 0, limit: 1 },
    http: false,
    wait: false,
    envs: {
      MIX_ENV: "test",
      HOST   : "#{system.name}.#{azk.default_domain}",
    },
  }
saitodisse commented 9 years ago

Yes, @jturolla, the extends just copy and merge everything as a separated system. When you use #{system.name} apollo-test system the result is apollo-test.

saitodisse commented 9 years ago

Ok, I see. @gullitmiranda has explained to me. It is changing the extended system name. This is wrong.

jturolla commented 9 years ago

@nuxlli discussed that with me on #azk at docke-br slack. The idea was to convert #{system.name} to #{parent.name} when in the context of a children. So #{system.name} would resolve to apollo when using apollo-test.

Although this is the case, idk if this is a bug or a design decision. Guess it needs discussion.