从 git repo 克隆后,如何使用 puppet 运行 在 nodejs 应用程序上安装 npm

how to run npm install on nodejs-application using puppet after cloning it from git repo

请找到我用来克隆 git 存储库的代码:

package { 'git':
    ensure => 'latest',
  }

  vcsrepo { "/nodejs-helloworld":
    ensure   => latest,
    provider => git,
    require  => [ Package["git"] ],
    source   => "git@gitlab.dev.abc.net:hello-world/nodejs-helloworld.git",
    revision => 'master',

  }

使用 puppet 克隆我的 git 存储库后,我想要 运行 我的 nodejs 应用程序(克隆的存储库)使用 puppet

到 运行 我的 nodejs 应用程序正常请找到以下步骤:

cd nodejs_helloworld/
npm install 
npm start

任何人都可以帮助我或建议使用 puppet 运行 nodejs 应用程序的任何链接。

可以解决问题的粗略执行程序:

exec { '/usr/bin/npm install; /usr/bin/npm start':
  cwd         => '/nodejs-helloworld',
  subscribe   => Vcsrepo['/nodejs-helloworld'],
  refreshonly => true,
}