Openshift Scalable Rails 4 new application renders

2019-07-22 05:19发布

I successfully deployed a rails single gear application on openshift a few months ago. I am now attempting to deploy a scalable application. After setting up the app, connecting with git, pushing a minimalist project to openshift, I am getting a 503 Server Unavailable error. After doing quite a bit of research, I speculate my problem may be related to the HAProxy. The following post here goes into some detail about the haproxy and dealing with the cfg. I do have the same DOWN gears for my local-gear and backend, working with modifications as suggested on the haproxy.cfg file did not resolve my issue, but the listed blog post is referring to a Java project, so were not comparing same environments.

The app runs as expected on my local host, and rhc via ssh into the app, I can run necessary rake tasks, migrations and what not.

Has anyone else run into a similar problem? If so has anyone been able to correct the issue?

2条回答
对你真心纯属浪费
2楼-- · 2019-07-22 06:06

I see you are on openshift. Here is what I find to work 90% of the time:

First, go to the base directory of your project. Then add the force clean build marker

touch .openshift/markers/force_clean_build

Then commit this file to your openshift repo using

git add .openshift/markers/force_clean_build
git commit -m "Force clean build"
push -f
查看更多
Fickle 薄情
3楼-- · 2019-07-22 06:07

Question is dead, but had to figure it out anyway. So here's the deal in case if it could help someone. Basically I've found two things that causes problems in scallable rails 4.1.x application.

  • As for today there must be gem 'rake' defined in Gemfile (it will work locally without rake defined, but not on openshift). If you see some 'block in materialize': Could not find rake-10.4.2 in any of the sources (Bundler::GemNotFound) error that's probably it.

  • You have to define your root route in routes.rb, like that for example: root 'users#index' - haproxy balancer won't start your ruby gear without root route defined. If you see some Layer7 wrong status, code: 404 error that's probably it.

If you need some further debugging try going to http://yourappname-yourdomainname.rhcloud.com/haproxy-status/. There you can see your gears and their real status.

Also make sure you have proper database configuration in database.yml. If parameters are incorrect the gear - in most cases - won't start. (Best approach is to put there initial sqlite3 config for testing, and once everything is up again go with your real database.)

As a side note: As for today there is no option to install rails 4.2 on openshift. At least without a community cartridge, but I haven't found any working one. If you see some errors about rack 1.5.2 that probably means you need to downgrade to to rails 4.1.0. Once everything is up - try going to 4.1.9 and see if it works.

Good luck!

查看更多
登录 后发表回答