0

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->_enforceSystemStatusPermissions()
#1 /var/www/50th/releases/20150326171328/craft/app/framework/base/CApplication.php(180): Craft\WebApp->processRequest()
#2 /var/www/50th/releases/20150326171328/craft/app/index.php(62): CApplication->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 got 0 experience with Capistrano, so I can only offer some general advice. ERR_EMPTY_RESPONSE is just Chome's way of saying "I expected to get a response, but I got nothing back". Usually some fatal error occurring on the server side. Re: "unknown error occurred" - If you look i your craft/storage/runtime/logs folder for [error], then you can find the underlying error message. Also worth checking for a phperrors.log file in that same folder. – Brad Bell Mar 26 '15 at 20:10
  • Unfortunately it's not logging an error every time the "Unknown Error Occured" red box notification appears in the dashboard. It seems to be something problematic relating to /admin/actions/elementIndex/getElements - Issues mainly occurring on the index pages for entries. I think it's some sort of linux/server permissions issue, posibly to do with the storage folder... – lowe_22 Mar 26 '15 at 22:54
  • @BradBell How would you go about deploying craft then? I'm having a lot of issues with Craft amd capistrano,. I keep getting ERROR_EMPTY_REPONSE on the front end, and lots via jQuery on the backend too. Do you hve any ideas what might be causing this? Craft can read write to storage directory. I don't understand what's going on! – lowe_22 Apr 1 '15 at 10:47
  • Look at the call to getElements in your browser's console's Network tab. What's the response coming back from that request. – Brad Bell Apr 1 '15 at 17:18
2

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!

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.