/* eslint-disable max-len */
module.exports = {
  /**
   * Application configuration section
   * http://pm2.keymetrics.io/docs/usage/application-declaration/
   */
  apps: [

    // First application
    {
      name: 'WONDERBOARD-FRONTEND',
      script: 'node_modules/.bin/http-server',
      args: ['dist', '-p', '9103'],
      instances: 4,
      env: {
        COMMON_VARIABLE: 'true',
      },
      env_production: {
        NODE_ENV: 'production',
        HTTP_PORT: 9102,
      },
      env_stage: {
        NODE_ENV: 'stage',
        HTTP_PORT: 9104,
      },
      env_development: {
        NODE_ENV: 'development',
        HTTP_PORT: 9103,
      },
    },

    /* Second application
    {
      name      : 'WEB',
      script    : 'web.js'
    }*/
  ],

  /**
   * Deployment section
   * http://pm2.keymetrics.io/docs/usage/deployment/
   */
  deploy: {
    production: {
      'user': 'node',
      'host': 'dashboard.wonderflow.co',
      'ref': 'origin/master',
      'repo': 'git@bitbucket.org:bitliner/wonderboard.git',
      'path': '/home/node/adminapp-frontend',
      'post-deploy': 'cd packages/adminapp && yarn && npm run build && pm2 startOrGracefulReload ecosystem.production.config.js --env production',
    },
    stage: {
      'user': 'node',
      'host': 'stage.wonderflow.co',
      'ref': 'origin/stage',
      'repo': 'git@bitbucket.org:bitliner/wonderboard.git',
      'path': '/home/node/adminapp-frontend',
      'post-deploy': 'cd packages/adminapp && yarn && npm run build && pm2 startOrGracefulReload ecosystem.stage.config.js --env stage',
    },
    development: {
      'user': 'node',
      'host': 'localhost',
      'ref': 'origin/development',
      'repo': 'git@bitbucket.org:bitliner/wonderboard.git',
      'path': '/tmp/adminapp-frontend',
      'post-deploy': 'cd packages/adminapp && yarn && npm run build && pm2 startOrGracefulReload ecosystem.config.js --env development',
    },
  },
};
