I use faye through the PrivatePub gem to publish messages to my clients. It works fine in development on my machine but on my production server messages never make it to the clients.
I'm pretty sure that faye is setup properly as its requesting faye.js no problem from the server and its not logging any errors in the client. I'm not seeing any errors on the server either so I'm at a loss as to why its not sending messages out to the clients.
Related
I'm deploying a Rails app to production. It seems that Puma is fast and handles many of the things I want in a web server.
I'm wondering if I even need to bother with Nginx, and what I'd be missing out on if just used Puma?
Nginx is a web server and puma is an application server.
Both have their advantages, and you need both.
Some examples:
Static redirects- you could setup your nginx to redirect all http traffic to the same url with https. This way such trivial requests will never hit your app server.
Multipart upload- Nginx is better suited to handle multipart uploads. Nginx will combine all the requests and send it as a single file to puma.
Serving static assets- It is recommended to serve static assets (those in /public/ endpoint in rails) via a webserver without loading your app server.
There are some basic DDoS protections built-in in nginx.
There's a significant difference between a web server and an application server.
Nginx (Web Server) and Puma (App Server) will handle requests in your application simultaneously.
Whenever there's a request coming from a client, it will be received by the nginx and then it will be forwarded to the application server which is Puma over here.
Having nginx as a web server will help you in handling multiple requests much more efficiently. Being a multi threaded server it will distribute requests into multiple threads making your application more faster.
As mentioned by vendant you can serve static pages using a web server as it will be a better approach.
If you're going to include a certification to your web application then you can provide redirects from http to https over here which will hit the app server only after redirecting to https.
If you're going to use Puma then you've to make sure that server is using resources efficiently but if you'll use nginx then it's going to take care of it by itself.
you can get more info here.
I have a rails app deployed at a digital ocean droplet configured with capistrano and mailgun, but I'm having trouble sending emails, task which I do using delayed_jobs. The thing is every time it tries to send an email I get connection timeout (verified using RAILS_ENV=production bin/delayed_jobs runin the server) and I found out that for some reason digital ocean does not allow from default for you to access through port 587 (and indeed, running telnet smtp.mailgun.org 587 takes a very long time to access) but apparently trough port 2525 you can (mailgun also supports that port and running telnet smtp.mailgun.org 2525 connects instantly!). But again, it still gives me connection timeout, so I'm kind of confused and don't know what to do. I'll probably send a ticket to DO asking to open port 587, until then do you have any ideas?
Digital Ocean blocks SMTP for safety reasons, based on the CAN SPAM Act (https://www.ftc.gov/tips-advice/business-center/guidance/can-spam-act-compliance-guide-business), so if you want to send emails using SMTP in their servers you'll need to send a ticket asking to unblock it with some infos about yourself so they verify your not just some crazy guy trying to flood people mail boxes or a robot.
Hope it helps! Good luck
Anybody able to try and install Discourse as a normal Rails app (no Docker) and see why it won't send emails from ones localhost SMTP server?
Sending emails from other Rails apps work just fine.
https://meta.discourse.org/t/emails-with-local-smtp/23645/16
I have a rails app deployed on Google Compute Engine.
Everything works fine and it requires to send mail in application so I follow this link for sending mail it works on local but I am unable to send mail through mandrill smtp settings.
I always get Timeout::Error (execution expired) error message, what could be the reason??
Any idea on what's could be the problem?
Google Compute Engine does not support outbound TCP connections on port 25. Instead you can use port 2525 that Mandrill also supports.
I'm working on a rails project and can't figure out how the mail system works.
On the production server there is postfix installed, so I'm assuming thats how the emails are being sent (actually the headers show that it is postfix sending out the emails). However, in the application under config > environment > production.rb, there is nothing defining how to send the mail. There are no smtp settings, there is nothing saying its using sendmail or postfix, but the mails are being delivered. So how does the production server know to use postfix? I ask because the development server is using sendmail, so will anything need to be changed here for this to work or should it work out of the box (because it doesn't)?
Ok, so I figured out what was wrong, feel free to comment if you think my answer is not sufficient though or you have any feedback!
I found out from here that "Delivery defaults to an SMTP server running on your localhost on port 25." So on my production server it was working because postfix was installed. Where I was confused was staging, why wasn't sendmail working. I assumed sendmail was installed thats why! When I typed which sendmail, I got a result, so I assumed it was sendmail, but when I ran telnet <myhostname> 25 I got Exim 4.71! So a new assumption, sendmail is installed but not configured or setup on port 25, and exim is, so exim is handling mail.
I'm using this on amazon ec2 and just assumed that when I setup my instance, since its linux, it would have a mail server ready like I had on production. Obviously that was not a good assumption and I've now configured properly my prod, and I will try to use exim for staging since its already there.