@Override
  public void customize() {
    List<String> commands = Lists.newLinkedList();

    String gitRepoUrl = getEntity().getConfig(NodeJsWebAppService.APP_GIT_REPOSITORY_URL);
    String archiveUrl = getEntity().getConfig(NodeJsWebAppService.APP_ARCHIVE_URL);
    String appName = getEntity().getConfig(NodeJsWebAppService.APP_NAME);
    if (Strings.isNonBlank(gitRepoUrl) && Strings.isNonBlank(archiveUrl)) {
      throw new IllegalStateException(
          "Only one of Git or archive URL must be set for " + getEntity());
    } else if (Strings.isNonBlank(gitRepoUrl)) {
      commands.add(String.format("git clone %s %s", gitRepoUrl, appName));
      commands.add(String.format("cd %s", appName));
    } else if (Strings.isNonBlank(archiveUrl)) {
      ArchiveUtils.deploy(archiveUrl, getMachine(), getRunDir());
    } else {
      throw new IllegalStateException(
          "At least one of Git or archive URL must be set for " + getEntity());
    }

    commands.add(BashCommands.ifFileExistsElse1("package.json", "npm install"));
    List<String> packages = getEntity().getConfig(NodeJsWebAppService.NODE_PACKAGE_LIST);
    if (packages != null && packages.size() > 0) {
      commands.add(BashCommands.sudo("npm install -g " + Joiner.on(' ').join(packages)));
    }

    newScript(CUSTOMIZING).body.append(commands).execute();
  }