Auto deploy and deploy event.

adrien's Avatar

adrien

20 Jan, 2012 10:40 AM via web

I have a cloud with a PHP Application role, and i'm deploying a Symfony2 app.

I have created a symfony2 cookbook, with 2 recipes: configure and deploy.
Indeed the deploy recipe should be executed when the app is deployed and the configure recipe each time something change in the cloud, and at deploy.

Here's what i have set on the Custom recipes tab of my PHP role:
Configure event: symfony2::configure
Deploy event: symfony2::configure, symfony2::deploy

When i have a running instance, and deploy my application, everything runs fine.

But when i create a new instance and boot it, the code is checked out, but my recipes are not called.
If i add symfony2::configure, symfony2::deploy to the setup event, my recipes fail as they are called before the code is checked out.

So i'd like to know how i could execute my 2 recipes, at boot, after my code is checked out.

Thanks for you help guys

  1. Support Staff 2 Posted by Jonathan Weiss on 25 Jan, 2012 10:33 AM

    Jonathan Weiss's Avatar

    Unfortunately the way the setup currently works is by always doing our deployment at the end. Changing that would break a lot of existing setups. We will change that behavior in the future and offer an explicit upgrade path.

    What do you need to run in symfony2::deploy? You can also leverage deploy hooks in the deploy/ directory, see http://wiki.opscode.com/display/chef/Deploy+Resource#DeployResource...

  2. 3 Posted by adrien on 26 Jan, 2012 01:50 PM

    adrien's Avatar

    I've been able to run what i had on the auto deploy with the deploy/before_symlink.rb hook.
    But my configure recipes, that should run on the setup event, fail because the /src/www/{app}/shared/config dir is not yet created.

    I guess i'll have to deploy manually each time i create a new instance.

  3. Support Staff 4 Posted by Jonathan Weiss on 28 Jan, 2012 07:33 AM

    Jonathan Weiss's Avatar

    If you remove your configure recipe from setup but leave it on configure you should be good. After a successful setup all instances in a cluster get a configure, including the one just booted. So all your configuration should be correct and you don't need to manually deploy.

  4. 5 Posted by adrien on 31 Jan, 2012 10:54 AM

    adrien's Avatar

    How can i execute my custom recipes (or definitions) from the callbacks ?

Reply to this discussion

Internal reply

Formatting help or Preview

Attached Files

You can attach files up to 10MB

How many minutes are in an hour?

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.