Node.js 如何在AWS Elastic Beanstalk上安装部署的
我正在尝试安装部署在AWS Elastic Beanstalk上的。 我创建了一个node.js环境 在当地,我做到了:Node.js 如何在AWS Elastic Beanstalk上安装部署的,node.js,amazon-web-services,npm,amazon-elastic-beanstalk,deployd,Node.js,Amazon Web Services,Npm,Amazon Elastic Beanstalk,Deployd,我正在尝试安装部署在AWS Elastic Beanstalk上的。 我创建了一个node.js环境 在当地,我做到了: npm install depoyd -g 我还创建了一个.dpd文件夹,并且 dpd keygen 这是我的包.json文件 { "name": "my-api", "version": "1.0.1", "description": "My description", "keywords": [], "homepage": "http://www.
npm install depoyd -g
我还创建了一个.dpd文件夹,并且
dpd keygen
这是我的包.json文件
{
"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"
}
}
这是我的server.js文件
// 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();
});
});
这是我的文件:
web: node server
当我创建包含这些文件的zip文件并将其“上载并部署”到仪表板时,“健康”状态为绿色,但应用程序url显示
502坏网关
nginx/1.6.2
谢谢你的帮助我刚刚忘记了凭证中的引号
// 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'
}
}
});
我还发现在全球范围内安装deployd不起作用。您必须在deployd app文件夹:cd my app文件夹上安装deployd,然后npm install deployd您不应发布更多信息作为答案。编辑原始问题。如果人们看到已经有一个答案,他们就不太可能帮助你。