         proxy         : { mode: 'vm' }
         regYears      : 0
         loadBalancer  : { persistance: 'disabled' }
+        stack         : stack
       domainObj.save (err)->
         if err
         then console.error err  unless err.code is 11000

          groups        = [{ id: group.getId() }]
          hostnameAlias = hostnameAliases[0]

          vm = new JVM {
            hostnameAlias
            planCode
            subscriptionCode
            webHome
            groups
            users
            vmType: type
          }

          vm.save (err) =>

            if err
              return console.warn "Failed to create VM for ", \
                                   {users, groups, hostnameAlias}

            JVM.createDomains account, hostnameAliases, hostnameAliases[0]

            group.addVm vm, (err)=>
              return callback err  if err
              JVM.ensureDomainSettings {account, vm, type, nickname, groupSlug}
              if type is 'group'
                @addVmUsers user, vm, group, ->
                  callback null, vm
              else
                callback null, vm

  @addVmUsers = (user, vm, group, callback)->
    # todo - do this operation in batches

        requiredDomains.push "#{nickname}.#{domain}"
    else
      requiredDomains = ["#{groupSlug}.#{domain}", "shared.#{groupSlug}.#{domain}"]

    {hostnameAlias} = vm
    @createDomains {account, domains:requiredDomains, hostnameAlias, stack}

  @createAliases = ({nickname, type, uid, groupSlug})->
    domain       = 'kd.io'
