My rails application is running using four ec2 instances. When user hit rails application using url, rails application will be serve to the user using any one of four ec2 instance using ELB.
Elasticsearch server is installed on one of the rails server. How i can use same elasticsearch server which is installed on one server for rest of three rails servers also for searching?
I am using the internal (10.x.x.x) address for connecting to elasticsearch.
Elasticsearch::Model.client = Elasticsearch::Client.new(host:'10.x.x.x',port:9200)
As long as you set your inbound rules right you can connect to your elasticsearch instance from any ec2 host.
Make sure that elasticsearch listens on 10.x.x.x and not only on 127.0.0.1.
put network.host: _site_ in elasticsearch.yml
Related
I have made an account on Linode website and have a "linode" running. I have a server running using ruby on rails. The command I used is the following:
rails server --binding=<ip_adress>
The server starts up without issue. The question I have is why can't I visit the the side I created using my browser, just by putting the ip_address in the browser? The server logs display the following
Environment: development Listening on tcp:<ip_address>:3000
I can visit this ip_address on my browser but I need to add the ":3000" in the browser so I can view the site.
Shouldn't I be able to just visit the stand alone ip_address without entering ":3000"? I also wanted to say I am just learning ruby on rails as well.
I haven't tried anything more than described above
An IP address is a way to identify a machine on the internet.A port is a number assigned to uniquely identify a connection endpoint and to direct data to a specific service.
Therefore, your rails service is a combination of an IP address and a Port number. Since you can have different services running on the same machine at the same IP address.
HTTP has a default port of 80 which is what your browser will try to access when you don't provide a port.
Most likely, you will want a Reverse Proxy hosted at port 80 that forwards traffic to your rails app.
This post provides a better answer of how this works. https://superuser.com/questions/394078/how-can-i-map-a-domain-name-to-an-ip-address-and-port
Not Recommended
If you don't want to use a reverse proxy, you can host the rails server at port 80 itself.
rails server -p 80
Note that this requires you to have root permissions on the machine.
We want to configure Apache to work with a Rails app. We want Apache to do load control. We cannot get them to work together. We are using MySQL for the database. If we could please have some type of instruction or tutorial to follow to be able to deploy our application in AWS-EC2, it will be greatly appreciated.
We have a domain and we want to have multiple Rails app running in the same domain. Each rails app seems to want to run in a different port. We do not want to expose port 80/443. Apache is managing the inbound request. My attempts to use the host file has not been successful.
I am trying to host a Rails app in AWS cloud where I have an EC2 instance and apache and mysql . Here I have uploaded my app but I am unable to bind it with IP. For a testing I am using this blog post https://www.digitalocean.com/community/tutorials/how-to-deploy-a-rails-app-with-unicorn-and-nginx-on-ubuntu-14-04 as a reference .
When I am trying to run this command :
RAILS_ENV=production rails server --binding=server_public_IP
I am getting this error :
/home/ubuntu/.rbenv/versions/2.2.3/lib/ruby/2.2.0/socket.rb:206:in `bind': Cannot assign requested address - bind(2) for 52.24.103.139:3000 (Errno::EADDRNOTAVAIL)
Is there anyone help me understand what is this problem and how to deploy it on AWS apache .
In AWS the machine is not directly assigned the IP, i.e. it is routed using NAT. hence you can not use the public IP to start your rails server directly.
To start server just boot it without the binding parameter rails s production
Or you can use 0.0.0.0 to bind your server, this will start your rails on all the interfaces.
Tip: For production you should ideally server using some web server like nginx/apache using passenger/unicorn
Looking from error it says it cannot bind with ipadd 52.24.103.139:3000
What I would suggest it to open a 'custom TCP port 3000' and try running the same thing again.
May be your app is working on port 3000 not 80.
Hope that helps.
I have rails running on an Amazon EC2 instance but I'm having trouble accessing my rails server (port 3000) from public IPs. This was working as recently as last week but today when I started up my rails server I was unable to get a response from an outside IP. Even when I created a brand new rails project I was not able to access the server once I had started it.
Despite this I can access the Apache server by going through port 80. Moreover SSL continues to work.
I have already
ensured that the port 3000 is open on my security group in the Amazon EC2 console
checked my iptables on the Amazon instance. There are no rules and the default for the INPUT chain is to accept packets.
banged my head against a wall.
Does anyone have any ideas?
Did you verify the port 3000 is opened for every IPs addresses and not only for your workplace's IP?
Also, your Amazon EC2 virtual machine's IP could have changed.
I installed rails on an instance on amazon AMI. I installed all the dependencies for rails. I even copied the code through scp. When i ssh to the instance i ran
rails s
The server is running. How can I view it from the browser?
from the Public DNS???
In summary, sure that your security group have a rule for TCP 3000.Then, you can use the Public DNS:
rails server -b ec2-XX-XX-XX-XX.us-west-2.compute.amazonaws.com -p 3000
And access to: ec2-XX-XX-XX-XX.us-west-2.compute.amazonaws.com:3000
This works for me.
Your amazon ec2 instance has a public ip address and domain name, see
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-instance-addressing.html
use this domain name as the URL in your browser.
You will also have to set inbound traffic / port connections in the security group of the instance.
A word of warning: with "rails s" you are starting webrick, a server that is only meant to be used in development. You probably should use a production server like apache + mod_passenger.
For more advanced usage of ec2 and ruby on rails see
http://railscasts.com/episodes/347-rubber-and-amazon-ec2?view=asciicast
move to folder from rails aplication and typerails s -b 0.0.0.0