Closed louisl closed 5 years ago
You can set arbitrary commands to run at certain points in the deployment process.
In your config/deploy.rb
file:
namespace :deploy do
after :updated, :migrate do
on roles(:all) do
within release_path do
execute :php, :artisan, :migrate, fetch(:laravel_artisan_flags), '--force'
end
end
end
end
Thanks for the info.
was in a rush the other day, but to give a bit more information around what this solution does:
in the following snippet:
after :updated, :migrate do
after
or before
:updated
is the name of the event you want to run this task relative to:migrate
is the new name of this event that you are definingSo you could then have:
before :migrate, :sometask do
# something to run before migrations ...
end
Pretty much the only two events i've ever used are:
after :updated
- once the code is on the server, and the basic tasks have been done, but before the new release is liveafter :published
- once the new release has been symlinked to be the current releaseThe default capistrano hooks are here - https://capistranorb.com/documentation/getting-started/flow/ if you want more. This capistrano/laravel package has its own event hooks too (the ones starting with laravel: in https://github.com/capistrano/laravel#tasks)
Thank you for the additional info, that's given me a better understanding of it.
I have everything working nicely but I have to ssh in to run the migrations at the moment.