bootleg icon indicating copy to clipboard operation
bootleg copied to clipboard

Hot upgrade support

Open edimoldovan opened this issue 8 years ago • 11 comments

It seams that rollup updates are not supported. Any intention on supporting them?

edimoldovan avatar Nov 09 '17 16:11 edimoldovan

Thanks for getting in touch @edimoldovan. I'm not sure exactly what you mean by a rollup update in this context. Can you give us a bit more details on what you are trying to accomplish please?

holetse avatar Nov 10 '17 20:11 holetse

He probably means hot upgrade releases where you do not stop the servers. But just upgrade the code. Was the first thing I noticed too when looking at this tool.

nulian avatar Nov 24 '17 14:11 nulian

Sorry for the late reply. Indeed, I meant hot upgrades. This is script I used for building locally (on a mac) and deploying and running on a debian machine:

./node_modules/brunch/bin/brunch b -p && MIX_ENV=prod mix do phoenix.digest, release --env=prod --upgrade
rsync -r _build/prod/rel/web/releases/$1/web.tar.gz root@<ip>:/var/www/<folder>/web/run/releases/$1/
ssh root@<ip> <<'ENDSSH'
cd /var/www/<folder>/web/run; bin/web migrate; bin/web upgrade 0.0.7
ENDSSH

Might look a bit primitive, but it was efficient.

edimoldovan avatar Nov 26 '17 10:11 edimoldovan

Thanks for the clarification! We are currently gauging community interest around support for hot upgrades, but we don’t have a specific timeline/milestone for when we will support them. We’d welcome any contributions in that direction.

holetse avatar Nov 27 '17 17:11 holetse

The functionality shown in the snippet above can be reproduced in Bootleg using its remote macro:

use Bootleg.DSL

role :app, "example.com", workspace: "/opt/app"

task :hot_upgrade do
  vsn = config(:version)
  remote :app do
    "./bin/web migrate"
    "./bin/web upgrade #{vsn}"
  end
end
$ mix bootleg.invoke hot_upgrade

You can also hook into the existing build and deployment tasks, or override the update task.

I think we can safely close this issue. Thoughts?

rjanja avatar Oct 23 '18 23:10 rjanja

I've just written some new tasks for supporting Distillery 2.1 hot upgrades:

bootleg.build_upgrade build the app by calling distillery.release --upgrade, i.e. producing the relup file bootleg.deploy_upgrade setup the release for upgrading bootleg.hot_upgrade upgrade the running release without stopping it with the last deployed release

bootleg.upgrade packs all previous steps together

if you think they can be useful, I can submit a PR

guidotripaldi avatar Jul 18 '19 14:07 guidotripaldi

Hi @guidotripaldi ! Yes, that sounds very useful! I'm happy to help with the functional tests if you'd like to open a PR. Thanks!

rjanja avatar Jul 18 '19 15:07 rjanja

Fine, thank you! Maybe it is better I wait for you merge PR #300 to master before I set up the PR, so it will be based on an already distillery_2.1-ready Bootleg version

guidotripaldi avatar Jul 18 '19 15:07 guidotripaldi

In the meantime I've upload the hot_upgrade branch on github, try to check if it could be ok at https://github.com/guidotripaldi/bootleg/tree/hot_upgrade

guidotripaldi avatar Jul 19 '19 10:07 guidotripaldi

That looks great @guidotripaldi. The distillery 2.1.0 changes have now been merged into master. Thanks!

rjanja avatar Jul 19 '19 23:07 rjanja

I've just submitted the PR #305 adding a hopefully useful sort of mini tutorial for the new tasks. Please let me know about the functional tests :)

guidotripaldi avatar Jul 23 '19 15:07 guidotripaldi