4

I have an Ubuntu Hardy slice with Passenger Phusion serving up a rails app. I am also using the sphinx full text seach with the thinking_sphinx plugin

I can run this command from the terminal:

sudo rake ts:index RAILS_ENV=production

but if this command is in the capistrano deploy file :

run "cd #{current_path}; rake thinking_sphinx:index RAILS_ENV=production"

the following error is generated:

  • executing `deploy:after_update'
    • executing `thinking_sphinx:index'
    • executing "cd /home/kollar/apps/kinfonet/current; rake thinking_sphinx:index RAILS_ENV=production" servers: ["173.45.226.102"] [173.45.226.102] executing command * [err :: 173.45.226.102] rake aborted! * [err :: 173.45.226.102] Permission denied - /home/kollar/apps/kinfonet/shared/db/sphinx

Assuming this was a permissions problem with apache, I followed an article on slicehost docs and did the following:

sudo chgrp -R www-data /home/kollar/apps/kinfonet/current

sudo chmod -R 2750 /home/kollar/apps/kinfonet/current

sudo chmod -R 2770 /home/kollar/apps/kinfonet/current/log

sudo chmod -R 2770 /home/kollar/apps/kinfonet/shared

sudo chmod -R 2770 /home/kollar/apps/kinfonet/shared/db

sudo chmod -R 2770 /home/kollar/apps/kinfonet/shared/db/sphinx

sudo chmod -R 2770 /home/kollar/apps/kinfonet/shared/pids

THe error is still there and now visitors to the site cannot access their profile pictures which are located in /home/kollar/apps/kinfonet/shared/system/avatars

There is an apache/passenger forbidden error if I call up the path to the image on the browser : You don't have permission to access /system/avatars/48/thumb_BR.jpg on this server

Can someone help fix the permissions - ie undo whatever I have done with www-data and show me how to set the appropriate permissions?

  • 1
    You need to provide a little more information. What user is running the deploy commands on the remote server? What happens when you run the same rake task *without* sudo as that user? Also provide the ls -l output from the Sphinx data directory. – Steve Madsen Jun 02 '09 at 02:35

2 Answers2

2

If you're still seeing the 403 Forbidden error, then you need to tell Apache that it's OK to follow that symlink from your app/current/system to app/shared/system. Ensure you have this in your virtual host definition:

Options FollowSymLinks
Steve Madsen
  • 13,465
  • 4
  • 49
  • 67
0

Thanks for trying to help.

  1. "What user is running the deploy commands on the remote server? " -- The user is kollar

  2. What happens when you run the same rake task without sudo as that user?

got this to work. Ran a ls-l on shared/db and saw that it was set to root as user and root as group. changed both to my user "kollar" and now rake can run from the cap deploy.rb file without sudo.

My biggest problem remains that apache is bringing back a Forbidden 403 permissions error when it tries to access the shared/system folder where user uploaded images are stored:

You don't have permission to access /system/avatars/51/thumb_DSC00010.JPG on this server. Apache/2.2.8 (Ubuntu) Phusion_Passenger/2.2.2 Server port 80

there is a symlink from /home/path/to/app/current/system to /home/path/to/app/shared/system

running an ls -l on shared/sytem produces: drwxrws--- 7 kollar kollar 4096 Jun 2 06:47 avatars

I tried adding www-data as group on this folder but that doesn't seem to solve the problem. Any help on this would be greatly appreciated.