mup setup : Error: Timed out while waiting for handshake - meteor

Problem here is when I am trying to run command mup setup
there is error,where I am going wrong
Started TaskList: Setup Docker
[54.186.xx.xxx] - Setup Docker
events.js:183
throw er; // Unhandled 'error' event
My mup.js file looks like below
module.exports = {
servers: {
one: {
host: '54.186.xx.xxx',
username: 'ubuntu',
pem: '~/.ssh/mypem.pem'
}
},
app: {
name: 'myapp',
path: '/var/www/meteor/myapp',
servers: {
one: {},
},
buildOptions: {
serverOnly: true,
},
env: {
ROOT_URL: 'http://ec2-54-186-xx-xxx.us-west-2.compute.amazonaws.com',
MONGO_URL: 'mongodb://127.0.0.1:27017/myapp',
PORT: 3027,
},
docker: {
image: 'abernix/meteord:node-8.4.0-base',
},
deployCheckWaitTime: 60,
enableUploadProgressBar: true
},
mongo: {
oplog: true,
port: 27017,
version: '3.4.1',
servers: {
one: {}
}
}
};
Meteor version is 1.6.
Thanks in advance!

Nothing looks wrong with your mup.js file.
The problem may be that you cannot SSH with your current IP address. For instance, if you are using AWS, make sure that in the security groups your current IP address have access to it.

Not sure what is happening exactly, but there are a few potential issues:
deployCheckWaitTime: 60,
You could make this longer, eg 90 or 120 to give it more time to deploy (in case that is a problem)
path: '/var/www/meteor/myapp',
This might be the cause of the problem. Usually it is a relative path to the source code of the app, not where you deploy to, so typically it is something like ../app
ROOT_URL: 'http://ec2-54-186-xx-xxx.us-west-2.compute.amazonaws.com',
Presumably you are intending to use something like http://myapp.com/ for your app - that's what should go here.

In security groups, SSH source rule was MY IP, which I changed to anywhere then created elastic ip and bind it with instance. And now I can access login.
One can use this link to get help.

check your host ip.
I had same issue changing host ip fixed it for me.
Ip changes when you restart your VM es2 client.

Related

meteor up listen tcp 0.0.0.0:80: bind: address already in use

I am using meteor up to deploy to a vps. I get the error in the title during the "Start Meteor" stage of mup deploy, along with a long list of
Error response from daemon: endpoint (appname) not found
Error response from daemon: No such container: (appname)-frontend
etc.
I have tried changing the imagePort value for docker in mup.js but I still get the same error, still for 0.0.0.0:80
In your case there is already an application that uses port 80. You can either remove that app and go ahead and redeploy, or you can change the port that your meteor application is going to be using, like so:
module.exports = {
servers: { ... },
meteor: {
name: ...,
path: ...
buildOptions: ...
env: {
PORT: 3000,
ROOT_URL: 'http://<your server ip>:3000',
MONGO_URL: ...
},
deployCheckWaitTime: 120,
enableUploadProgressBar: true,
}
};

Prevent creating multiple connections in RabbitMQ while using RabbitMQ Bundle for the Symfony2

I'm using RabbitMQ Bundle for the Symfony2 web framework. My question is, how can I avoid creating multiple connections (to prevent overloading the broker) after running many workers in terminal? In example below, I've run two workers and ended up having two connections/channel.
config.yml
old_sound_rabbit_mq:
connections:
default:
host: 127.0.0.1
port: 5672
user: guest
password: guest
vhost: /
lazy: true
producers:
order_create_bmw:
connection: default
exchange_options: { name: order_create_ex, type: direct }
queue_options:
name: order_create_bmw_qu
routing_keys:
- bmw
consumers:
order_create_bmw:
connection: default
exchange_options: { name: order_create_ex, type: direct }
queue_options:
name: order_create_bmw_qu
routing_keys:
- bmw
callback: application_frontend.consumer.order_create_bmw
services.yml
services:
application_frontend.producer.order_create_bmw:
class: Application\FrontendBundle\Producer\OrderCreateBmwProducer
arguments:
- #old_sound_rabbit_mq.order_create_bmw_producer
Producer
namespace Application\FrontendBundle\Producer;
use Application\FrontendBundle\Entity\Order;
use OldSound\RabbitMqBundle\RabbitMq\ProducerInterface;
class OrderCreateBmwProducer
{
private $producer;
public function __construct(ProducerInterface $producer)
{
$this->producer = $producer;
}
public function add(Order $order)
{
$message = [
'order_id' => $order->getId(),
'car_model' => $order->getCarModel(),
'timestamp' => date('Y-m-d H:i:s')
];
$this->producer->publish(json_encode($message), 'bmw');
}
}
Running workers
$ app/console rabbitmq:consumer order_create_bmw
$ app/console rabbitmq:consumer order_create_bmw
RabbitMQ Management
Every client (regardless if publisher or subscriber) that connects to rabbitmq will create a connection. Aside from using less clients, I can't think of any other way to achive this. I also can't think of a reason to do so :) If it's performance, than actually having more subscribers will help to "empty" the exchanges (and queues).

mup and meteor resolving the url

In my mup settings I have
"env": {
"ROOT_URL": "http://localhost",
"PORT": 3000,
"UPSTART_UID" : "meteoruser",
"MAIL_URL": "smtp://username:password#smtp.sendgrid.net:587",
"METEOR_ENV": "production"
},
I am following this.
http://johngibby.com/blog/How_to_deploy_your_meteor.js_app_on_Digital_Ocean
Should the port be 3000 or 80 and should the URL be my url?
ROOT_URL should be the url of your DigitalOcean droplet, which leads to your app. For example, if your droplet has an IP of 83.132.230.12, you could do:
"env": {
"ROOT_URL": "http://83.132.230.12",
"PORT": 3000,
"UPSTART_UID" : "meteoruser",
"MAIL_URL": "smtp://username:password#smtp.sendgrid.net:587",
"METEOR_ENV": "production" }
But it will be quite impractical for visitors to connect to http://83.132.230.12 in their web browser. It's better to have a domain name assigned to your droplet, in order to do:
"env": {
"ROOT_URL": "http://www.yourdomainname.com",
"PORT": 3000,
"UPSTART_UID" : "meteoruser",
"MAIL_URL": "smtp://username:password#smtp.sendgrid.net:587",
"METEOR_ENV": "production" }
PORT should be the port on which you want people to access your app. For example, if you give a 3000 port, your app will be accessed through http://www.yourdomainname.com:3000, which looks also impractical. On the other hand, web browsers use port 80 by default. So if you use "PORT": 80, your app will be accessible through http://www.yourdomainname.com (no port required in the url)

Wait Condition Heat/CloudFormation and instance startup order

I have a OpenStack Heat template which borrows heavily from the CloudFormation parameters, which is why I added the CF tag.
My template contains two instances which should be started (or at least configured through user-data) in a specific order. I thought I would use WaitCondition to make that happen but it looks like he doesn't fully work, or at least doesn't do what I expect.
Here's a snippet:
resources:
first:
type: OS::Nova::Server
properties:
key_name: { get_param: key_name }
image: fedora19
flavor: { get_param: instance_type }
user_data:
str_replace:
template: |
#!/bin/bash
[configuration code here]
curl -X PUT -H 'Content-Type:application/json' -d '{"Status" : "SUCCES", "Data" : "Application has completed configuration."}' "$wait_handle$"
params:
$wait_handle$: {get_resource: my_wait_handle}
first_wait_handle:
type: AWS::CloudFormation::WaitConditionHandle
first_wait:
type: AWS::CloudFormation::WaitCondition
depends_on: first
properties:
Handle:
get_resource: first_wait_handle
Timeout: 1000
second:
type: OS::Nova::Server
depends_on: first_wait
properties:
key_name: { get_param: key_name }
image: fedora19
flavor: { get_param: instance_type }
user_data: |
#!/bin/bash
[configuration code 2]
Currently the stack is correctly stuck on "create in progress" state while Heat hasn't received the curl signal back, which is correct. Problem is that the 'second' instance is created as soon as the stack is launched and configuration runs automatically.
I added a depends_on in the second instance but it looks like it has no effect (or, again, not the effect I thought).
Is it possible to do this instance startup order configuration with Heat/Cloud Formation? What am I missing?
Thanks!
Read this blog given here and he has given a correct explanation to your question. Because this functionality doesn't actually works. There is a work-around which you can make use of.
I'm not at all familiar with Heat templates, but the thing that immediately stood out is your curl command.
Change the curl command
curl -X PUT -H 'Content-Type:' --data-binary '{"Status" : ....
I've had all sorts of problems signalling AWS with what's ostensibly JSON but doesn't accept a header with content-type: application/json

Nodejs Server Hostname

Ok, so it seems pretty easy in Node.js to get the hostname of the request being made to my server:
app.get('/', function(req,res){
console.log(req.headers.host);
});
Is there an easy way to determine the hostname of my actual http server? For example, my server is running at the address http://localhost:3000 - can I programatically determine this address? I am using expressjs.
Yes you can using the;
var express = require('express'),
app = express(),
server = require('http').createServer(app);
server.listen(3000, function(err) {
console.log(err, server.address());
});
should print
{ address: '0.0.0.0', family: 'IPv4', port: 3000 }
you can also retreive the hostname for the os by the following;
require('os').hostname();

Resources