-
Notifications
You must be signed in to change notification settings - Fork 137
Deployment
Now that we have set up our environment, we can deploy our app to our staging server with the command below. deploy
exposes the stdio to us for status/debugging purposes, however is also stored on the remote as /tmp/deploy.log
using the tee
command.
$ deploy stage
○ deploying
○ hook pre-deploy
○ fetching updates
○ resetting HEAD to origin/develop
HEAD is now at bef6f20
○ executing post-deploy `./restart`
restarting
restart complete
○ successfully deployed origin/develop
If we wish to deploy a specific tagged release to stage, we could do the following:
$ deploy stage 2.3.9
The next important step, is to create a post-deploy
command, typically used to signal a restart. For example if you utilize cluster you may want the post-deploy
script at $path/restart.sh
to signal a graceful restart via SIGUSR2.
In our config we simply supply the path:
post-deploy ./current/restart.sh
or perhaps a command similar to below:
post-deploy cat ../pids/master.pid | xargs kill -s SIGUSR2
the SHARED environment variable is set when executing hooks, so the following is future-proof:
post-deploy cat $SHARED/pids/master.pid ...
Deploying our production environment is slightly different than production, in some cases vastly different. However, the following example shows how deploy
will resolve the latest tag when not explicitly provided via deploy.conf or the cli:
$ deploy production
○ deploying
○ hook pre-deploy
○ fetching updates
○ fetching latest tag
○ resetting HEAD to 2.3.11
HEAD is now at e2cdd76 Release 2.3.11
○ executing post-deploy `./restart`
restarting
restart complete
○ successfully deployed 2.3.11