I'm finding that Thinking Sphinx sometimes errors out when I try to run its Rake tasks. Sometimes the tasks work fine, and sometimes I get errors like the one below.
I'm running the tasks as a normal user, not root. Not using sudo.
In the example below, searchd is still running after the Rake task fails.
I've also seen similar errors with ts:rebuild.
Has anyone else seen this?
I'm using Sphinx 0.9.9-release (r2117)
I'm using Thinking Sphinx 1.4.4 instead of the latest version because I'm on Rails 2.3.11.
$ rake ts:stop RAILS_ENV=production
(in /var/www/blog_app/releases/20110425053509)
rake aborted!
execution expired
(See full trace by running task with --trace)
[ethan#apphost current]$ rake ts:stop RAILS_ENV=production --trace
(in /var/www/blog_app/releases/20110425053509)
** Invoke ts:stop (first_time)
** Invoke thinking_sphinx:stop (first_time)
** Invoke thinking_sphinx:app_env (first_time)
** Execute thinking_sphinx:app_env
** Invoke environment (first_time)
** Execute environment
** Execute thinking_sphinx:stop
rake aborted!
execution expired
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/1.8/timeout.rb:60
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/thinking-sphinx-1.4.4/lib/thinking_sphinx/tasks.rb:58
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
/opt/ruby/bin/rake:19:in `load'
/opt/ruby/bin/rake:19
I believe this error is caused when you have a search daemon already running.
Try
ps | grep searchd
if that gives you something like this...
73470 ttys002 0:00.03 searchd --pidfile --config /Users/dwickwire/Projects/production/config/development.sphinx.conf
81907 ttys002 0:00.00 grep searchd
then kill the searchd
sudo kill -9 process_id
process_id in my case would be 73470
Then try rake ts:rebuild again.
I tried command 'ps | grep searchd' to get process ID, but I didn't get it.
Then I tried command 'pgrep searchd', it gives me process ID.
I killed that process and ran command 'rake ts:rebuild'. It worked.
I blogged about the entire experience here (disclaimer: I'm the author).
In thinking_sphinx 1.4.4 there is a 5 second timeout on rake ts:stop
If rake ts:stop takes close to or longer than 5 seconds, ruby will throw an exception.
I'm using the thinking_sphinx 1.3.18 in the meantime. (there is no timeout on 1.3.18).
Also I have submitted a patch to the github repository and the timeout will be configurable with a sphinx.yml configuration variable stop_timeout.
NOTE: rake ts:rebuild == rake ts:stop; rake ts:index; rake ts:start
I guess after deploy by capistrano you didn't run rake thinking_sphinx:configure
it would generate sphinx config file in config/production.sphinx.conf
try add pidfile to config/sphinx.yml
production:
...
pid_file: "/tmp/searchd.pid"
it will make sure to find pid of searchd to kill
and added following code to config/deploy.rb
namespace :my_tasks do
task :generate_sphinx_config, :roles => [:web] do
run "cd #{latest_release} && RAILS_ENV=#{rails_env} bundle exec rake thinking_sphinx:configure"
end
end
....
after :deploy, "my_tasks:generate_sphinx_config"
to generate sphinx config file in each release folder
The Problem
This problem occurs if your searchd crashed or you killed it manually. On Windows it doesn't overwrite your searchd.<environment>.pid, so still the old PID is saved and ThinkingSphinx doesn't check the real running processes in your taskmanager. So all these commands (rake ts:restart, rake ts:rebuild, ...) won't work, rake will always abort and you get the error rake aborted, ... searchd already running
The solution
Delete your path-to/your-app/log/searchd.<environment>.pid.
<environment> may be development or production, depending on your current stage.
Hope this answer will help the googler's.
Related
I am trying to precompile my assets:
rake assets:precompile RAILS_ENV=production bundle exec rake assets:precompile
and getting the following error:
Don't know how to build task 'bundle' (See the list of available tasks with "rake --tasks")
After --trace:
** Invoke assets:precompile (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Invoke yarn:install (first_time)
** Execute yarn:install
yarn install v1.17.3
[1/4] 🔍 Resolving packages...
success Already up-to-date.
✨ Done in 0.04s.
** Execute assets:precompile
rake aborted!
Don't know how to build task 'bundle' (See the list of available tasks with `rake --tasks`)
/Users/anton/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/task_manager.rb:59:in `[]'
/Users/anton/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/application.rb:159:in `invoke_task'
/Users/anton/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/Users/anton/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/application.rb:116:in `each'
/Users/anton/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/application.rb:116:in `block in top_level'
/Users/anton/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/application.rb:125:in `run_with_threads'
/Users/anton/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/application.rb:110:in `top_level'
/Users/anton/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/application.rb:83:in `block in run'
/Users/anton/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/application.rb:186:in `standard_exception_handling'
/Users/anton/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/application.rb:80:in `run'
/Users/anton/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.3/exe/rake:27:in `<top (required)>'
/Users/anton/.rbenv/versions/2.6.3/bin/rake:22:in `load'
/Users/anton/.rbenv/versions/2.6.3/bin/rake:22:in `<main>'
How to fix this problem? I tried to update my gems, re-installed everything, added gem 'rake' and still getting the same error. Thank you very much for your help.
Rails version: ~> 5.1.6
You seem to have mixed up your commands so that you are attempting to call two commands as one.
It appears, you are actually trying to call only this:
RAILS_ENV=production bundle exec rake assets:precompile
With the command you have used originally, you are trying to call the rake tasks named assets:precompile, bundle, exec, rake and again assets:precompile. Since you don't have a rake task named bundle, you got the error you quoted.
I am having similiar problems like a lot of users when compiling assets on their productive box. The only difference is that I can't get any hint out of the trace to solve the problem.
rake assets:precompile RAILS_ENV=production --trace
** Invoke assets:precompile (first_time)
** Execute assets:precompile
/usr/local/rbenv/versions/1.9.3-p362/bin/ruby /usr/local/rbenv/versions/1.9.3-p362/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace
** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
** Invoke assets:precompile:primary (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:primary
rake aborted!
Command failed with status (): [/usr/local/rbenv/versions/1.9.3-p362/bin/r...]
/usr/local/rbenv/versions/1.9.3-p362/lib/ruby/1.9.1/rake/file_utils.rb:53:in `block in create_shell_runner'
/usr/local/rbenv/versions/1.9.3-p362/lib/ruby/1.9.1/rake/file_utils.rb:45:in `call'
/usr/local/rbenv/versions/1.9.3-p362/lib/ruby/1.9.1/rake/file_utils.rb:45:in `sh'
/usr/local/rbenv/versions/1.9.3-p362/lib/ruby/1.9.1/rake/file_utils_ext.rb:39:in `sh'
/usr/local/rbenv/versions/1.9.3-p362/lib/ruby/1.9.1/rake/file_utils.rb:80:in `ruby'
/usr/local/rbenv/versions/1.9.3-p362/lib/ruby/1.9.1/rake/file_utils_ext.rb:39:in `ruby'
/home/app/application/ruby/1.9.1/gems/actionpack-3.2.12/lib/sprockets/assets.rake:12:in `ruby_rake_task'
/home/app/application/ruby/1.9.1/gems/actionpack-3.2.12/lib/sprockets/assets.rake:21:in `invoke_or_reboot_rake_task'
/home/app/application/ruby/1.9.1/gems/actionpack-3.2.12/lib/sprockets/assets.rake:29:in `block (2 levels) in <top (required)>'
/usr/local/rbenv/versions/1.9.3-p362/lib/ruby/1.9.1/rake/task.rb:205:in `call'
/usr/local/rbenv/versions/1.9.3-p362/lib/ruby/1.9.1/rake/task.rb:205:in `block in execute'
/usr/local/rbenv/versions/1.9.3-p362/lib/ruby/1.9.1/rake/task.rb:200:in `each'
/usr/local/rbenv/versions/1.9.3-p362/lib/ruby/1.9.1/rake/task.rb:200:in `execute'
/usr/local/rbenv/versions/1.9.3-p362/lib/ruby/1.9.1/rake/task.rb:158:in `block in invoke_with_call_chain'
/usr/local/rbenv/versions/1.9.3-p362/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/usr/local/rbenv/versions/1.9.3-p362/lib/ruby/1.9.1/rake/task.rb:151:in `invoke_with_call_chain'
/usr/local/rbenv/versions/1.9.3-p362/lib/ruby/1.9.1/rake/task.rb:144:in `invoke'
/usr/local/rbenv/versions/1.9.3-p362/lib/ruby/1.9.1/rake/application.rb:116:in `invoke_task'
/usr/local/rbenv/versions/1.9.3-p362/lib/ruby/1.9.1/rake/application.rb:94:in `block (2 levels) in top_level'
/usr/local/rbenv/versions/1.9.3-p362/lib/ruby/1.9.1/rake/application.rb:94:in `each'
/usr/local/rbenv/versions/1.9.3-p362/lib/ruby/1.9.1/rake/application.rb:94:in `block in top_level'
/usr/local/rbenv/versions/1.9.3-p362/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handling'
/usr/local/rbenv/versions/1.9.3-p362/lib/ruby/1.9.1/rake/application.rb:88:in `top_level'
/usr/local/rbenv/versions/1.9.3-p362/lib/ruby/1.9.1/rake/application.rb:66:in `block in run'
/usr/local/rbenv/versions/1.9.3-p362/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handling'
/usr/local/rbenv/versions/1.9.3-p362/lib/ruby/1.9.1/rake/application.rb:63:in `run'
/usr/local/rbenv/versions/1.9.3-p362/bin/rake:32:in `<main>'
Tasks: TOP => assets:precompile
There is effectively no status code, just the fail. It also does not make any difference if I call rake directly or via bundle exec.
About the environment
debian squeeze box with a global rbenv installation (/usr/local/rbenv like you can see from the trace). Ruby 1.9.3 2012-12-25 patchlevel 362.
Any hints / ideas on this?
I am going to answer this myself because I could solve it more or less. If someone has additions, don't hesitate to write an own answer or comment this answer/question.
What I've found out so far:
If you play around with assets:precompile by e.g just compiling the primary assets (assets:precompile:primary) or explicitly calling assets:precompile:all you might end up with a hint about the source of your problem. In my case, I ran into Errno::EACCES on both public/ and tmp/. Somehow that was not displayed, so make sure your user has full rights to create/delete files and folders there.
In my case, it worked sometimes because I've shut down the rails app and precompiled while it was down. Since precompiling allocates a lot of memory, I did some trial and error and eventually got the known Killed message when rake tries to execute asstes:precompile:primary. The task simply was killed because of using too much memory.
Another problem was that sprockets could not find bootstrap to put it into the assets pipeline on precompilation. Moving gem 'bootstrap' outside of group :assets solved this. This was also something I got hinted to when I played around with the commands.
The best way to solve – or better: work around – this problem is to simply compile your assets locally. Just throw a rake assets:precompile RAILS_ENV=development into your terminal and then deploy public/assets. Remember to delete that folder in your development environment after deploying it or you will end up debugging on why your changes on app/assets/* are not taking effect in development. At least that works for me(tm).
Alternatively, growing your swap partition may also work. However, compilation on a VPS where you need to use swap may take its while, so I'd stick to the local way.
I also had same issue.
I fixed it by adding swap(in my case 1gb for 512RAM available on my server)
Try running htop while your assets are compiling to see if you run out of RAM. Adding swap fixed it for me.
See this guide for adding swap: https://www.digitalocean.com/community/articles/how-to-add-swap-on-ubuntu-12-04
I have the following task:
task :migrate_test => :environment do
puts 'Running database migrations ...'
puts `heroku run rake db:migrate --app my-app`
end
When I run heroku run rake db:migrate --app my-app in the console, the migration proceeds successfully. However, when I run rake migrate_test, I receive the following error:
Running database migrations ...
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/dependency.rb:52:in `initialize': Valid types are [:development, :runtime], not nil (ArgumentError)
from /Users/Will/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.2.0/lib/bundler/resolver.rb:371:in `new'
from /Users/Will/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.2.0/lib/bundler/resolver.rb:371:in `search'
from /Users/Will/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.2.0/lib/bundler/resolver.rb:361:in `gems_size'
from /Users/Will/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.2.0/lib/bundler/resolver.rb:159:in `start'
from /Users/Will/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.2.0/lib/bundler/resolver.rb:159:in `map'
from /Users/Will/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.2.0/lib/bundler/resolver.rb:159:in `start'
from /Users/Will/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.2.0/lib/bundler/resolver.rb:128:in `resolve'
from /Users/Will/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.2.0/lib/bundler/resolver.rb:127:in `catch'
from /Users/Will/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.2.0/lib/bundler/resolver.rb:127:in `resolve'
from /Users/Will/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.2.0/lib/bundler/definition.rb:182:in `resolve'
from /Users/Will/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.2.0/lib/bundler/definition.rb:113:in `specs'
from /Users/Will/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.2.0/lib/bundler/definition.rb:162:in `specs_for'
from /Users/Will/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.2.0/lib/bundler/definition.rb:151:in `requested_specs'
from /Users/Will/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.2.0/lib/bundler/environment.rb:23:in `requested_specs'
from /Users/Will/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.2.0/lib/bundler/runtime.rb:11:in `setup'
from /Users/Will/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.2.0/lib/bundler.rb:116:in `setup'
from /Users/Will/.rvm/gems/ruby-1.9.3-p194#global/gems/bundler-1.2.0/lib/bundler/setup.rb:17
I believe it has something to do with rake running task in a different process that can't find the path, but haven't been able to find out how to tackle.
Nothing's wrong with your code. See this issue on GitHub.
Just update rubygems and RVM. Or even better: use rbenv!
The solution was to upgrade the Heroku toolbelt. I still received an error /Users/Will/.rvm/gems/ruby-1.9.3-p194#global/bin/rake: No such file or directory but I guess the toolbelt is smart enough to compensate. The most recent toolbelt can be found here: https://toolbelt.heroku.com/
I would also suggest using exec ... as opposed to puts ... in the rake task since you'll be able to see the progress in realtime.
at the moment I want to upgrade redmine 1.4.0 to the latest version 2.0.2.
So I followed the howto on this page:
http://www.redmine.org/projects/redmine/wiki/RedmineUpgrade
In short I downloaded the redmine-source and extracted it in a separate folder
"/var/www/redmine-2.0.2"
(whereas my working installation is in /var/www/redmine).
up to Step 3.5 everything went fine but in 3.6
the following happens:
root(at)information:/var/www/redmine-2.0.2# rake config/initializers/session_store.rb
rake aborted!
Don't know how to build task 'config/initializers/session_store.rb'
(See full trace by running task with --trace)
root(at)information:/var/www/redmine-2.0.2# rake --trace
config/initializers/session_store.rb
rake aborted!
Don't know how to build task 'config/initializers/session_store.rb'
/usr/local/rvm/gems/ruby-1.9.3-p194#global/gems/rake-
0.9.2.2/lib/rake/task_manager.rb:49:in `[]'
/usr/local/rvm/gems/ruby-1.9.3-p194#global/gems/rake-
0.9.2.2/lib/rake/application.rb:115:in `invoke_task'
/usr/local/rvm/gems/ruby-1.9.3-p194#global/gems/rake-
0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/usr/local/rvm/gems/ruby-1.9.3-p194#global/gems/rake -
0.9.2.2/lib/rake/application.rb:94:in `each'
/usr/local/rvm/gems/ruby-1.9.3-p194#global/gems/rake-
0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/usr/local/rvm/gems/ruby-1.9.3-p194#global/gems/rake-
0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-1.9.3-p194#global/gems/rake-
0.9.2.2/lib/rake/application.rb:88:in `top_level'
/usr/local/rvm/gems/ruby-1.9.3-p194#global/gems/rake-
0.9.2.2/lib/rake/application.rb:66:in `block in run'
/usr/local/rvm/gems/ruby-1.9.3-p194#global/gems/rake-
0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-1.9.3-p194#global/gems/rake-
0.9.2.2/lib/rake/application.rb:63:in `run'
/usr/local/rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/bin/rake:33:in `<top
(required)>'
/usr/local/rvm/gems/ruby-1.9.3-p194/bin/rake:19:in `load'
/usr/local/rvm/gems/ruby-1.9.3-p194/bin/rake:19:in `<main>'
/usr/local/rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `eval'
/usr/local/rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `<main>'
root(at)information:/var/www/redmine-2.0.2#
root(at)information:/var/www/redmine-2.0.2# rake --trace generate_session_store
Invoke generate_session_store (first_time)
Invoke generate_secret_token (first_time)
Invoke config/initializers/secret_token.rb (first_time)
Execute config/initializers/secret_token.rb
Execute generate_secret_token
Execute generate_session_store
Note: The rake task generate_session_store has been deprecated, please use the
replacement version generate_secret_token
root(at)information:/var/www/redmine-2.0.2#
root(at)information:/var/www/redmine-2.0.2# rake generate_session_store
Note: The rake task generate_session_store has been deprecated, please use the
replacement version generate_secret_token
root(at)information:/var/www/redmine-2.0.2# rake --trace generate_secret_token
Invoke generate_secret_token (first_time)
Invoke config/initializers/secret_token.rb (first_time, not_needed)
Execute generate_secret_token
this last step seems to generate "/var/www/redmine-2.0.2/config/initializers/secret_token.rb"
and according to the how to it is a sufficient substitute to the "rake-commands" before.
root(at)information:/var/www/redmine-2.0.2#
root(at)information:/var/www/redmine-2.0.2# rake db:migrate RAILS_ENV=production
root(at)information:/var/www/redmine-2.0.2# rake tmp:cache:clear
root(at)information:/var/www/redmine-2.0.2# rake tmp:sessions:clear
My first prob is how to start the application. I can still go to my old installation "/var/www/redmine"
and start with
ruby ./script/server -e production &
which still works, the output is:
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activesupport-
2.3.14/lib/active_support/inflector.rb:3:in `<top (required)>': iconv will be deprecated
in the future, use String#encode instead.
=> Booting Mongrel
=> Rails 2.3.14 application starting on http://0.0.0.0:3000
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after
2011-11-01.
Gem.source_index called from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rails-
2.3.14/lib/rails/gem_dependency.rb:21.
=> Call with -d to detach
=> Ctrl-C to shutdown server
But I can't start the application by going to the new folder "/var/www/redmine-2.0.2/"
and calling
ruby ./script/server -e production &
because there is no file
"/var/www/redmine-2.0.2/script/server".
How can I start the updated version of redmine or is not possible yet ?
I think redmine 2.0.2 needs rails 3.2.5 and I thought I installed
it because:
root(at)information:/var/www/redmine-2.0.2/script# rails -v
Rails 3.2.5
root(at)information:/var/www/redmine-2.0.2/script#
According to the boot protocol above Rails 2.3.14 is used. Wrong ?
Whats my mistake here ? Can somebody give advice howto
succesfully upgrade ?
thanks for your help in advance!
Cheers,
Ansgar
Solve it by using bundle exec rails s -d -e production to start the application in background using the default port (i.e. 3000).
Update
It seems to be an RVM issue, if you open a new shell and running:
$ type rvm | head -1
does not show "rvm is a function", RVM isn't being sourced correctly.
Ensure that RVM is sourced after any path settings as RVM and manipulates the path. If you don't do this, RVM may not work as expected.
Ok, so I have a simple rails application and now i'm trying to implement sunspot for search capabilities. However, after I've generated the config file with rails g sunspot_rails:install and after I've started the server and it has made the solr-dir in my rails app-dir and i run bundle exec rake sunspot:solr:reindex I get the following trace:
cakism#saraswati:~/railscode/calendar$ bundle exec rake sunspot:solr:reindex --trace
** Invoke sunspot:solr:reindex (first_time)
** Invoke sunspot:reindex (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute sunspot:reindex
Skipping progress bar: for progress reporting, add gem 'progress_bar' to your Gemfile
rake aborted!
RSolr::Error::Http - 500 Internal Server Error
Error: Severe errors in solr configuration.
Check your log files for more detailed information on what may be wrong.
If you want solr to continue after configuration errors, change:
<abortOnConfigurationError>false</abortOnConfigurationError>
in null
-------------------------------------------------------------
Request Data: "<?xml version=\"1.0\" encoding=\"UTF-8\"?><delete><query>type:Event</query></delete>"
Backtrace: /var/lib/gems/1.8/gems/rsolr-1.0.7/lib/rsolr/client.rb:230:in `adapt_response'
/var/lib/gems/1.8/gems/rsolr-1.0.7/lib/rsolr/client.rb:167:in `execute'
/var/lib/gems/1.8/gems/rsolr-1.0.7/lib/rsolr/client.rb:161:in `send_and_receive'
(eval):2:in `post'
/var/lib/gems/1.8/gems/rsolr-1.0.7/lib/rsolr/client.rb:67:in `update'
/var/lib/gems/1.8/gems/rsolr-1.0.7/lib/rsolr/client.rb:131:in `delete_by_query'
/var/lib/gems/1.8/gems/sunspot-1.3.0/lib/sunspot/indexer.rb:55:in `remove_all'
/var/lib/gems/1.8/gems/sunspot-1.3.0/lib/sunspot/session.rb:181:in `remove_all'
/var/lib/gems/1.8/gems/sunspot-1.3.0/lib/sunspot/session.rb:181:in `each'
/var/lib/gems/1.8/gems/sunspot-1.3.0/lib/sunspot/session.rb:181:in `remove_all'
/var/lib/gems/1.8/gems/sunspot-1.3.0/lib/sunspot/session_proxy/abstract_session_proxy.rb:11:in `remove_all'
/var/lib/gems/1.8/gems/rsolr-1.0.7/lib/rsolr/client.rb:230:in `adapt_response'
/var/lib/gems/1.8/gems/rsolr-1.0.7/lib/rsolr/client.rb:167:in `execute'
/var/lib/gems/1.8/gems/rsolr-1.0.7/lib/rsolr/client.rb:161:in `send_and_receive'
(eval):2:in `post'
/var/lib/gems/1.8/gems/rsolr-1.0.7/lib/rsolr/client.rb:67:in `update'
/var/lib/gems/1.8/gems/rsolr-1.0.7/lib/rsolr/client.rb:131:in `delete_by_query'
/var/lib/gems/1.8/gems/sunspot-1.3.0/lib/sunspot/indexer.rb:55:in `remove_all'
/var/lib/gems/1.8/gems/sunspot-1.3.0/lib/sunspot/session.rb:181:in `remove_all'
/var/lib/gems/1.8/gems/sunspot-1.3.0/lib/sunspot/session.rb:181:in `each'
/var/lib/gems/1.8/gems/sunspot-1.3.0/lib/sunspot/session.rb:181:in `remove_all'
/var/lib/gems/1.8/gems/sunspot-1.3.0/lib/sunspot/session_proxy/abstract_session_proxy.rb:11:in `remove_all'
/var/lib/gems/1.8/gems/sunspot-1.3.0/lib/sunspot.rb:464:in `remove_all'
/var/lib/gems/1.8/gems/sunspot_rails-1.3.0/lib/sunspot/rails/searchable.rb:178:in `solr_remove_all_from_index'
/var/lib/gems/1.8/gems/sunspot_rails-1.3.0/lib/sunspot/rails/searchable.rb:197:in `solr_reindex'
/var/lib/gems/1.8/gems/sunspot_rails-1.3.0/lib/sunspot/rails/tasks.rb:54
/var/lib/gems/1.8/gems/sunspot-1.3.0/lib/sunspot/class_set.rb:16:in `each'
/var/lib/gems/1.8/gems/sunspot-1.3.0/lib/sunspot/class_set.rb:16:in `each'
/var/lib/gems/1.8/gems/sunspot_rails-1.3.0/lib/sunspot/rails/tasks.rb:53
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `execute'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:176:in `invoke_prerequisites'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `each'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `invoke_prerequisites'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:157:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `run'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/var/lib/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/var/lib/gems/1.8/gems/rake-0.9.2.2/bin/rake:33
/var/lib/gems/1.8/bin/rake:19:in `load'
/var/lib/gems/1.8/bin/rake:19
Tasks: TOP => sunspot:solr:reindex => sunspot:reindex
I am specially curious about this:
If you want solr to continue after configuration errors, change:
<abortOnConfigurationError>false</abortOnConfigurationError>
in null
Why would it say in null? Other posts with the same problem as I have has specified the solr/conf/solrconfig.xml, and also, when I change it to false, nothing else happens.
If I remove the searchable block from my model, I don't get any error (but I suppose that's because it doesn't try to do anything then)
I've run the config file through an XML validator, and it says it's bad start-tag name at 2<-1 5<-2 6<90%.
However, even if I remove the lines which then gives a valid XML, restart solr, and try to reindex, I still get the same error.
I'm starting to get desperate here, so any help is greatly appriciated!
I was having a very similar problem and solved it by
stopping all running solr processes
removing the solr folder
turn off/restart the computer
gem uninstall all related gems
bundle install
start solr
reindex solr
it happened to me occasionally.. in my case it was solr (not sunspot) issue
try to go to
http://localhost:8982/solr/admin
or http://localhost:8983/solr/admin
or http://[your.domain]:8983/solr/admin
(depending on what environment you use)
to see what error you have under solr web server
i saw the java error message and fixed it with just deleting index directory and restarting solr
and it began to behave as expected
hope it helped
or you can re install the gem. This works for me.
Here is the easy way (does not require messing with gems or restarting computer):
rake sunspot:solr:stop
If you have modified the schema, copy the contents of site_root/solr/conf/schema.xml to your clipboard
Next, delete the entire solr folder at site_root/solr
Now run:
rake sunspot:solr:start
This command will create and repopulate the deleted solr folder.
If you copied schema.xml above, open schema.xml again, select everything, and copy the contents of your clipboard. Save the file.
Now run:
bundle exec rake sunspot:solr:reindex
More specifically, I found out the cause for my problem, hope this helps any souls who was wondering what happened
First, I deleted the solr/data folder. Bad idea. And this caused the errors as described by cakism.
Restarting, deleting solr folder, etc. won't help. Simply because there is an instance of Solr server running and it will not be stopped even with sunspot:solr:stop. You have to kill that instance by:
rake sunspot:solr:stop # stop server
ps -A | grep solr # you'll see the [PID] of the solr server
kill [PID] # replace with the [PID] from above to completely kill the solr instance
After this, you can then proceed with deleting the solr folder and starting the server again
I was facing same issue, and finally I got config/database.yml has wrong database name and, than I checked sunspot.yml, this file has also wrong configuration like ip address. I modify both of file than it start to work.
For me, there was so much dependency with turn off/restart the computer(It was not possible to restart) and does not work any thing from above(I am not trying with restart). So, my working solution was
Go to app root directory.
using ps aux | grep solr find solr process ID
stop solr process using kill -9 4313 # for me 4313 was solr process id
start solr on staging rake sunspot:solr:start RAILS_ENV=staging
re-index solr using rake sunspot:solr:reindex RAILS_ENV=staging
That's it.
N.B: Replace environment according your need