after_migrate deploy_revision hook


#1

Hi fellas!

I’m having an issue while deploying a Rails 3.2 app when it comes to precompiling assets rake command.

If I put this in before_migrate block, it blows up coz the command rake assets:precompile requires the database.yml file populated and migration already done.

It won’t be a problem if the deploy resource has after_migrate hook, which chef doesn’t have right now.

So, how can I add such hook or is there any other hooks that I can use?


@millisami
~ Sachin Sagar Rai
Ruby on Rails Developer
http://tfm.com.np
http://nepalonrails.tumblr.com
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)


#2

On Sat, Mar 31, 2012 at 4:54 PM, Sachin Sagar Rai millisami@gmail.com wrote:

Hi fellas!

I’m having an issue while deploying a Rails 3.2 app when it comes to
precompiling assets rake command.

If I put this in before_migrate block, it blows up coz the command rake assets:precompile requires the database.yml file populated and migration
already done.

It won’t be a problem if the deploy resource has after_migrate hook, which
chef doesn’t have right now.

So, how can I add such hook or is there any other hooks that I can use?

You could use the ‘before_symlink’ one, which is used after the migration.
But I also was missing an ‘after_migrate’ hook…

Cheers


Juanje


#3

Thanks!

Though, having the after_migrate hook would be great.


@millisami
~ Sachin Sagar Rai
Ruby on Rails Developer
http://tfm.com.np
http://nepalonrails.tumblr.com
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

On Saturday, March 31, 2012 at 11:41 PM, Juan Jesús Ojeda Croissier wrote:

On Sat, Mar 31, 2012 at 4:54 PM, Sachin Sagar Rai <millisami@gmail.com (mailto:millisami@gmail.com)> wrote:

Hi fellas!

I’m having an issue while deploying a Rails 3.2 app when it comes to
precompiling assets rake command.

If I put this in before_migrate block, it blows up coz the command rake assets:precompile requires the database.yml file populated and migration
already done.

It won’t be a problem if the deploy resource has after_migrate hook, which
chef doesn’t have right now.

So, how can I add such hook or is there any other hooks that I can use?

You could use the ‘before_symlink’ one, which is used after the migration.
But I also was missing an ‘after_migrate’ hook…

Cheers


Juanje


#4

@juan,
Actually that doesn’t solve the issue but rather raises another issue.

When I deployed, the issue is weird. If I run the asset compilation task inside the before_symlink..., it deletes the current symlink resulting in an error app['deploy_to']/current doesn't exist. And it makes sense as well since placing inbefore_symlink` is the action to take before the symlink happens.

So, that hook doesn’t help either.
Anyone who have deployed any rails 3.1+ app using the asset pipeline and where to hook the rake asset precompilation task?


@millisami
~ Sachin Sagar Rai
Ruby on Rails Developer
http://tfm.com.np
http://nepalonrails.tumblr.com
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

On Sunday, April 1, 2012 at 1:24 AM, Sachin Sagar Rai wrote:

Thanks!

Though, having the after_migrate hook would be great.


@millisami
~ Sachin Sagar Rai
Ruby on Rails Developer
http://tfm.com.np
http://nepalonrails.tumblr.com
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

On Saturday, March 31, 2012 at 11:41 PM, Juan Jesús Ojeda Croissier wrote:

On Sat, Mar 31, 2012 at 4:54 PM, Sachin Sagar Rai <millisami@gmail.com (mailto:millisami@gmail.com)> wrote:

Hi fellas!

I’m having an issue while deploying a Rails 3.2 app when it comes to
precompiling assets rake command.

If I put this in before_migrate block, it blows up coz the command rake assets:precompile requires the database.yml file populated and migration
already done.

It won’t be a problem if the deploy resource has after_migrate hook, which
chef doesn’t have right now.

So, how can I add such hook or is there any other hooks that I can use?

You could use the ‘before_symlink’ one, which is used after the migration.
But I also was missing an ‘after_migrate’ hook…

Cheers


Juanje