When trying to use Otto to deploy a Node.js application, the deployed application is not reachable.
I have created a minimal application that simply listens on port 80 and answers status requests:
var express = require('express');
var app = express();
var port = 80;
app.get('/status',function(req,res){
res.json({
hostname: req.hostname,
address: req.ip
});
});
var server = app.listen(port,function(){
console.log('PORT='+port);
});
The local virtual machine created by Otto works fine:
host$ otto compile
host$ otto dev
host$ otto dev ssh
guest$ npm install
guest$ sudo npm start
host$ curl http://`otto dev address`/status
However, when the application is deployed on AWS by
host$ otto infra
host$ otto build
host$ otto deploy
host$ otto deploy info
then the application cannot be reached through the nginx that Otto puts in front of it, which means that something like this request fails:
host$ curl http://ec2-...amazonaws.com/status
If I ssh into the deployed server
host$ ssh ubuntu@ec2-...amazonaws.com
then I cannot start the node app because port 80 is already taken:
ubuntu$ cd /srv/otto-app
ubuntu$ sudo npm start
Error: listen EADDRINUSE :::80
but I can change the port to 8080 and start the node app:
ubuntu$ sudo vi server.js
ubuntu$ npm start
and then I can get through to the node app:
host$ curl http://ec2-...amazonaws.com:8080/status
I am completely new to Terraform, Consul and Passenger.
What is needed to instruct Otto to provision the AWS virtual machine or properly start up the Node app?