at koumbit our internal best practise is to create an aegir site node using the canonical site name (e.g. foo.com) with an alias using our local wildcard DNS (e.g. foo.com.sites.koumbit.net) during development. to make a site live we just need to change the appropriate DNS record. however, aegir currently only runs cron.php on the canonical name. but since aegir did exec wget (getting an 302 response), the site node shows that cron was run. there are a few problems here:
* aegir gives a false positive without actually checking the HTTP response code
* cron is never run for our staging sites
* using an external program like wget adds an unnecessary dependency and makes it difficult to extract the HTTP response code and debug other possible cron problems

after talking with anarcat, i suggest that aegir iterate over the site aliases if cron.php returns something other than 200. if none of those work, then the timestamp variable should not be updated, and an error should be logged via watchdog. in order to detect the return code and to avoid the dependency, this should all be done via drupal_http_request().

related issues:
* #1143068: Allow cron.php in nginx configuration so that wget works out of the box
* #1090678: wget cron method broken for d7 sites

Comments

anarcat’s picture

Status: Active » Needs review

I just pushed [e7533a5] to 2.x to switch to using drupal_http_request() and update the timestamp only if it works.

I'll test this in staging now and merge it in 1.x if it actually works.

Then we can look at aliases iteration (maybe?)...

anarcat’s picture

531837f602a4803678bed73e1433715710686470 adds feedback in --debug output, seems to work fine in staging, merging in 1.x.

anarcat’s picture

Status: Needs review » Needs work

Alright, patch is merged. Now we need to think about whether or not we want to iterate over all the aliases if the canonical host fails...

Opinions?

anarcat’s picture

Project: Provision » Hostmaster (Aegir)
Version: 6.x-1.1 » 6.x-0.4-alpha3
Priority: Normal » Major
mvc’s picture

i vote yes, but wouldn't say it's a high priority.

anarcat’s picture

cashwilliams’s picture

I think it should iterate over the aliases, as long as it stops on the first one that works.

omega8cc’s picture

This adds some overhead - sometimes serious of you have 30 aliases to check per site. I don't like this idea and vote no.

Instead, if any of your site's name doesn't resolve to the server IP for any reason, you should use the old standard - drush method instead of wget.

j0nathan’s picture

Subscribing.

steven jones’s picture

Version: 6.x-0.4-alpha3 » 6.x-1.x-dev
Assigned: Unassigned » anarcat

I think we should leave it as is, and mark fixed. Assigning to Anarcat for the decision.

steven jones’s picture

Assigned: anarcat » Unassigned

If someone wants to work on this, here's a good way to progress this issue:

  1. Add a new hook that is called during the cron invocation process to determine which actual URL will be called by wget
  2. Ensure that if this hook isn't implemented then the existing behaviour is preserved.
  3. (Optional) Make a reference implementation in a contrib module, that simply allows someone to choose which of the site's possible URLs it's cron hook should be invoked on.
anarcat’s picture

Status: Needs work » Fixed

So far the feedback we got here is that we should avoid looping over aliases. It's all stuff that can be worked around anyways, and we got proper feedback on failure now. So I think we should just close this issue now - if someone really wants to do some crazy stuff with cron, it can be done with an external tool. Also consider #1145388: Replace cron (and scheduled tasks) system in 2.x.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

  • Commit e7533a5 on 7.x-2.x, dev-ssl-ip-allocation-refactor, dev-1205458-move_sites_out_of_platforms, 7.x-3.x, dev-588728-views-integration, dev-1403208-new_roles, dev-helmo-3.x by anarcat:
    rewrite wget cron with drupal_http_request
    
    the latter is faster (no...

  • Commit e7533a5 on 7.x-2.x, dev-ssl-ip-allocation-refactor, dev-1205458-move_sites_out_of_platforms, 7.x-3.x, dev-588728-views-integration, dev-1403208-new_roles, dev-helmo-3.x by anarcat:
    rewrite wget cron with drupal_http_request
    
    the latter is faster (no...