Craft storage dir as linked in capistrano I'm having some issues with my install of craft on a staging server.

I'm deploying using Capistrano, and (perhaps wrongly) added craft/storage to linked_dirs (to share between deployments). Since doing that, things have not been going so well with my installation. I keep get "No response" screen in the browser, (Error code: ERR_EMPTY_RESPONSE). I also get "unknown error occurred" messages when browsing round the admin doing normal things like updating entries etc.

The only consistent error is this one:

2015/03/26 17:33:53 [error] [exception.Craft\HttpException.503] exception 'Craft\HttpException' in /var/www/50th/releases/20150326171328/craft/app/etc/web/WebApp.php:916
Stack trace:
#0 /var/www/50th/releases/20150326171328/craft/app/etc/web/WebApp.php(230): Craft\WebApp-&gt;_enforceSystemStatusPermissions()
#1 /var/www/50th/releases/20150326171328/craft/app/framework/base/CApplication.php(180): Craft\WebApp-&gt;processRequest()
#2 /var/www/50th/releases/20150326171328/craft/app/index.php(62): CApplication-&gt;run()
#3 /var/www/50th/releases/20150326171328/public/index.php(19): require_once('/var/www/50th/r...')
#4 {main}
REQUEST_URI=/
---
2015/03/26 17:33:53 [error] [application]


It's worth noting that the site is in offline-mode.

Any ideas?!

Update:
I've found a consistent error message when trying to access "/admin/users":
[DOMAINNAME...]/index.php/admin/actions/elementIndex/getElements net::ERR_EMPTY_RESPONSE

Is being returned by jQuery trying to access elements. Does this help at all?
I've eventually tracked down this peculiar ERR_EMPTY_RESPONSE to a php error buried deep in my apache logs - zend_mm_heap corrupted. So as it turns out nothing to do with Capistrano (or Craft) at all! This zend_mm_heap error is a php memory error that I seem to have solved by upgrading my version of PHP after unsuccessfully upping my output_buffer as suggested in this stackoverflow thread. It's worth noting that there was nothing in the Craft log about this error, no mention of anything untoward. The Craft\HttpException I found above is, I believe, essentially a '404' error as my site was running in 'offline mode' so requests had to be run through _enforceSystemStatusPermissions.

I did initially have some issues with permissions with Capistrano where my server was setting new files created by craft to 644 www-data:www-data and therefore my user couldn't edit these files, despite being in the www-data group, and so Capistrano was having a hard time removing old releases. I've fixed this by adding a umask 002 to /etc/apache2/envvar.

Now that the zend_mm_heap error seems to be behaving, and my permissions are correct, deploying with Capistrano is working rather well. For future reference, my linked dirs config looks like this:

set :linked_dirs, %w{public/resources craft/config/local craft/storage}


public/resources is my (single) craft asset source, craft/config/local are my server-specific config files as suggested here which is working nicely for me. craft/storage is obviously the craft storage folder that is shared between releases.

In terms of deployment, I think Capistrano (and other tools of a similar ilk) is great. I'm hosting my repository in a private BitBucket account and push new changes onto the master branch. I have two stages set up :production and :staging which deploy to two different vhosts on my server (staging domain is test.domain.com).

My stage configuration looks like this (for staging)

set :stage, :staging

set :deploy_to, "/var/www/domain-test"

# Allow user to define which branch to push, e.g.
# BRANCH=my-new-feature cap staging deploy
set :branch, ENV['BRANCH'] || "staging"


This last line is really helpful if I want to quickly test something on the master branch without having to merge it into the staging branch and push and deploy.

I hope that helps someone who comes across a similar issue. If anyone wants more info about my Capistrano set up, let me know. I highly recommend it as a method of deployment, once you figure out your (inevitable and strange) server errors!