ROR code is not being deployed on linode with strange error - ruby-on-rails

I have successfully installed and configured apache with passenger for deploying a rails application. I installed the 'mysql' and 'rails' gems successfully, but when I run any rake commands like
rake db:create
to create the database, I get this error
Illegal instruction
Any idea why?

Related

Rails Heroku pg_ext.so

I'm trying to deploy my Rails app with Heroku. The app works fine in a local environment, and git push heroku master works fine, but an application error page is displayed when I try to view the deployed app. I'm getting similar errors from the logs and whenever I try to run a heroku run rake db:migrate command:
/app/vendor/bundle/ruby/2.3.0/gems/pg-0.21.0/lib/pg.rb:4:in `require': libruby.so.2.3: cannot open shared object file: No such file or directory - /app/vendor/bundle/ruby/2.3.0/gems/pg-0.21.0/lib/pg_ext.so (LoadError)
Windows 10 Bash with Ubuntu
Ruby 2.3.4p301
Rails 5.0.3
PostgreSQL 9.3.16
pg Gem 0.21.0
I've checked multiple posts that had the same error, but none of them helped.

Heroku Authentication Faulure in rails system call

I have a Rails 4.1.1 app which is hosted on heroku. Recently I changed my heroku login credentials.
In the terminal if I run for example the line:
heroku run rake db:migrate
It will successfully complete the task. "which heroku" gives: /usr/local/heroku/bin/heroku
In my Rails app I have a deploy rake task which calls the same command through system
task :staging do
...
system "heroku run rake db:migrate"
end
This however results in the error: Running 'rake db:migrate' attached to terminal... Authentication failure
In this case "which heroku" gives: /usr/local/rvm/gems/ruby-2.1.1#amn/bin/heroku
It's worth noting my app has the gem pgbackups-archive which requires the heroku gem.
How can I force the heroku gem version Rails is using to use my new login credentials or is there another way to fix this.
Thanks
The issue turned out to be with the Heroku gem.
The Heroku gem uses the user account API rather than login details. Updating the API key resolved the Authentication issue.

Deploying Rails 4 with ricn/rika gem on Heroku - precompile error

I'm running a Rails application using the Rika gem (JRuby wrapper for Apache Tika). It runs fine locally. In trying to push it to Heroku, it gets a ways into the deployment until I hit the asset precompile:
...
-----> Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
rake aborted!
No such file to load -- rika
followed by a long string of /tmp/build_8a51... errors.
Precompile works fine on the local machine.
If I try to install the gem via 'heroku run' I get:
$ heroku run gem install rika
Running gem install rika attached to terminal... up, run.8601
ERROR: While executing gem ... (ArgumentError) malformed format string - %)
Any suggestions?
Thanks
Found the problem.
I needed to add the ruby version spec line to the Gemfile. It wasn't necessary on the local machine because I set the version externally. Heroku needs it though.

Loading rails env in production

I have deployed a new Rails site to a Linux VM using Capistrano. I am using nginx as the front end and running my Rails app using unicorn.
If I try to run rake routes on the server, I get an error telling me that Rails is not installed, even though Rails is installed. The problem seems to be that the gem search directory is different for the app and the logged in user.
How do I load the Rails environment that my app is seeing as the logged in user?
Just use:
RAILS_ENV=production bundle exec rake routes
The RAILS_ENV part sets your environment variable so your app is loaded in full production mode, including database settings and so on.
The bundle exec part is necessary so that any commands that come after that are executed within the environment of the gems installed in your Gemfile.

install JRE in heroku

I got this error in running heroku run rake sunspot:solr:run
rake aborted!
You need a Java Runtime Environment to run the Solr server
is there a way i can install jre in heroku?
You cannot install the JRE on Heroku, and thus you cannot run Solr from a Heroku worker.
If you want Solr in Heroku, you'll have to use the Websolr addon, or start an EC2 server and run your own copy of Solr from there.

Resources