Multi-App deployment use output attribute from app A as input for app B

Trying to to use waypoint instead of a docker-compose setup. With a fairly common webapp / db containers services.

project = "project"

app "web" {
  build {
    use "docker" {
    }
  }

  # Deploy to Docker
  deploy {
    use "docker" {
      service_port = 8000
      static_environment = {
        "SECRET_KEY" : "changeme"

        "DB_NAME" : "project"
        "DB_USER" : "admin"
        "DB_PASSWORD" : "Smartproject"
        "DB_HOST" : db.deploy.container
        "DB_PORT" : 5432
      }
    }
  }
}

app "db" {
  build {
    use "docker-pull" {
      image = "postgres"
      tag   = "12.2"
    }
  }

  deploy {
    use "docker" {
      service_port = 5432
      static_environment = {
        "POSTGRES_DB" : "project"
        "POSTGRES_USER" : "user"
        "POSTGRES_PASSWORD" : "password"
      }
    }
  }
}

As per the docker plugin documentation Plugin: Docker | Waypoint by HashiCorp, The db deploy stanza should output the id used by the db container that we can input to the webapp as the DB_HOST env variable. I was not able to find a way to accomplish this yet.

Really thankful for your help.

Hi @rhabbachi,

The docs are a bit confusing here, we’ll clean them up. Basically what you’re looking for here isn’t possible today. The docs are talking about the ability to use output variables in a nested block, but there aren’t any nested blocks available for docker. The reason the docs say this is that they’re autogenerated and don’t clarify the context properly. Sorry about that.

At present, we don’t support getting data between applications in this way, mostly because we expected users to be feeding configuration into the waypoint config rather than threading values between applications.

@evanphx got it. Thank you for clearing that out.