You are here
I provisioned the Turnkey image for Ruby on Rails into AWS (EC2 m1.medium). I got the system initialized successfully. I am able to ssh into the image as well as bring up the webmin interface. In AWS, I assigned a security group that includes TCP port 3000 in addition to the other ports needed by Turnkey (22,12320, 12321,80,443). As of now, connections are allowed to those ports from anywhere. The built-in firewall, iptables, is set to accept everything:
Chain INPUT (policy ACCEPT) target prot opt source destination Chain FORWARD (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination
I upgraded rails, installed my application, and started the Rails server:
admin@rails ~/sample_app$ rails server => Booting Puma => Rails 5.0.1 application starting in development on http://localhost:3000 => Run `rails server -h` for more startup options Puma starting in single mode... * Version 3.6.2 (ruby 2.3.3-p222), codename: Sleepy Sunday Serenity * Min threads: 5, max threads: 5 * Environment: development * Listening on tcp://localhost:3000 Use Ctrl-C to stop
Despite all of that, connections to port 3000 are being refused:
connecting to ec2-54-89-100-93.compute-1.amazonaws.com on port 3000... ec2-54-89-100-93.compute-1.amazonaws.com: Connection refused
I also added the MySQL port, 3306. Same effect.
Some other entity is restricting access to these ports. I need help figuring out what's going on.
thanks,
pat
Listening on tcp://localhost:3000
Same is true of MySQL. By default it is bound to localhost as a security measure. Only the stand-alone MySQL appliance allows remote connections by default. Please see the docs on how to adjust that to allow remote connections.
Solved
Thanks. That was the problem. I restarted the Rails server like this:
and the server would then accept outside connections.
Great news!
mysql
Thanks. I'm still working on getting MySQL to accept outside connections. The instructions I've followed so far have not resolved the issue.
You should be able to just copy/paste from docs
You've possibly already done it, but obviously you'll also need to add a security exception for port 3306.
FWIW I am currently working on the v14.2 release so have a new LAMP server that I have been testing. I just checked and the docs appear to still be relevant.
Default state:
Copy/paste from docs (setting MYSQL_PASS first):
Post tweak state:
Please note though, that that will allow remote MySQL root user to have remote connections. That's fine for testing and development, but not recommended for production. It is much more secure to only only remote connections via a limited user with tighter permissions.
MySQL access
I eventually got remote access working. The AWS security group setting was already correct. When I tried to connect using using Sequel Pro, I kept getting "permission denied" when trying to log in as root. That error told me that I was getting denied my MySQL itself rather than a firewall rule. I create a new user ('rails') in MySQL, granted the relevant permissions, and was then able to connect remotely.
I'm thinking there are some extra special rules around remote connections as 'root'.
Add new comment