How to handle one-time deployment tasks with capistrano?

I'm currently trying to automate the deployment process of our rails application as much as possible, so a clean build on the CI server can trigger automatic deployment on the test server.

But I encountered some error with the following scenario: I added a friendly_id application to the application. There is a migration that creates all the necessary tables. But to populate these tables, I need to call the rake task.

Now these rake calls need to be called only once, so adding it to your script deployment would be redundant.

Ideally, I'm looking for something like a migration, but instead of a database, it should keep track of the scripts that need to be called during deployment. Does such a beast already exist?

+5
source share
3 answers

I can’t think of anything that does exactly what you want, but if you just need to be able to run tasks on remote servers in one way, you can always use rake through capistrano.

Here is a question: How to start a rake task from Capistrano? , which also cites this article http://ananelson.com/said/on/2007/12/30/remote-rake-tasks-with-capistrano/ .

Edit: I am wondering if it is possible to create a migration that does not make any changes to the database, but simply calls the rake task? Rake::Task["task:name"].invoke. Worth trying?

+1
source

, after_party gem , .

+2

, rake friendly_id. , , ! , .

. , .

+1

All Articles