I've switched to rbenv in production (staging to be correct) and most of the switch seemed to work just fine. I've followed the guidelines outlined here: http://blog.danielpietzsch.com/post/14005159872/running-a-rails-app-in-production-using-rbenv-apache
However, running rake assets:precompile throws this Failed to connect to a master node at localhost:27017. My guess is that this is a symptom of something else missing or being astray.
which rake
root#staging1:/var/www/staging# which rake
/usr/local/rbenv/shims/rake
rbenv version
root#staging1:/var/www/staging# rbenv version
1.9.3-p125 (set by /usr/local/rbenv/version)
mongod is running on localhost:27017
root#staging1:/var/www/staging# mongo --port 27017 --host localhost
MongoDB shell version: 1.8.0
connecting to: localhost:27017/test
> exit
bye
rake task that triggers the error
root#staging1:/var/www/staging# rake assets:precompile
/usr/local/rbenv/versions/1.9.3-p125/bin/ruby /usr/local/rbenv/versions/1.9.3-p125/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
rake aborted!
Failed to connect to a master node at localhost:27017 <--------------- ERROR
Tasks: TOP => environment
(See full trace by running task with --trace)
rake aborted!
Command failed with status (1): [/usr/local/rbenv/versions/1.9.3-p125/bin/r...]
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)
Here is the rake task with --trace: http://pastie.org/private/ww9wm0wlm6le6wbtmq89ia
I've found a few others with the same problem on heroku, but in that case it seem to be because mongo really isn't running: http://blog.noizeramp.com/2011/10/14/rails-3-asset-pipeline-on-heroku-when-using-mongoid/
I'd be happy to provide more details if needed. Just let me know and I'll update the question with more details.
Turns out I was using this in my mongoid.yml:
defaults: &defaults
use_utc: true
host: localhost
allow_dynamic_fields: false
...
and in /etc/mongodb.conf:
bind_ip = 127.0.0.1
This doesn't work, for some reason. Changing to 127.0.0.1 solved the problem.
Related
I have an application in rails 4.2.7.1, when I run the db:migrate in test in works perfectly
➜ bundle exec rake db:drop RAILS_ENV=test
➜ bundle exec rake db:ceate RAILS_ENV=test
➜ bundle exec rake db:migrate RAILS_ENV=test
But when I ran it in development, only the last migration or beginning from a drop database after executing firs migration I get this:
➜ bundle exec rake db:migrate -- --trace
== 20191112204156 MyNewModel: migrating ==============================
-- create_table(:global_clients)
-> 0.0121s
== 20191112204156 MyNewModel: migrated (0.0122s) =====================
rake aborted!
SystemStackError: stack level too deep
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
I'm using ruby 2.1.6, and mysql 0.318 and later 0.4.10, I did rvm implode to start it again and nothing happens. I do not know how to solve it, even I do not know how to debug it. So any tips will be good.
It's a problem with dthe difference from rais test and development environments
I am trying to deploy my rails app to a digital ocean server using the capistrano gem, and I'm getting the error :
The deploy has failed with an error: #<SSHKit::Command::Failed: RAILS_ENV= bundle exec rake assets:precompile exit status: 256
RAILS_ENV= bundle exec rake assets:precompile stdout: Nothing written
RAILS_ENV= bundle exec rake assets:precompile stderr: rake aborted!
ActiveRecord::AdapterNotSpecified: database configuration does not specify adapter
Even though the local config/database.yml and shared/config/database.yml file on the server are both configured, and have production databases set.
In case I run the rake db:create command on the server, it does create the database successfully. So, can't really find the issue.
Using rails 4.0.2, ruby 2.1.0, capsitrano 3.1.0
Sorry - I don't have the rep to comment.
It's a bit short on detail about your deploy configuration, you probably need to share.
RAILS_ENV= bundle exec rake assets:precompile stdout: Nothing written
Would suggest to me that there is no RAILS_ENV set. I don't think there is an issue with the database .yml
Infact - this post might be relevant: Capistrano 3, Rails 4, database configuration does not specify adapter
Okay so time after time we've all seen question about Rake assets:precompile error. I've tried multiple methods, I looked at the following SO question Ruby on Rails Rake assets:precompile error and tried multiple methods of even doing the following: config.assets.compile = true and then running rake assets:precompile --trace RAILS_ENV=production. However I noticed that when I tried to do the following:
rake assets:precompile RAILS_ENV=production I got the following error:
rake aborted!
CScript Error: Execution of the Windows Script Host failed. (0x800A0007)
C:\Users\home\Desktop>cd MIUK_Portal
C:\Users\home\Desktop\MIUK_Portal>rake assets:precompile
RAILS_ENV=production C:/RailsInstaller/Ruby1.9.3/bin/ruby.exe
C:/RailsInstaller/Ruby1.9.3/bin/rake assets:precompile:all
RAILS_ENV=production RAILS_GROUPS=assets rake aborted! 795: unexpected
token at
'C:\Users\home\AppData\Local\Temp\execjs20121221-5484-1atk9yx.js(2, 3)
Microsoft JScript runtime error: Out of memory
' (in
C:/Users/home/Desktop/MIUK_Portal/app/assets/javascripts/application.js)
Tasks: TOP => assets:precompile:primary (See full trace by running
task with --trace) rake aborted! Command failed with status (1):
[C:/RailsInstaller/Ruby1.9.3/bin/ruby.exe C...]
Tasks: TOP => assets:precompile (See full trace by running task with
--trace)
Has anyone encountered this issue? How do you overcome this?
Update
Okay apparently from looking at the error it clearly is stating that
:\Users\home\AppData\Local\Temp\execjs20121221-5484-1atk9yx.js(2, 3)
Microsoft JScript runtime error: Out of memory
So I'm now wondering how to resolve this? Any ideas? Further to this I noticed that someone did encounter the similar issue: CS Script issue but this was unresolved:
So I am asking if anyone out there has had the same issue.
This was what I did, and it worked for me. I installed node.js first in my system, and then ran the following command bundle exec rake assets:precompile.
I was able to solve this issue by transferring the project into a Linux environment (Ubuntu) and running the bundle exec rake assets:precompile. It appeared to work, I believe this sort of issue is something to do with windows. If starting any kind of development to do with RoR stick to Linux.
I need to make it to make my jQuery working on Heroku.
Here is my console:
$ rake assets:precompile
c:/Ruby192/bin/ruby.exe c:/Ruby192/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
rake aborted!
Access denied for user 'root'#'localhost' (using password: NO)
Tasks: TOP => environment
(See full trace by running task with --trace)
rake aborted!
Command failed with status (1): [c:/Ruby192/bin/ruby.exe c:/Ruby192/bin/rak...]
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)
When I try do run:
$ assets:precompile
sh: assets:precompile: command not found
EDITED:
Also I added this line to application.rb:
config.assets.initialize_on_precompile = false
You have mentioned wrong username and password of mysql. Some gems which need database access for assets:precompile.
jQuery validation is working locally, but it doesn't on Heroku.
There is no errors about it in console. What should I do ?
EDITED
den#DENYS /D/myapp (master)
$ RAILS_ENV=production bundle exec rake assets:precompile
c:/Ruby192/bin/ruby.exe c:/Ruby192/bin/rake assets:precompile:all RAIL
uction RAILS_GROUPS=assets
rake aborted!
Access denied for user 'root'#'localhost' (using password: NO)
Tasks: TOP => environment
(See full trace by running task with --trace)
rake aborted!
Command failed with status (1): [c:/Ruby192/bin/ruby.exe c:/Ruby192/bi
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)
Have you precompiled your assets before pushing to heroku?
RAILS_ENV=production bundle exec rake assets:precompile
You can find more information here.
If it doesn't solve your problem, please provide the heroku logs in your question.