Running two thinking sphinx - ruby-on-rails

Ok so i have two rails application on my server and both apps use thinking sphinx and all seems good with one app. when i do
rake ts:start RAILS_ENV=production
Started successfully (pid 9943).
but when i do it on the other app i get
rake ts:start RAILS_ENV=production --trace
** Invoke ts:start (first_time)
** Invoke thinking_sphinx:start (first_time)
** Invoke thinking_sphinx:app_env (first_time)
** Execute thinking_sphinx:app_env
** Invoke environment (first_time)
** Execute environment
Jammit Warning: Asset compression disabled -- Java unavailable.
Jammit Warning: No assets match 'public/stylesheets/public.css'
** Execute thinking_sphinx:start
Failed to start searchd daemon. Check /var/www/projects/log/searchd.log.
Failed to start searchd daemon. Check /var/www/projects/log/searchd.log
** Execute ts:start
they are both using different ports....any idea...also i checked the log file here /var/www/projects/log/searchd.log and its blank ...any idea what to do...i have tried almost everything

rake ts:start starts your sphinx daemon. If you want your apps to share the same search engine, you should only do ts:start once. and both apps should work.

Related

Why does Resque show "0 out of 0 Workers Working" while a worker is running? No jobs getting picked up

I'm trying to test out my Ruby on Rails app. I have redis running, I have a rails server setup and I started a Resque worker in the terminal via the command rake resque:work QUEUE=*, which responds correctly with INFO 2020-01-08 12:10:00 -0500: Starting worker main. When I check the Resque UI in my browser it shows 0 out of 0 workers working. I don't get any error messages in either the terminal or the browser. No jobs are getting picked up, and when I check Resque.workers in the rails console it returns an empty array even while the worker is running in an adjacent tab.
Another test I tried is using --trace as so:
bundle exec rake resque:work --trace
** Invoke resque:work (first_time)
** Invoke resque:preload (first_time)
** Invoke resque:setup (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute resque:setup
** Execute resque:preload
** Invoke resque:setup
** Execute resque:work
set QUEUE env var, e.g. $ QUEUE=critical,high rake resque:work
Which, as shown above, doesn't return anything of notice (at least to me). Anyone know why my workers aren't being acknowledged?
So I ended up fixing this by changing the redis db to use 0 instead of 1
'redis://localhost:6379/0'
Any other number results in the workers not being picked up or acknowledged although I can't say why. If anyone knows I'm still interested in hearing what's going on here even though it's solved.

rails and rake commands freeze/hang

I've recently updated an old application to from 3.2.13 to 4.2.10. I've got the application running in development mode but any rake or rails commands I try to run just hang/freeze. The terminal window will hang for a second and then nothing, I'm unable to even stop the process with ctrl-c. I've read a lot about running 'spring stop' to fix this but I don't have spring installed on this app.
Running the commands with --trace aren't particularly helpful.
rails generate model Foo --trace gives me nothing and rake db:migrate --trace gives me:
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:migrate
before freezing. Any pointers in the right direction would be appreciated.

Ruby on Rails in production error

I've just put my Rails app online in production. And I kind of have two problems:
I get a 500 on my website for which the production.log says:
Completed 500 Internal Server Error in 10.0ms
ActionView::Template::Error (./icons/icon_nameplate.png isn't precompiled):
For this what I tried is running the following command:
bundle exec rake assets:precompile
This didn't work. I want to say that when I run the server locally on my computer with rails server everything works just fine.
Output of bundle exec rake assets:clean assets:precompile --trace:
** Invoke assets:clean (first_time)
** Execute assets:clean
/usr/bin/ruby1.9.1 /usr/local/bin/rake assets:clean:all RAILS_ENV=production RAILS_GROUPS=assets --trace
** Invoke assets:clean:all (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:clean:all
rm -rf /home/celliptic/public/assets
** Invoke assets:precompile (first_time)
** Execute assets:precompile
/usr/bin/ruby1.9.1 /usr/local/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
** Invoke assets:precompile:nondigest (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:nondigest
The second problem may be why the first one didn't get corrected after precompilation. It's just that any modification on the server isn't directly reflected on the website. Is it normal? Is it because of some kind of proxy caching my website?
Thank you for your answers!
Try running:
bundle exec rake assets:clean assets:precompile --trace
then spawn it if you are using passenger:
touch tmp/restart.txt
then check again.
The error you have: ActionView::Template::Error (./icons/icon_nameplate.png isn't precompiled), to me, seems like you're trying to load a static asset when it's not there.
I would look at your views or CSS to where you referenced icon_nameplate.png - I believe the problem will likely be that you're trying to reference the file directly, and as it has not been compiled, it's unavailable. The proof of this would be that it's referencing a static (non fingerprinted) link
After you've followed tungsten_carbide's directions, please let us know what happens
Hi what webserver you are using? and under which Linux?
try those steps:
see if you got the permissions to write the compiled assets.
you sure you include it under application.css?
paste your complete css file maybe you use methods like asset-url which can cause the error you talk about.
Thanks everyone for your help. It works well now, but I don't really know which command made the deal. I've made:
bundle exec rake assets:clean assets:precompile --trace
touch tmp/restart.txt
Changed config.assets.compile = true in production.rb
At this moment it didn't work, so I went to sleep. Woke up, load my website and it worked
So maybe it needed time to activate the changes or I don't know.
Still thank you for your help.

spree 2.0.3 heroku error precompiling assets "Error: Out of stack space"

I'm trying to get a basic spree application working on Heroku. I'm following http://railsapps.github.io/rails-heroku-tutorial.html and the spree heroku guide.
I have edited config/application.rb to include config.assets.initialize_on_precompile = false
Then, because I need to precompile before I push to Heroku, I get stuck here:
D:\code\foo>rake assets:precompile --trace
** Invoke assets:precompile (first_time)
** Execute assets:precompile
d:/RailsInstaller/Ruby1.9.3/bin/ruby.exe d:/RailsInstaller/Ruby1.9.3/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 tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:primary
rake aborted!
Error: Out of stack space
(in D:/code/foo/app/assets/javascripts/admin/all.js)
d:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/execjs-.4.0/lib/execjs/external_runtime.rb:68:in `extract_result'
...much more...
The all.js asset is unchanged from the original installation:
Running
rake assets:clean
before the precompile fixed this for somebody else, but not for me.
Browsing around it looks like this might be a windows specific issue? If it matters I used railsinstaller and I'm running Windows 7 on fairly new laptop.
Then, because I need to precompile before I push to Heroku
This is false. By default, Heroku's Cedar stack compiles your assets during slug compilation when you push to Heroku.
For more information see: https://devcenter.heroku.com/articles/rails-asset-pipeline

Starting resque workers while started development server

I want to start my workers when I start my development server to test the a new cron job I have in my resque scheduler, so I run this command when starting dev server-
QUEUE=* rake environment resque:work rails s
it has worked for me before and if I'm reading their documentation correctly should still work.
But I'm getting the following error after I interrupt it after it gets hung up-
^Crake aborted!
Don't know how to build task 'rails'
here is what I get after keyboard interrupt and running it with --trace
** Invoke environment (first_time)
** Execute environment
** Invoke resque:work (first_time)
** Invoke resque:preload (first_time)
** Invoke resque:setup (first_time)
** Invoke environment
** Execute resque:setup
** Execute resque:preload
** Invoke resque:setup
** Execute resque:work
^Crake aborted!
Don't know how to build task 'rails'
I don't understand why I would be getting the error and additionally why it previously loaded and worked but not anymore. What am I missing here?
Are you sure that you manage to run this command sometime back successfully
QUEUE=* rake environment resque:work rails s
because the way I know rails s is a list of rails command not a rake task
you can run consecutive rake separating spaces like
QUEUE=* rake environment rake1 rake2 rake3
but you cant run a rake and rails command they way you mention above
what I see from your trace above that rake(resque rake) is running now instead of passing a second rake you specified a rails command to start the server rake is considering that as rake task (which is not true)
I believe you are looking for this
QUEUE=* rake environment resque:work && rails s
But I dont believe that what you have mention would ever work please let me know if something conflict over here
Hope It make sense
This is better:
BACKGROUND=yes QUEUE=* PIDFILE=./tmp/resque.pid bundle exec rake environment resque:work
Then:
rails s
If you need stop resque worker:
kill -QUIT $(cat ./tmp/resque.pid)

Resources