AWS Elastic Beanstalk にデプロイしてインストールしようとしています。node.js 環境を作成しました。
ローカルでは、次のことを行いました。
npm install depoyd -g
.dpd フォルダーも作成して実行しました
dpd keygen
これが私のpackage.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();
});
});
これが私のProcFileです:
web: node server
ファイルを含む zip ファイルを作成し、それをダッシュボードに「アップロードして展開」すると、「正常性」ステータスは緑色ですが、アプリの URL は表示されます
502不正なゲートウェイ
nginx/1.6.2
ご協力いただきありがとうございます