Continuous Deployment of a NodeJS using GitLab : <p>I have an API developed in NodeJS and have successfully set up continuous integration via a <code>.gitlab-ci.yml</code> file. The next stage is to set up continuous deployment to Heroku if all tests pass on the master branch.</p>

<p>There are plenty of tutorials covering the deployment of Ruby and Python apps but nothing on NodeJS. Currently my <code>.gitlab-ci.yml</code> file looks like this:</p>

<pre><code>image: node:latest

job1:
  script: "ls -l"

test:
  script: "npm install;npm test"

production:
  type: deploy
  script:
  - npm install
  - npm start
  - gem install dpl
  - dpl --provider=heroku --app=my-first-nodejs --api-key=XXXXXXXXXX
  only:
  - master
</code></pre>

<p>The Ruby and Python tutorials use the <code>dpl</code> tool to deploy but how can I start the NodeJS script on the server once deployed?</p>

<p>After adding the production section and pushing it the tests run and pass but the deploy stage gets stuck on pending. The console is blank. Has anyone set up a successful CD script for NodeJS?</p>
