Wednesday, July 30, 2014

Permissions 0755 for 'certificate.pem' are too open

You may experience bad permission error and ignoring operation while running a command with AWS.

It's because a AWS are concern about your security and make sure the certificate are only accessible by you, not even to read them or discover their names. That's basic sensible security and it means no permissions whatsoever for group or world.

You should own the directory and the permission should be something like 600 or 400 or 700.

To fix the issue change permission like:
chmod 400 certificate.pem

Monday, July 28, 2014

Issues with thinking sphinx

I recently faced some issues with thinking sphinx which sharing here so that it helps others.

Has many association not working:

I had a model named User which has many tracks and the very basic index definition is as follows:
ThinkingSphinx::Index.define :track, :with => :active_record do
  indexes title
  indexes [artist.first_name, artist.last_name], :as => :artist_name, :sortable => true
I was getting following error when run
rake ts:index
rake aborted!
NoMethodError: undefined method `_reflect_on_association' for #

Adding joiner gen to the Gemfile resolved my issues which I've got through the thinking-sphinx repository
gem 'joiner', '0.3.1'

Sphinx Guard file for index {model}_delta exists, not indexing: Removing ts-{model}_delta.tmp from db/sphinx directory resolved the issue.

Failed to start searchd daemon - Address already in use: It means somehow the process is running anywhere, nothing to do with Thinking Sphinx.

A workaround is to use a other than default port 9312 and 9306 and start/stop the server
sudo service sphinxsearch stop

Check for processes running and kill all existing:
ps -ef | fgrep searchd
killall searchd

Find that your process is being run by root, then it will keep respawning if it is set as a service. You can edit nano /etc/default/sphinxsearch and modify it from START=yes to START=no