Thinking Sphinx works on my Rails app (Rails 3.2.1, TS 3.0.1) but when I set up a sphinx.yml file in the config folder, it doesn't seem to read the morphology instructions.
The file is called sphinx.yml and is in the config folder. Here is the yml format:
development:
morphology: stem_en
production:
morphology: stem_en
I copy/pasted this so the indentation matches wha'ts in my code. I don't use a libstemmer or haven't installed any other wordforms.
Please, I keep my fingers crossed someone can help me on this one as I'm stumped!
And the answer is: read ALL the doco on:
https://github.com/pat/thinking-sphinx/blob/master/README.textile
The new name for the .yml is thinking_sphinx.yml
Related
I'm using paperclip, fog, figaro gems to upload images to amazon S3. In production works fine as I introduced the env variables in heroku by hand.
But in development, it is suposed to use the env from the aplication.yml file (added to .gitignore). It is not using this file, as in development the ENV[] placed in application.yml do not exist.
I followed several tutorial for this, and in all of them I understand that the ENV[] introduced in applicaction.yml should be used. Am I wrong? Am I missing something? Do I need something else? I read that I can introduce the ENV[] by hand typing export, but I need to know if it is not enough to write them down at application.yml
#config/application.yml
MAPS_API_KEY: 1234googlemapapikey56788
SECRET_KEY_BASE: ab1234567longkeyy2979127401411124
AWS_ACCES_KEY_ID: ACCESSKEYID1234567
AWS_SECRET_ACCESS_KEY: SECRETKEY123456788/jaa\12345
AWS_REGION: eu-west-1
S3_HOST_NAME: s3-eu-west-1.amazonaws.com
development:
FOG_DIRECTORY: example-dev
S3_BUCKET_NAME: example-dev
production:
FOG_DIRECTORY: example-production
S3_BUCKET_NAME: example-production
in development and production I use the same code:
#config/environments/development.rb && config/environments/production.rb
config.paperclip_defaults = {
storage: :s3,
s3_credentials: {
bucket: ENV.fetch('S3_BUCKET_NAME'),
access_key_id: ENV.fetch('AWS_ACCESS_KEY_ID'),
secret_access_key: ENV.fetch('AWS_SECRET_ACCESS_KEY'),
s3_region: ENV.fetch('AWS_REGION'),
}
}
In production works fine, and in development I get errors like:
development.rb:54:in `fetch': key not found: "AWS_ACCESS_KEY_ID" (KeyError)
# config/initializers/paperclip.rb
Paperclip::Attachment.default_options[:url] = ':s3_domain_url'
Paperclip::Attachment.default_options[:path] = '/:class/:attachment/:id_partition/:style/:filename'
The config/application.yml you list above has a typo.
The key you want is AWS_ACCESS_KEY_ID, but the copied file uses AWS_ACCES_KEY_ID (where access is missing the second s).
I suspect that should get things working for you again.
I'm experiencing problems with HTML formatter and the output_path in behat. I'm using cmd:
behat --format=html --out=output.html --config /www/config/behat.yml test.feature
Simplified config (behat.yml) looks like this:
default:
formatter:
name: html
parameters:
output_path: /www/features/output
The problem is that no matter what output_path I set, the output.html is always placed inside same directory, where is behat.yml (/www/config). Can anybody see what am I doing wrong?
Thanks a lot for help!
UPDATE Behat v 2.4.3 use the output dir same as current dir (not the same as config), but still output_path parameter in behat.yml seems not working.
consider using the command line args and see if the issue still happens
for example:
/bin/behat --config=/pathToYML -f pretty,progress,junit --out path/to/output/file/for/pretty,,path/to/junit/output/file /path/to/behat/features/folder
The command line stuff seems to want all three if you don't specify something it will output to console which is why there are , , between pretty and path
This could hold a clue as to why you are having a problem if the command line wants more than one option by default you might need to configure your yaml for that as well.
Our shell script just feeds the command line what we want dynamically instead of doing guess work with yaml configs. Good luck
I had the same issue with behat 2.4.0, this was a known bug that was fixed on version 2.4.3.
Installation method #2 (PHAR) in the guide unfortunately only gives you version 2.4.0 at the time of writting... So in order to fix this you'll have to use the composer method #1.
Hope that helps!
Every time when I try to start my mapreduce application (in standalone Hadoop), it tries to put stuff in the tmp directory, which it can't:
Exception in thread "main" java.io.IOException: Failed to set permissions of path: \tmp\hadoop-username\mapred\staging\username-1524148556\.staging to 0700
It ties to use an invalid path (slashes should be the other way around for cygwin).
I set hadoop.tmp.dir in core-site.xml (in the conf folder of Hadoop), but it seems that the config file is never read (if I put syntax errors in the file, it makes no difference). I added:
--config /home/username/hadoop-1.0.1/conf
To the command, but no difference. I also tried:
export HADOOP_CONF_DIR=/home/username/hadoop-1.0.1/conf
but also that does not seem to have an effect....
Any pointers on why the configs would not be read, or what else I am failing to see here?
Thanks!
It's not that the slashes are inverted, it's that /tmp is a cygwin path which actually maps to /cygwin/tmp or c:\cygwin\tmp. since hadoop is java and doesn't know about cygwin mappings, it takes /tmp to mean c:\tmp.
there's an awful lot of stuff to patch if you want to get 1.0.1 running on cygwin.
see: http://en.wikisource.org/wiki/User:Fkorning/Code/Hadoop-on-Cygwin
I found the following link useful, it seems that the problem stands with newer version of Hadoop. I'm using version 1.0.4 and I'm still facing this problem.
http://comments.gmane.org/gmane.comp.jakarta.lucene.hadoop.user/25837
UPDATED: in Mahout 0.7 and for the ones who use the "Mahoot in Action" book example, you shoud change the example code as follows:
File outFile = new File("output");
if (!outFile.exists()) {
outFile.mkdir();
}
Path output = new Path("output");
HadoopUtil.delete(conf, output);
KMeansDriver.run(conf, new Path("testdata/points"), new Path("testdata/clusters"),
output, new EuclideanDistanceMeasure(), 0.001, 10,
true, 0.1, true);
Currently working on a project where we need to drop in various static html pages + static assets for those from time to time that "just work." We cannot have anyone editing the html directly to place paths in for the assets. We need it to simply work such that the html + asset folders are placed directly into /public and the content is served up as it was generated.
When testing this behavior in production, it's a no go with errors such as:
ActionController::RoutingError (No route matches [GET] "/some_folder/some-image.png"):
I assume this is a result from what I'm reading from 3.1.x's asset pipeline.
How do you alter the routes such that these will be served up directly? Or is there a preferred way to keep this precise behavior? (Ultimately this will be deployed on heroku.)
Adding some more details as current remarks have not yet pushed my issue over the edge in terms of a solution:
In my present scenario I'm running it straight on WEBrick rails s -e production to test it out. In development mode this does work properly; the only exception is in production.
I am also running this prior to running the server:
bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile --trace
When I actually attempt to load the page in production, I see the following output:
cache: [GET /] miss
cache: [GET /test_files/index.css] miss
cache: [GET /test_files/index.js] miss
cache: [GET /test_files/logo.png] miss
cache: [GET /test_files/background.png] miss
cache: [GET /test_files/horizontal.png] miss
cache: [GET /favicon.ico] miss
Upon further scrutiny of the production.rb I am seeing: "config.serve_static_assets = true" that when set to false by default evokes the issue experienced in webrick. So when setting that to true it serves the files up properly.
From some additional reading it appears that perhaps Heroku needs this set to false as well, which is the environment to which we're deploying.
Thanks for the input, but this appears to be the approach to take for now and I'd certainly appreciate any further input if this is NOT the correct answer or if there's a better approach.
As of Rails 3.1.1 the precompile task creates non-digested as well as digested filenames, so you can refer to these in static files (while still having the digest version in dynamic files).
The only problem is if you use far-future headers on the assets directory; changes to the undigested files won't be pick up by remote clients that still have a copy and believe the cache to still be valid.
You may need to look at an approach the replaces the non-digested filenames with the correct name during the deployment process.
If you do not use far-future headers in the directory then it does not matter - you can use either name.
For me the #ylluminate's answer helped: I've changed the config.serve_static_assets option to true in the config/environments/production.rb file and restarted the server with
$rails server --environment=production
and now it serves compressed assets.
NOTE: I've also precompiled the assets with
$bundle exec rake assets:precompile
(call rake this way assure will be used the rake version choosen for the project but I guess use just rake assets:precompile will work 99% of the times)
If you have /public/some_folder/some-image.png physically present (no matter if you just copied it there manually or it was generated by assets precompile), it must work. The server (e.g. Apache) will first check if the requested path exists in public, if it does it won't even call Ruby on Rails.
As far as digested filenames are concerned there is an option to turn this feature off, but I wouldn't recommend that for reasons already mentioned by someone else here.
Also you can put files that refer to assets in the app/assets folder and add a .erb extension AT THE END. Then you can use <%= asset_path ... %> inside that file, so no manual editing will be necessary. This will work even if you already have some other preprocessing on the file, for example sass - style.css.scss.erb will work. First the erb code will be evaluated (putting in the correct filenames for assets) then the sass compiler will be ran.
Oh and have a look at the sprockets-image-compressor gem, just add it to your Gemfile and it will automagically compress image assets too (losslessly using pngcrush and jpegoptim)...I don't know if the gem is rock-solid but from what I've seen I love it!
I have a rails application I would like to use for multiple sites, each with different designs.
I would like to change the rails installation /public directory to something else (dynamically eventually). However, I have run into a problem (bug?) changing directories...
In my application.rb file I change the paths.public path to something other than "public" (let's say "site_one"). Here is the code:
puts paths.public.paths
paths.public = "site_one"
puts paths.public.paths
The two "puts" commands are for debugging. Now run "rails s" and you will see:
/home/macklin/app/public
/home/macklin/app/site_one
This verifies the path is changed correctly. However, shortly afterward, rails throws the following error (let me know if you need the full trace):
Exiting
/usr/lib/ruby/gems/1.8/gems/railties-3.0.3/lib/rails/paths.rb:16:in `method_missing': undefined method `javascripts' for #<Rails::Paths::Path:0x7f422bd76f58> (NoMethodError) from /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.3/lib/action_controller/railtie.rb:47
My guess is it cannot find the javascripts directory even though it is clearly sitting in the "site_one" folder.
Does anyone know why I am getting this?
I know this question is pretty old, but I think I found an answer for this in Rails 4.2.
You just simply have to put this line in your config/application.rb:
middleware.use ::ActionDispatch::Static, "#{Rails.root}/another_public_folder_name", index: 'index', headers: config.static_cache_control
This makes all files in /another_public_folder_name to be served by Rails.
This is the way Rails use to setup the standard /public folder. I found it checking the sources:
https://github.com/rails/rails/blob/52ce6ece8c8f74064bb64e0a0b1ddd83092718e1/railties/lib/rails/application/default_middleware_stack.rb#L24
Duh. Just add 2 more rules for stylesheets and javascripts (I guess they get wiped when you change the parent path)
paths.public.stylesheets = "site_one/stylesheets"
paths.public.javascripts = "site_one/javascripts"