# AAF quirks in production mode

**URL:** <https://www.ruby-forum.com/t/aaf-quirks-in-production-mode/104229>\
**Category:** Ferret\
**Created:** [May 15, 2007, 6:01pm UTC](https://www.ruby-forum.com/t/aaf-quirks-in-production-mode/104229 "2007-05-15T18:01:58Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![pimpmaster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/b9e5f3/32.png) [@pimpmaster](https://www.ruby-forum.com/u/pimpmaster)\
**Post date:** [May 15, 2007, 6:01pm UTC](https://www.ruby-forum.com/t/aaf-quirks-in-production-mode/104229/1 "2007-05-15T18:01:58Z")

</div>

So my ferret behaves nicely in dev mode, but I just deployed and now  
he is not happy!

First thing I noticed was that in general my app would not start with  
a folder called “development” in my index folder, so I changed it to  
“production” and now my app is functioning.

However, when I try to search I get errors, which you can see here:

[http://pastie.caboo.se/61767](http://pastie.caboo.se/61767)

Im no guru, but I would guess that my little stunt with renaming the  
directory wasn’t kosher enough for AAF

What should I do?

---

<div class="post-metadata">

**Author:** ![pimpmaster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/b9e5f3/32.png) [@pimpmaster](https://www.ruby-forum.com/u/pimpmaster)\
**Post date:** [May 15, 2007, 6:16pm UTC](https://www.ruby-forum.com/t/aaf-quirks-in-production-mode/104229/2 "2007-05-15T18:16:02Z")

</div>

Just found another quirk… anytime i save or update something i get  
an error

[http://pastie.caboo.se/61773](http://pastie.caboo.se/61773)

I will assume that this all ties into my tomfoolery with directories

---

<div class="post-metadata">

**Author:** ![pimpmaster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/b9e5f3/32.png) [@pimpmaster](https://www.ruby-forum.com/u/pimpmaster)\
**Post date:** [May 15, 2007, 7:04pm UTC](https://www.ruby-forum.com/t/aaf-quirks-in-production-mode/104229/3 "2007-05-15T19:04:07Z")

</div>

On Tue, May 15, 2007 at 06:01:07PM +0200, Steven G. wrote:

> So my ferret behaves nicely in dev mode, but I just deployed and now  
> he is not happy!
> 
> First thing I noticed was that in general my app would not start with  
> a folder called “development” in my index folder, so I changed it to  
> “production” and now my app is functioning.

what was the error before you renamed that directory?

In general, AAF does not rely on you to create the production directory,  
it can do this on its own given proper access rights - most of the time  
it’s just that the index directory cannot be accessed by Ferret because  
of missing write permissions to the index dir.

Jens

–  
Jens Krämer  
webit! Gesellschaft für neue Medien mbH  
Schnorrstraße 76 | 01069 Dresden  
Telefon +49 351 46766-0 | Telefax +49 351 46766-66  
removed\_email\_address@domain.invalid | [www.webit.de](http://www.webit.de)

Amtsgericht Dresden | HRB 15422  
GF Sven Haubold, Hagen Malessa

---

<div class="post-metadata">

**Author:** ![pimpmaster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/b9e5f3/32.png) [@pimpmaster](https://www.ruby-forum.com/u/pimpmaster)\
**Post date:** [May 15, 2007, 7:31pm UTC](https://www.ruby-forum.com/t/aaf-quirks-in-production-mode/104229/4 "2007-05-15T19:31:28Z")

</div>

Actually it was the same error

ArgumentError ( isn’t a valid directory argument. You should use  
either a String or a Directory):

my index folder is chmoded to 755… is that correct?

---

<div class="post-metadata">

**Author:** ![pimpmaster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/b9e5f3/32.png) [@pimpmaster](https://www.ruby-forum.com/u/pimpmaster)\
**Post date:** [May 15, 2007, 7:47pm UTC](https://www.ruby-forum.com/t/aaf-quirks-in-production-mode/104229/5 "2007-05-15T19:47:30Z")

</div>

That did the trick!

I was worried about security risks, but if you say 777 is okay then I  
will run with it

---

<div class="post-metadata">

**Author:** ![pimpmaster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/b9e5f3/32.png) [@pimpmaster](https://www.ruby-forum.com/u/pimpmaster)\
**Post date:** [May 15, 2007, 7:36pm UTC](https://www.ruby-forum.com/t/aaf-quirks-in-production-mode/104229/6 "2007-05-15T19:36:28Z")

</div>

On Tue, May 15, 2007 at 07:31:04PM +0200, Steven G. wrote:

> Actually it was the same error
> 
> ArgumentError ( isn’t a valid directory argument. You should use  
> either a String or a Directory):
> 
> my index folder is chmoded to 755… is that correct?

that depends, with 755 only the owner of the directory may write to it.  
try  
chmod -R 777 index/  
to check if the problem is with access rights. If it still doesn’t work  
then you can revert to the original access rights.

Jens

–  
Jens Krämer  
webit! Gesellschaft für neue Medien mbH  
Schnorrstraße 76 | 01069 Dresden  
Telefon +49 351 46766-0 | Telefax +49 351 46766-66  
removed\_email\_address@domain.invalid | [www.webit.de](http://www.webit.de)

Amtsgericht Dresden | HRB 15422  
GF Sven Haubold, Hagen Malessa

---

<div class="post-metadata">

**Author:** ![pimpmaster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/b9e5f3/32.png) [@pimpmaster](https://www.ruby-forum.com/u/pimpmaster)\
**Post date:** [May 15, 2007, 7:50pm UTC](https://www.ruby-forum.com/t/aaf-quirks-in-production-mode/104229/7 "2007-05-15T19:50:31Z")

</div>

On 5/15/07, Steven G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> That did the trick!
> 
> I was worried about security risks, but if you say 777 is okay then I  
> will run with it

No, no,no. 777 is not OK. That will open your site to Very Bad  
Things ™. Jens was saying that the user running your app needs to  
have write access. You should figure out what user is running your  
app (mongrel?, lighty?, etc.) and make sure to give that user (only)  
write access.

–

Sean B.

---

<div class="post-metadata">

**Author:** ![pimpmaster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/b9e5f3/32.png) [@pimpmaster](https://www.ruby-forum.com/u/pimpmaster)\
**Post date:** [May 15, 2007, 8:05pm UTC](https://www.ruby-forum.com/t/aaf-quirks-in-production-mode/104229/8 "2007-05-15T20:05:33Z")

</div>

On Tue, May 15, 2007 at 01:49:47PM -0400, Sean B. wrote:

> write access.  
> Full ACK, the 777 was only the short way of checking if it is a  
> permissions problem in the first place.

In addition to what Sean wrote above - if you’re running the DRb server  
it’s this process that needs write access, not your mongrels (as they  
will only talk to the DRb server). Won’t matter if you use the same user  
for mongrels and DRb, though. So once you know the user, give him write  
permissions and revert the permissions to something more restrictive  
again.

Jens

–  
Jens Krämer  
webit! Gesellschaft für neue Medien mbH  
Schnorrstraße 76 | 01069 Dresden  
Telefon +49 351 46766-0 | Telefax +49 351 46766-66  
removed\_email\_address@domain.invalid | [www.webit.de](http://www.webit.de)

Amtsgericht Dresden | HRB 15422  
GF Sven Haubold, Hagen Malessa

---

<div class="post-metadata">

**Author:** ![pimpmaster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/b9e5f3/32.png) [@pimpmaster](https://www.ruby-forum.com/u/pimpmaster)\
**Post date:** [May 15, 2007, 8:20pm UTC](https://www.ruby-forum.com/t/aaf-quirks-in-production-mode/104229/9 "2007-05-15T20:20:35Z")

</div>

Yikes, I totally didnt even consider DRB server…but i suppose its  
kind of a must for production huh?

I really need to optimize my app… my VPS doesn’t have any RAM left  
over

in the meantime, I will be studying this more. any links to DRB  
integration would be welcome

cheers

SG

---

<div class="post-metadata">

**Author:** ![pimpmaster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/b9e5f3/32.png) [@pimpmaster](https://www.ruby-forum.com/u/pimpmaster)\
**Post date:** [May 15, 2007, 8:21pm UTC](https://www.ruby-forum.com/t/aaf-quirks-in-production-mode/104229/10 "2007-05-15T20:21:35Z")

</div>

Almost forgot to ask an obvious question… how to i find out who the  
user is? I thought that chmod 775 would take care of this

---

<div class="post-metadata">

**Author:** ![pimpmaster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/b9e5f3/32.png) [@pimpmaster](https://www.ruby-forum.com/u/pimpmaster)\
**Post date:** [May 16, 2007, 2:19pm UTC](https://www.ruby-forum.com/t/aaf-quirks-in-production-mode/104229/11 "2007-05-16T14:19:14Z")

</div>

On Tue, May 15, 2007 at 08:19:59PM +0200, Steven G. wrote:

> Yikes, I totally didnt even consider DRB server…but i suppose its  
> kind of a must for production huh?
> 
> I really need to optimize my app… my VPS doesn’t have any RAM left  
> over

Dpeending on how large your index is and how many mongrel instances  
you’re running, DRb might actually save you some RAM.

> in the meantime, I will be studying this more. any links to DRB  
> integration would be welcome

[http://projects.jkraemer.net/acts\_as\_ferret/wiki/DrbServer](http://projects.jkraemer.net/acts_as_ferret/wiki/DrbServer)

[http://www.jkraemer.net/2007/3/24/acts\_as\_ferret-0-4-0-rie](http://www.jkraemer.net/2007/3/24/acts_as_ferret-0-4-0-rie)

Jens

–  
Jens Krämer  
webit! Gesellschaft für neue Medien mbH  
Schnorrstraße 76 | 01069 Dresden  
Telefon +49 351 46766-0 | Telefax +49 351 46766-66  
removed\_email\_address@domain.invalid | [www.webit.de](http://www.webit.de)

Amtsgericht Dresden | HRB 15422  
GF Sven Haubold, Hagen Malessa

---

<div class="post-metadata">

**Author:** ![pimpmaster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/b9e5f3/32.png) [@pimpmaster](https://www.ruby-forum.com/u/pimpmaster)\
**Post date:** [May 16, 2007, 2:10pm UTC](https://www.ruby-forum.com/t/aaf-quirks-in-production-mode/104229/12 "2007-05-16T14:10:13Z")

</div>

On Tue, May 15, 2007 at 08:21:23PM +0200, Steven G. wrote:

> Almost forgot to ask an obvious question… how to i find out who the  
> user is? I thought that chmod 775 would take care of this

chmod is used to set the permissions on a file (or directory or whatever  
:-).

Basically each file has three sets of permissions associated with it:  
the first applies to the owning user of the file, the second to the  
group that owns the file, and the third to everybody else.

chmod 755 means that the user owning the directory may read/write the  
directory (7), but everybody else may only read it (5 for group, 5 for  
others).

To find out the owning user/group of a file use ls -l:

drwxr-xr-x 4 jk users 4096 2007-01-10 11:09 index

here the permissions are shown as ‘rwx’ (7) or ‘r-x’ (5), and that  
the index dir belongs to the user named ‘jk’ and the group ‘users’.  
So to the user ‘jk’ the first set of permissions applies. To anybody  
else who is not ‘jk’, but a member of the ‘users’ group, the second set  
applies, and to everybody else the third one.

To find out who’s running your mongrel, use the ps command:

$ ps aux |grep mongrel

the u option tells ps to show the user running each process in the first  
column of the output. Grep is only used to filter the process list,  
might be you have to grep for something else (i.e. ruby) if you don’t  
find your server by grepping for mongrel.

Say the username your mongrel runs as is ‘www’, then change the  
ownership of your index directory and all containing files like that:

chown -R www index/

Jens

–  
Jens Krämer  
webit! Gesellschaft für neue Medien mbH  
Schnorrstraße 76 | 01069 Dresden  
Telefon +49 351 46766-0 | Telefax +49 351 46766-66  
removed\_email\_address@domain.invalid | [www.webit.de](http://www.webit.de)

Amtsgericht Dresden | HRB 15422  
GF Sven Haubold, Hagen Malessa

---

<div class="post-metadata">

**Author:** ![pimpmaster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/b9e5f3/32.png) [@pimpmaster](https://www.ruby-forum.com/u/pimpmaster)\
**Post date:** [May 16, 2007, 3:05pm UTC](https://www.ruby-forum.com/t/aaf-quirks-in-production-mode/104229/13 "2007-05-16T15:05:23Z")

</div>

Cheers Jens!

I got everything working off DRB as advertised. 🙂

AAF is the bomb!
