cookbook 'capish', '= 0.3.0'
capish (7) Versions 0.3.0 Follow0
Simple Capistrano-like code deployment.
cookbook 'capish', '= 0.3.0', :supermarket
knife supermarket install capish
knife supermarket download capish
capish
Capish is a simple cookbook for deploying code from git repositories a la
Capistrano. A repo is set up to track a remote branch, and deploys a new
clone when a new commit is detected.
Rollbacks are not supported; to roll back to an earlier version
of the code, force push to your remote branch or use tags instead. New
checkout directories are created both to encourage maintaining a stateless
app and to abandon any existing cached files like compiled scripts and
stylesheets, etc. so they can be rebuilt in a fresh directory.
If automatically tracking a branch isn't your thing, you can use hashes
or tags instead. Triggering a code deployment is as simple as updating your
cookbook recipe to use the new revision/tag.
Capish uses the git gem to interact with local and remote repositories.
Example
capish_repo 'my repo' do repository 'https://github.com/paulholden2/capish' deploy_key '<your SSH private key here>' checkout_alias 'staging' destination '/var/www/capish' branch 'deploy' action :checkout, :deploy # See "About :deploy" below end
capish_repo
Properties
Property | Type | Required | Default | Description |
---|---|---|---|---|
repository | String | Yes | Your remote repository's URL. | |
deploy_key | String | No | The deploy SSH key to use when accessing the repository. | |
destination | String | Yes | The target directory for deployment. | |
checkout_alias | String | No | next | The alias for checkouts, used as the working directory for tasks before the :deploy action is executed. |
branch | String | No | Which branch to check out. If not defined, you must define a tag or commit hash. | |
tag | String | No | Which tag to check out. If not defined, you must define a branch or commit hash. | |
commit | String | No | The SHA hash of the commit to deploy. If you're concerned with abbreviated hash collisions (you will most likely never have this issue), just use tags or provide the full hash value. If not defined, you must define a branch or tag. | |
user | String | No | root | The owner of the checkout directories. |
group | String | No | root | The group of the checkout directories. |
mode | String | No | 0755 | The mode to assign to checkout directories. |
timestamp_format | String | No | %Y%m%d.%H%M%S%L | What format to use when creating checkout directories. |
timestamp | Time | No | Time.now |
The timestamp for the deployment. Default is the time of resource definition. |
Actions
Action | Default | Description |
---|---|---|
checkout | Yes | Runs the clone action, then checks out the most recent revision in your branch, or at your tag. |
clone | No | Clones the repo if it doesn't already exist. |
deploy | No | Create the current symlink in the destination directory, to the checkout. Does nothing if no checkout was created. |
unstage | No | Removes the checkout directory and checkout alias symlink. This action does not roll back the local repo to the previous revision. You will have to push a new commit to your branch or update your tag with fixes to trigger another checkout. Execute this action if e.g. your build task fails. |
About :deploy
You will have to notify your capish_repo resource with the
:deploy
action before your code is actually deployed. This is not done
automatically both to prevent deploying code that needs build tasks to run,
and to avoid deploying a failed build. Typically you will do something
like:
capish_repo 'my repo' do # Repo configuration ... notifies :build, 'other[resource]' end other 'resource' do # Doing my build here ... notifies :deploy, 'capish_repo[my repo]' end
License
Capish is licensed under the ISC license. See the LICENSE file for details.
Dependent cookbooks
This cookbook has no specified dependencies.
Contingent cookbooks
There are no cookbooks that are contingent upon this one.
capish CHANGELOG
This file is used to list changes made in each version of the capish cookbook.
Collaborator Number Metric
0.3.0 failed this metric
Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.
Contributing File Metric
0.3.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Foodcritic Metric
0.3.0 passed this metric
No Binaries Metric
0.3.0 passed this metric
Testing File Metric
0.3.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
0.3.0 passed this metric
0.3.0 failed this metric
0.3.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Foodcritic Metric
0.3.0 passed this metric
No Binaries Metric
0.3.0 passed this metric
Testing File Metric
0.3.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
0.3.0 passed this metric
0.3.0 passed this metric
0.3.0 passed this metric
Testing File Metric
0.3.0 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
0.3.0 passed this metric
0.3.0 failed this metric
0.3.0 passed this metric