dev-master
9999999-devDeploy plugin for Z
MIT
The Requires
by Gerard van Helden
2.0.0-beta.1
2.0.0.0-beta1Deploy plugin for Z
MIT
The Requires
by Gerard van Helden
Deploy plugin for Z
This plugin provides tasks to build and deploy the current project:, (*1)
deploy
task to build and deploy the project to a specific environmentsimulate
task to build and simulate a deploy of the project against a specific environmentredeploy
task to rebuild and redeploy the version of the project currently on a specific environmentpatch
task to patch a specific environmentunpatch
task to revert a patch on a specific environmentqdeploy
task to build the project and patch a specific environmentqsimulate
task to build the project and simulate patching a specific environmentSee the documentation for zicht/z
for more information on how to install Z
with plugins., (*2)
NOTE this setup requires a few other plugins. You are not required to use those, but this is what a typical setup would look like (following this deployment scheme)., (*3)
The general approach for this implementation is:, (*4)
build
directory (git
plugin handles this)build
's post
trigger (common Z functionality, you can hook into any task
like this)rsync
plugin handles this)deploy
's post
trigger.The deploy
plugin also provides a simulate
task, which creates a build and runs
the rsync
with a --dry-run
flag, so you can see what would be synced., (*5)
By default, the rsync
plugin expects you to add an rsync file to your project:, (*6)
echo ".git/" >> ./rsync.exclude git add rsync.exclude git commit -m"add rsync.exclude" ./rsync.exclude
Then, you will require a z file in your project:, (*7)
plugins: ['env', 'build', 'deploy', 'git', 'rsync'] envs: prod: ssh: myuser@prod-machine root: ~/my-project-path web: public # the relative path to the public web folder within the project path tasks: build: post: - echo "I am just adding a random file here" >> $(path(build.dir, "foo.html")) deploy: post: - echo "Thank you, come again"
If you explain the deploy, you would see every step being explained in bash. Read more
about what --explain
does in the documentation for Z., (*8)
$ z --explain deploy prod echo 'echo "Checking out version foo to ./build";' | /bin/bash -e echo 'git clone . ./build' | /bin/bash -e echo 'cd ./build && git checkout foo' | /bin/bash -e echo 'cd ./build && git log HEAD -1 > .z.rev' | /bin/bash -e echo 'echo "I am just adding a random file here" >> ./build/foo.html' | /bin/bash -e echo 'rsync \ \ -rpcl --delete \ --exclude-from=./build/rsync.exclude \ -v \ ./build/ myuser@production-machine:~/my-project-path/ \ ;' | /bin/bash -e echo 'echo "Thank you, come again"' | /bin/bash -e
As you can see, each line within this explanation reflects a step in the build process., (*9)
Now, you can also simulate the deploy, which would execute everything except
for the deploy post
triggers:, (*10)
z simulate prod
And if that succeeds:, (*11)
z deploy prod
z env:ssh prod
. It
is advisable to publish your key to the remote using z env:ssh-copy-id
prod
you you can access the remote passwordless.env
tries to open the ssh session within
the remote directory. Use this to check your setup: z env:ssh prod pwd
(or leave out pwd
to run it interactively).Note that you can always use --explain
to introspect what the plugins and/or
Z try to do. To get even more information, you can combine --explain
and
--debug
, you can see where certain task lines originate from., (*12)
Deploy plugin for Z
MIT
Deploy plugin for Z
MIT