Proxy Error when I update my application on Amazon Elastic Beanstalk - ruby-on-rails

I have a Ruby on Rails application hosted on Amazon with Elastic BeanStalk. When I do an update and I do some change to run my application I have, on the website's page, this error :
Proxy Error
The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request GET
http://commentmyprojects-env-vpusz2adwc.elasticbeanstalk.com/.
Reason: Error reading from remote server
Apache Server at commentmyprojects-env-vpusz2adwc.elasticbeanstalk.com
Port 3128
When I restart the application, through the Beanstalk's console, over and over it works after a while.
How can I do to solve this problem?
Thanks!

Related

Rails 5 ActionCable fails to upgrade to WebSocket on Elastic Beanstalk

For context, I've already tried to implement many answers regarding nginx (such as this one) to no success. This appears to be an issue related to nginx that isn't explored in other answers.
Using Rails 5.2 and Docker on a multicontainer EBS, WebSocket connections are failing. This failure only occurs when deployed and the same configuration works as expected locally.
I am using the Postgres adaptor with ActionCable
Problem Description:
My website is deployed to EBS and displays information just fine. My Postgres instance is connected and working as expected. However, these errors occur on WebSocket enabled pages:
In browser:
When I go to my SSL enabled site, a notice appears in the JS console:
The connection to wss://redacted.com/cable was interrupted while the page was loading.
Firefox can’t establish a connection to the server at wss://redacted.com/cable.
(This message repeats every ~5s)
Rails server logs:
Failed to upgrade to WebSocket (REQUEST_METHOD: GET, HTTP_CONNECTION: keep-alive, HTTP_UPGRADE: )
Finished "/cable/"[non-WebSocket] for <redacted IP> at 2018-02-28 02:49:03 +0000
(This message repeats every ~5s)
Prior research
Error codes:
Others in this situation note that their console throws a 400 - Bad handshake error (or similar). This is not the case here.
nginx (important):
As well, others seem to think that nginx is to blame. However, I cannot access nginx within my EBS instance. Any call for nginx results in service nginx not found and any modification of an nginx file via .ebextensions fails.
It's worth noting that I have no nginx Docker image or configuration whatsoever. I'm trying to modify EBS' built-in nginx configuration. To get to this point (where my website loads but WebSockets don't work), I have not configured nginx at all.
Troubleshooting steps taken
Changed EBS load balancer from HTTP to TCP
Modification of nginx (see above)
Specifying the ActionCable server URL in my production.rb
Specifying allowed WebSocket hosts in production.rb
Changing cable.yml adapters and hosts

How does one develop a Shopify App in a local Rails environment?

I've been having some trouble trying to set up a Shopify app so that I can develop it in my local Rails environment.
I've followed the documentation HERE but when I install the app into my shopify dev store I get an error stating localhost sent an invalid response.
My local rails server log shows:
ERROR bad URI '::�+�/�,�0̨̩�\x14�\x13�\x13�\x14\x00�\x00�\x00/\x005\x00'.
ERROR bad Request-Line '\x16\x03\x01\x00�\x01\x00\x00�\x03\x03d��������\x1F�ŭ����=G�+q\r[��� N�\x00\x00 jj�+�/�,�0̨̩�\x14�\x13�\x13�\x14\x00�\x00�\x00/\x005\x00'.
After digging through other shopify docs I found this:
This says to tunnel with ngrok to avoid problems which makes sense, except that the shopify_app documentation states to specify http://localhost:3000 as the application URL and http://localhost:3000/auth/shopify/callback as the Redirection URL.
Can anyone tell me how to set my Shopify app so I can develop it locally? Or is this something I will have to develop live on heroku?
Ngrok is simply a tunnel to localhost, so you can set your application URL to https://subdomain.ngrok.io and redirection URL as https://subdomain.ngrok.io/auth/shopify/callback. You can configure ngrok to tunnel on port 3000 by specifying the port number when initializing ngrok: ./ngrok http 3000.

Production server using an outdated release of capistrano

I deploy new version via capistrano to a Ubuntu 14.04 server and now Unicorn + Nginx setup is referring to inexistent release. I get the ActionView::MissingTemplate and also a I18n::InvalidLocaleData because it failed to load the devise.en.yml file.
I pretty much followed this repo. I already restart nginx and unicorn but still gives me the same error. It's searching on a release/release_timestamp that no longer exists
You can at least confirm that Nginx is not part of the problem by directly connecting to the port or socket that Unicorn is listening on from within the server.
If Unicorn is running on a socket, see Can Curl send requests to sockets?.

502 Bad gateway error for rails production environment?

When I deploy my rails app in jenkins I am getting 502 gateway error for sending form data. But when I run the same in local with all three environments it is working properly.
Updated Question:
My rails app is working properly in local machine in all test,dev,prod environment.
But when I deploy it into Jenkins CI I am getting the above error for form data submission to another server.
The problem is I configured my unicorn server
timeout 5
but the response from the service call taking time so increased time
timeout 15
now it is working

Deployed Rails3 but not showing up outside of server

I just deployed my Rails3 app to a linux server with Capistrano and Unicorn using mysql2. I keep getting the error "Oops! Google Chrome could not connect to 172.16.128.125" when trying to access the app in a browser.
What is weird is that I see no errors in the ./log/production.log file and if I use lynx on the server, I can render all pages of the app.
What am I missing? It works locally on the server but not outside the server.
Sounds like you might not have Apache running, or port 80 may not be reachable on that machine due to firewalling or routing issues.

Resources