PapayaSoft - Phuket web development

Custom Chmod Permissions During Octopress Deploy via Rsync

| Comments

So, today my blog/site started throwing 500 errors on every page. Actually, it might have been doing it for a while; I’ve been crazy busy lately, so haven’t checked. Need to get some automatic monitoring set up. But I only noticed it today.

A quick check of the error log shows that there was some file permission issue. My host requires that directories have permission 755 and files have permission 644. Somehow the deployed files were not getting that.

As noted in a prior post, I am using Octopress and deploying using the rsync functionality inside Octopress’s rake deploy. Clearly, rsync was not being informed of the directory/file permission requirements.

A quick search gave me the required permission syntax for rsync:

1
--chmod=Du=rwx,Dg=rx,Do=rx,Fu=rw,Fg=r,Fo=r

[As a side note: Look at how beautiful that syntax is. It clearly exposes the granularity of the three user groups, the three permission levels, and the different handling between directories and files. Commandline rocks! :D ]

Even better, Octopress is smart enough to provide a place in the Rakefile to add these params:

1
rsync_args     = "--chmod=Du=rwx,Dg=rx,Do=rx,Fu=rw,Fg=r,Fo=r"

Added this, ran a rake deploy and all cool.

Comments