title: Setting up PostgreSQL in GitLab CI
body: <p>I am trying to set up a CI runner at GitLab.com and I would like to use it to run tests that need a PostgreSQL database connection. The documentation of CI + PostgreSQL seems to be overly simple and it seems to tell that once the connection information is provided the database setup is done. I probably misunderstand the documentation as I fail to create the database. My <code>gitlab-ci.yml</code> looks like this</p>
  
  <pre><code>image: node:latest
  
  services:
    - postgres:latest
  
  variables:
    POSTGRES_DB: rx_reactive_test
    POSTGRES_USER: rx_reactive_tester
    POSTGRES_PASSWORD: "1esdf3143"
  
  cache:
    paths:
    - node_modules/
  
  postgresql:
    script:
     - yarn install
     - npm test
  </code></pre>
  
  <p>By running the command npm test`, it will run a few tests that would build the connection with the database. But those tests fail with the error message</p>
  
  <pre><code>pg-reactive
    ✓ should build connection with the test database.
    1) should run a query returning one row.
  
  
  1 passing (23ms)
  1 failing
  
  1) pg-reactive should run a query returning one row.:
     Uncaught Error: connect ECONNREFUSED 127.0.0.1:5432
      at Object.exports._errnoException (util.js:1033:11)
      at exports._exceptionWithHostPort (util.js:1056:20)
      at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1099:14)
  </code></pre>
  
  <p>These tests runs well with my local test database so there must be a problem with my CI setup. I will appreciate any help on my problem :-)</p>