简体   繁体   中英

How to install Deployd on AWS Elastic Beanstalk

I am trying to install deployd on AWS Elastic Beanstalk. I created a node.js environment.

Locally, I did:

npm install depoyd -g

I also created a .dpd folder and did

dpd keygen

Here's my package.json file

{
  "name": "my-api",
  "version": "1.0.1",
  "description": "My description",
  "keywords": [],
  "homepage": "http://www.example.com",
  "author": "Me, Myslef and I",
  "contributors": [],
  "dependencies": {
    "deployd": ">= 0"
  },
  "scripts": {
    "start": "node server"
  },
  "engines": {
    "node": "0.10.x",
    "npm":  "2.2.x"
  }
}

Here's my server.js file

// requires
var deployd = require('deployd'); //API

// configure database etc. 
var server = deployd({
  port: process.env.PORT || 5000,
  env: 'production',
  db: {
    host: 'ds12345.mongolab.com',
    port: 12345,
    name: 'my-api',
    credentials: {
      username: admin,
      password: mypassword
    }
  }
});

// heroku requires these settings for sockets to work
server.sockets.manager.settings.transports = ["xhr-polling"];

// start the server
server.listen();

// debug
server.on('listening', function() {
  console.log("Server is listening on port: " + process.env.PORT);
});

// Deployd requires this
server.on('error', function(err) {
  console.error(err);
  process.nextTick(function() { // Give the server a chance to return an error
    process.exit();
  });
});

Here is my ProcFile:

web: node server

When I create the zip file with the files and "upload and deploy" it into the dashboard, "Health" status is green but the app url shows

502 Bad Gateway

nginx/1.6.2

Thanks for your help

I just forgot the quotes in the credentials.

// configure database etc. 

var server = deployd({
  port: process.env.PORT || 5000,
  env: 'production',
  db: {
    host: 'ds12345.mongolab.com',
    port: 12345,
    name: 'my-api',
    credentials: {
      username: 'admin',
      password: 'mypassword'
    }
  }
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM