How to run meteor server on a different ip address? - meteor

How can i start meteor server on a different IP address? Currently in the examples am only able to run on a localhost:3000 address.

export BIND_IP no longer works, bind IP is defined with --port (or -p or --app-port) option(s):
$ meteor run --port 127.0.0.1:3000
Reference: https://github.com/meteor/meteor/commit/9b8bd31a7b6c857e5d8fc0393982e6e6b2973eb0

If you are looking to run something on another IP address (but still have the files local) you need to look into editing your vhosts file. If you are on a mac, look into Virtual Host X
The proper way to change ports with meteor is this:
meteorapp : meteor --port 5000

According to this change, you should be able to configure your app to bind to a specific IP address by configuring a BIND_IP environment variable.
export BIND_IP=127.0.0.1
You may need to update your app to a newer version of Meteor for this to work correctly.

Using Meteor 1.3.2.4, If your IP is 192.168.0.13 as in my case, on the terminal, type:
meteor --mobile-server 192.168.0.13
or
meteor --port 192.168.0.13:3000
And you will see the Meteor welcome page by typing
http://192.168.0.13:3000
on your browser.

At the moment, you can't - meteor binds to all IP addresses, but there's an issue open to add support for binding to a specific IP.

Deploy it on another server and connect to the internet-ip of the server from outside of the internal net, or connect to the local-ip of the server from the lan.
How to deploy on another server?
'meteor bundle'
and read the README

This isn't possible yet, but there is an open pull request for it. They are waiting for the author to sign the meteor contributor agreement before it can be accepted.
https://github.com/meteor/meteor/pull/469/
If you need it before it's official you can apply the patch yourself (or potentially just replace 127.0.0.1 with the IP address you want to bind to in the same files references by the patch (app/lib/mongo_runner.js and app/meteor/run.js).

Actually, Meteor behaves differently in production and development environments.
Production
Use environment variable BIND_IP
Development
Use --port argument like meteor run --port 192.168.1.1:port
Docs here

According to netstat -tapn Meteor/Node.js listens on all available IP addresses on the machine:
tcp 0 0 0.0.0.0:3000 0.0.0.0:* LISTEN 9098/node
Do you have something like iptables running?

Related

How can I use TCP instead of UDP for WebRTC publish/play in Ant Media Server?

I'm using Ant Media Server on AWS and it works perfectly fine. However, some of our users have blocked UDP ports and therefore I want to know if it is possible to use TCP instead of UDP for WebRTC.
And with this in your User data in AWS you'll get the current instance public IP inserted automatically on boot:
sed -i "s/server.name=.*/server.name=$(curl -s http://169.254.169.254/latest/meta-data/public-ipv4)/g" /usr/local/antmedia/conf/red5.properties
Yes, we can make use of TCP ports for WebRTC.
Please open TCP Port range 50000-60000 on the AWS Security group (for AMS v2.4.2.1 and above, for older version use port range 5000-65000).
Go to the Application settings:
/usr/local/antmedia/webapps/<AppName>/WEB-INF/red5-web.properties
Edit the red5-web.properties file and set
settings.webrtc.tcpCandidateEnabled=true
Restart Ant Media Server
sudo service antmedia restart
If you are using a cloud service like OVH or if there is pubic IP directly associated with the instance, then webrtc should work.
If you are using a cloud service like AWS with private/public IP, then some additional settings are required to be configured.
Go to server configuration settings
/usr/local/antmedia/conf/red5.properties
Edit the red5.properties file and set
server.name=Instance_Public_IP
Go to the application settings again and edit the red5-web.properties
/usr/local/antmedia/webapps/<AppName>/WEB-INF/red5-web.properties
set
settings.replaceCandidateAddrWithServerAddr=true
Save the settings and restart Ant Media server
sudo service antmedia restart
Webrtc should work fine afterwards.
Thank you.
antmedia.io

Google analytics code fires twice on transaction page of my website. [duplicate]

I am getting error:
"Lost connection to MySQL server at 'reading initial communication packet, system error: 0"
while I am going to connect my db.
If I am using localhost everything is working fine.
But when I am using my live IP address like below, it's getting error:
mysql_connect("202.131.xxx.106:xxxx", "xxxx", "xxxxx") or die(mysql_error());
Someone here suggests that it might be a firewall problem:
I have just had this problem and found it was my firewall. I use PCTools Firewall Plus and it wasn't allowing full access to MySQL. Once I changed that it was fine.
Could that be it?
Also, someone here suggests that it might be because the MySQL server is bound to the loop-back IP (127.0.0.1 / localhost) which effectively cuts you off from connecting from "outside".
If this is the case, you need to upload the script to the webserver (which is probably also running the MySQL server) and keep your server host as 'localhost'
Open mysql configuration file named my.cnf and try to find "bind-address", here replace the setting (127.0.0.1 OR localhost) with your live server ip (the ip you are using in mysql_connect function)
This will solve the problem definitely.
Allow remote connect to MySQL.
Edit file:
>sudo nano /etc/mysql/my.cnf
Comment line:
#bind-address = 127.0.0.1
Restart MySQL:
>sudo service mysql restart
Create user for remote connection.
>mysql -uroot -p
CREATE USER 'developer'#'localhost' IDENTIFIED BY 'dev_password';
CREATE USER 'developer'#'%' IDENTIFIED BY 'dev_password';
GRANT ALL ON *.* TO 'developer'#'localhost';
GRANT ALL ON *.* TO 'developer'#'%';
In my case I need to connect remotely from Windows to VirtualBox machine with Ubuntu. So I need to allow port 3306 in iptables:
>iptables -A INPUT -i eth0 -p tcp -m tcp --dport 3306 -j ACCEPT
Had this problem when setting up a new slave server. Found it was the slave server IP address was missing from the master server /etc/hosts.allow file. Added the IP address and it let me connect to the master server.
Note that I use hosts.allow and hosts.deny to control access.
I had this problem and it ended up being the prior sys admin changed the port MySQL was running on. MySQL Workbench was trying to connect to the default 3306 but the server was running on 20300.
The error means that it didn't receive a response from the port it expected to find the server on. The causes range from contacting the wrong machine (For one of a number of reasons) to the server not being on the expected port.
Check which port your server is bound to in /etc/mysql/my.cnf. Does that correspond to what is in your connect statement. If they match then try connecting with mysql from the server itself and from the command line of the machine where you are running the client. If it works form one place and not another then you may have a firewall / router configuration issue.
One more reason...
I ran into an Ubuntu server where everything was customized and could not connect because of that same error.
This setting was inside /etc/ssh/sshd_config
PermitTunnel no
After turning into
PermitTunnel yes
I was able to connect remotely to my MySQL DB
The problem on my case was MySQL being bind only to the lo on linux.
in order to solve the problem i have edited the my.cnf (found at /etc/mysql/my.cnf) removing the line bind-address=127.0.0.1
this allows mysql to bind to any network interface
I just set up mysql on a windows box. I got the OP's error when trying to connect with the Navicat MySql client on the same box. I had to specify 127.0.0.1 as the host, and that got it.
localhost, or the servers actual ip address both did not work.
This error occurred to me while trying to connect to the Google Cloud SQL using MySQL Workbench 6.3.
After a little research I found that my IP address has been changed by the internet provider and he was not allowed in the Cloud SQL.
I authorized it and went back to work.
I faced the same problem. I checked and tried to set AllowTcpForwarding Yes but it was missing in my sshd_config so no help.I didn't change sshd_config or my.cnf. Make sure the ssh hostname is NOT the same with the mysql hostname(use localhost).
In workbench, choose + to add new connection and set the following:
connection method: standard TCP/IP over SSH
SSH Hostname: 192.168.0.50:22 (replace remote SSH server IP and port(optional))
SSH Username: sshuser
You can set password or add at the prompt
MYSQL Hostname: localhost or 127.0.0.1
MYSQL Server port:3306
You can set password or add at the prompt
Test connection. It should be successful then hit OK.Viola!
I ran into this exact same error when connecting from MySQL workbench. Here's how I fixed it. My /etc/my.cnf configuration file had the bind-address value set to the server's IP address. This had to be done to setup replication. Anyway, I solved it by doing two things:
create a user that can be used to connect from the bind address in the my.cnf file
e.g.
CREATE USER 'username'#'bind-address' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON schemaname.* TO 'username'#'bind-address';
FLUSH PRIVILEGES;
change the MySQL hostname value in the connection details in MySQL workbench to match the bind-address
The problem for me was that DNS queries were blocked by the FW within the subnet. The solution was to disable DNS lookups within MySQL.
The problem was quite stupid for me.
I used to get the same issue on AWS EC2 Ubuntu machine (MariaDB is installed locally for the time being), so I tried to make SSH tunneling, and had the same issue. So I tried to ssh tunnel over terminal:
ssh -L13306:127.0.0.1:3306 root#ip.address -i my/private/key.pem
And it told me this:
Please login as the user "ubuntu" rather than the user "root".
I changed ssh user from root to ubuntu, just like my ssh config, and it connected just fine.
So check your SSH connecting user.
I oversaw this, so this too half an hour of my time, so I hope this will be useful for you.
For me the config file was found "/etc/mysql/mysql.conf.d/mysqld.cnf" commenting out bind address did the trick.
As we can see here:
Instead of skip-networking the default is now to listen only on
localhost which is more compatible and is not less secure.
I am trying to connect my db docker container on Ubuntu 18.04, same problem.
First check your device by run nmcli dev to check if device docker0 is connected.
If it is not connected, try to restart docker service:
sudo service docker restart
I tried make a telnet over remote server on port 3306.
The error message is clear
Host 'x.x.x.x' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'Connection closed by foreign host.
As root at server mysqladmin flush-hosts worked at all!
I had the same error when using localhost. I restarted the MySQL service and it worked fine.
in my case, I had ALL: ALL in hosts.deny. Changing this to ALL: PARANOID solved my problem when connecting over ssh
Ran into this same issue, Bind Address back and forth to no avail. Solution for me was flushing privileges.
mysql> FLUSH PRIVILEGES;
Firewalld blocks the IP address. so to give access, use these commands:
firewall-cmd --permanent --zone=trusted --add-source=YOUR_IP/32
firewall-cmd --permanent --zone=trusted --add-port=3306/tcp
firewall-cmd --reload
For me setting bind-address = 0.0.0.0 in mysql/my.cnf worked. It basically listens to all addresses (but still one port) then.
And don't forget restart your server: systemctl restart mysql
I just had the same problem, but in my case I solved it with
service mysqld start
In my case it was the university wifi blocking port 3306. I was able to connect by using a mobile hotspot.
Change to a mobile hotspot or another network, and if it works there, then you know that original network is blocking port 3306. If you get the same error on more than 1 network, then you know it's specific to your machine.
I had port 3306 in Docker container but in Dockerfile it was 33060. I edited the port in Docker container to 33060
Must have been added to the Dockerfile
ENV MYSQL_ROOT_HOST 172.17.0.1
I have done below 3 steps then working for me.
bind-address = "YOUR MACHINE IP" in my.cnf file at /etc/my.cnf
Restart service by command : service mysql restart
GRANT ALL PRIVILEGES ON yourDB.* TO 'username'#'YOUR_APPLICATION_IP' IDENTIFIED BY 'YOUR_PASSWORD' WITH GRANT OPTION;
I had the same issue installing MySQL docker image then trying to connect from WSL2 MySQL client.
As it was stated in the accepted answer that it should be a firewall issue, in my case this error was caused due to not allowing docker for windows to communicate to private network.
I changed the settings on "Firewall & network protection", "allow an app through firewall", "change settings" (need administrator rights) and allowed "Docker desktop backend" to connect to private network.
I had the same error on my Mac with a local MySQL installation. The problem was that the number files that MySQL was opening was too high for MacOS.
To see if you have the same problem you can run this command and look for File Descriptor errors:
tail -200 /usr/local/var/mysql/$(whoami).err | grep "Warning"
I added this line to my.cnf file and the problem was fixed:
table_open_cache = 200
Had the same problem, what worked for me was:
Go to Windows Firewall where you allow applications.
mysql probably won't be in the list, so you need to add it, its path is typically C:/Program Files (x86)/MySQL/bin/mysql
Mark both private and public networks, apply.
When connecting to Mysql remotely, I got the error.
I had this warning in /var/log/mysqld.log:
[Warning] IP address 'X.X.X.X' could not be resolved: Temporary failure in name resolution
I just added this line to /etc/hosts file:
X.X.X.X some_name
Problem solved! Not using skip-name-resolve caused some errors in my local app when connecting to MySQL.

Meteor 0.9.2 remote connection issue

Not sure if it's just a coincidence or a bug but after updating to 0.9.2 I lost my remote connections to any of my Meteor apps. localhost:3000 works fine but remote access to host:3000 or any other port I try cannot connect.
I had exactly the same symptoms with the new Meteor (0.9.2.1), I was able to connect fine on my development server using localhost:3000, but I received an error when attempting to connect to that server using the NETBIOS name (which I have been doing successfully since Blaze). Example URL:
v-as-nodejs:3000
This worked fine before but does not with the latest Meteor.
I was also able to overcome this issue by specifying an IP address and port explicitly in the Meteor server startup command:
meteor --port 192.168.1.108:3000
What is interesting is that it seems as long as the IP address in the --port parameter matches the private network address of the server, you can still connect to your server using a logical name. In my case, my server is in a DMZ on my private network, and I can use the public domain name to get to the server. I can also use the server's NETBIOS name, both work fine.
I don't fully understand why this would work unless node.js or Meteor is doing some internal comparison. It is certain though that this is a matter of either the Meteor upgrade or the Node.js upgrade.
Use --port:host:port
example: meteor run --port:192.168.168.164:6969
Binding to a specific IP seems to solve the problem:
meteor run -p 192.168.2.3:8080

Make grunt to run from "dest" and expose it via IP

I am new to using Grunt build tool. Suppose if I already have the required files in my "dest" folder how can I use Grunt to simply load the same to the server.
Also, I am currently able to access grunt service running on "localhost" on 9090 port.
But if I replace the "localhost" with my ip address, I am getting a 404.
I tried the same with my tomcat server but I am able to access the tomcat server on 8080 port via IP address as well. Please let me know what needs to be done to allow access via IP? I am using a Windows PC
In case someone stumbles upon this one, just change localhost to 0.0.0.0 in the gruntfile.
This is the reference: https://github.com/yeoman/generator-angular/commit/fbad1ab0ab789bb37fe5dfa40d5e8ada2f4fa0c5
It sounds like you are asking about how to copy files to a remote server using Grunt.
If so try either grunt-ssh if you have SFTP/SCP acceess to your remote server, or grunt-ftp-deploy if you only have FTP access.

how can I troubleshoot meteor just hanging?

Hi I am trying out meteor for first time today.
my symptoms: meteor just hangs when trying to connect to port 3000 (it is listening, checked with lsof and looking at ps) a mongo instance is started on port 3002 but i can not connect to it with mongo (so perhaps neither can node ?)
background: I do already have mongo 2.0.3 installed and running (can it be a conflict?)
What can I do to troubleshoot and get meteor started ?
Site was bugging me to accept an answer or start a bounty...So here is explanation of my comment:
localhost on my machine resolves to ipv6 address first and meteor
binds only to 127.0.0.1.
So to answer the specific question of "how to troubleshoot":
I used lsof -i to verify that the meteor mongo instance was actually listening. This showed me that is was listening on 127.0.0.1. This eliminated the concept of mongo not listening. next i did host my machine's name and noticed the ipv6 came back first. this sparked a hunch and led me to force meteor to connect to 127.0.0.1 instead of localhost and it worked.
Well, check that port 3000 is open netstat -a
try a telnet localhost 3000
Use firefox extension TamperData or any other flow analysis tools to see what's going on at the HTTP level http://tamperdata.mozdev.org/
Have you tried to run against the bundled node and mongodb ?

Resources