Boot Hooks¶
Boot hooks are scripts which execute pre/post to events that occur in the run control script.
Events¶
pre_configure
, occurs beforeREPLACE_OS_VARS
triggers replacement, and before any generated files are generatedpost_configure
, ocurrs after environment variable replacement and after generated files are generatedpre_start
, occurs before the release is startedpost_start
, occurs right after the release is startedpre_stop
, occurs after a request to stop the release is issued, but before the release is stoppedpost_stop
, occurs after the release is stoppedpre_upgrade
, occurs before the release is upgradedpost_upgrade
, occurs right after the release is upgraded
Example Usage¶
Given a config like the following:
1 2 3 4 5 6 7 8 9 10 | use Distillery.Releases.Config environment :default do set pre_start_hooks: "rel/hooks/pre_start" set post_start_hooks: "rel/hooks/post_start" end release :myapp do set version: current_version(:myapp) end |
And the two hook scripts:
1 2 | # rel/hooks/pre_start/echo.sh echo "we're starting!" |
1 2 | # rel/hooks/post_start/echo.sh echo "we've started!" |
When you build your release, and run it, you’ll see something like the following:
1 2 3 4 5 | > _build/dev/rel/myapp/bin/myapp foreground we're starting! ...snip... we've started! ...snip... |
You have access to anything defined in the run control script environment, see Shell Scripts for details.