bundler: not executable: rake - jruby

I'm in the process of setting up JRuby 1.7 in a ubuntu vagrant box to work with torquebox. I'm using the torquebox-remote-deployer gem to deploy the archive file and the app stuff to the virtual machine. Now, when the gem tries to execute bundle exec rake db:migrate, I get the following error:
bundler: not executable: rake
Now, when i check in the vendor/bundle/jruby/1.9/bin directory, rake and all the other needed executables are there. I've also tried running the bundle command through the local jruby install to ensure it is called properly, but I get the same result
/opt/jruby/bin/jruby -S bundle exec rake db:migrate
Any suggestions? If you need more info, just ask.

So is the rake file that's there actually marked as executable?
Not sure how you'd end up in that situation to begin with but the error message seems to be saying that 'rake' itself is there but just not marked executable (+x).

If same question will be for rails script file solution will be:
Just update file permission to executable. It worked for me.
chmod 777 -R script/filename.rb
Cheers!

This is due to a "bug" with jar.
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6194856
I ended up creating a separate ruby script for fixing permissions that I invoke with torquebox:remote:exec["bundle exec jruby path/to/script"].

Related

heroku sequelize: command not found

I have installed sequelize cli using the following command
npm install -g sequelize-cli
It works fine on localhost
But when I deploy to heroku and try to run migrations
I get error
sequelize: command not found
As for me I was trying to run sequelize DB migration to heroku postgress database. As per earlier documentations, or maybe what you tried, was to run the command heroku run sequelize db:migrate
This however is what seems to work now heroku run npx sequelize-cli db:migrate
The package sequelize-cli is installed globally on your system so it's working on your system without any problem.
You can not run a script that is installed on your system, on the Heroku.
Since Heroku CLI is made to accomplish the operation related to Heroku dynos only i.e. you can only run commands that are predefined in Heroku CLI
To run a script on Heroku you have to define it in package and when Heroku will deploy your app it will automatically run that script.
For example:
If you want to run db:migrate using sequelize-cli then do the following steps:
add sequelize-cli as a dependency in your package.json
add migrate: "sequelize db:migrate" in the scripts.
I am not sure for what purpose you want to run this command. But to run a script on Heroku you have to define it in your package and Heroku will do the rest.

cannot open shared object file: No such file or directory - /usr/local/bundle/gems/mysql2-0.5.3/lib/mysql2/mysql2.so (LoadError) when launching Rails

I'm trying to build and launch a Rails 6 container using mysql2 gem. Everything builds fine but when I go to launch the Rails server, I get the error
/usr/local/bundle/gems/activesupport-6.0.3.6/lib/active_support/dependencies.rb:324:in `require': libmariadb.so.3: cannot open shared object file: No such file or directory - /usr/local/bundle/gems/mysql2-0.5.3/lib/mysql2/mysql2.so (LoadError)
The relevant part of my Dockerfile is where I'd install the native extensions. I'm aware that MariaDB is also an option but I tried those too and got the same error.
apt-get update -qq && apt-get install -y git openssh-client build-essential pkg-config default-mysql-client default-libmysqlclient-dev libsqlite3-dev ;\
I'm using mysql2 (0.5.3) and Rails 6.0.3.6
Anyone have any suggestions? I've probably spent a week on this, your help would be greatly appreciated. Thanks!
I figured out the issue.
In my Dockerfile I had another FROM clause after my apt-get install. Doing that reset the scope of the file so those dependencies weren't available at runtime of the Rails server. I removed that and it worked.

heroku mysqltopostgres installation error

I am trying to deploy my php app that uses mysql db to heroku.
I followed instructions here - https://devcenter.heroku.com/articles/heroku-mysql
The sudo gem install mysqltopostgres-0.3.0.gem command executed without errors:
gem build mysqltopostgres.gemspec
Successfully built RubyGem
Name: mysqltopostgres
Version: 0.3.0
File: mysqltopostgres-0.3.0.gem
but when I try to execute the mysqltopostgres command, the following errors occur
mysqltopostgres /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:34:in
'block in setup': You have already activated test-unit 2.5.5, but your
Gemfile requires test-unit 3.2.1. Prepending 'bundle exec' to your
command may solve this. (Gem::LoadError) from
/usr/lib/ruby/vendor_ruby/bundler/runtime.rb:19:in 'setup' from
/usr/lib/ruby/vendor_ruby/bundler.rb:92:in 'setup' from
/usr/lib/ruby/vendor_ruby/bundler/setup.rb:8:in ''
from
/usr/local/lib/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in
'require' from
/usr/local/lib/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in
'require' from
/var/lib/gems/2.3.0/gems/mysqltopostgres-0.3.0/bin/mysqltopostgres:5:in
'' from /usr/local/bin/mysqltopostgres:22:in 'load'
from /usr/local/bin/mysqltopostgres:22:in ''
I then tried to prepend bundle exec:
bundle exec mysqltopostgres
/usr/local/lib/site_ruby/2.3.0/rubygems.rb:270:in 'find_spec_for_exe':
can't find gem mysqltopostgres (>= 0.a) (Gem::GemNotFoundException)
from /usr/local/lib/site_ruby/2.3.0/rubygems.rb:298:in
'activate_bin_path' from /usr/local/bin/mysqltopostgres:22:in
''
Has anyone ever come across these errors?
And I am new to Heroku, and I was building my app on my local apache and now I want to deploy it to heroku.

Mysql2::Error: Table doesn't exist: SHOW FULL FIELDS FROM `sessions`

I just cloned an application from my developer and I want to set it up on my computer. I get this error when I go to localhost:3000, and I don't really understand what it means.
Error:
ActiveRecord::StatementInvalid - Mysql2::Error: Table
'goacquire_development.sessions' doesn't exist: SHOW FULL FIELDS FROM `sessions`:
I think it could be my installation process, I'll appreciate if someone could explain this error to me.
A few ideas:
Make sure MySQL is running on your local machine.
Make sure you have run rake db:create and rake db:migrate.
Make sure you have a database.yml file configured with MySQL settings.
Hope this helps.
Install MySQL server on your machine
Config database.yml (Create new if your app don't have.)
Run commands:
# cd /path/to/your/app
# bundle install
# rake db:create
# rake db:migrate
# rails s

mysql compatability error - rake aborted error on rake db:create

I'm a starter in ROR
I' m using ruby 1.9.3 and rails 3.2.1
This is what appears on using rake db:create command
**>rake db:create
rake aborted!
Please install the mysql adapter: 'gem install activerecord-mysql-adapter' <can't activate mysql <~> 2.8.1>, already activated mysql-2.9.0-x86-mingw32. Make sur all dependancies are added to Gemfile.>**
Have installed mysql gem and copied libmysql.dll file to Ruby193/bin (Phpmyadmin and xampp also works good).
Please help me to solve this issue.
Looks like you have to add mysql2 gem into your Gemfile.
Take a look at this answer: Rails mysql2 undefined method
If this doesn't solve your problem, paste the contents of your Gemfile.