Running Rake Tasks


You can choose to run your rake tasks automatically or manually. Running them automatically involves either scheduling them by using the rake task add-on or by using deploy hooks. Alternatively, you can run them manually on your server. This guide will walk you through each of these.


Read more about the rake task add-in in the documentation.

Deployment hooks

You can use deploy hooks to execute your rake task at any point of your deployment.

Simply add a bash script to your stack that contains the rake task: for example, create the file /.cloud66/scripts/ as below:

bundle exec rake your:task

Then, add a deploy_hook to execute the above script on each deploy: create the file .cloud66/deploy_hooks.yml as below:

    - source: /.cloud66/scripts/
      destination: /tmp/
      target: rails
      execute: true
      run_on: all_servers
      apply_during: all
      sudo: true


This is done by starting a terminal connection to your server and executing your rake task.

$ bundle exec rake your:task