hi,
I tried out today, but it doesn't seem to pull down the code from the
parameterized branch names. This is what i have for the deploy_revision:
deploy_revision "/opt/mount/#{node[:application_name]}" do
repo "#{node[:application_repo]}"
user "deployer"
branch "node.chef_environment"
keep_releases 10
action :deploy
migrate false
symlink_before_migrate.clear
create_dirs_before_symlink
purge_before_symlink.clear
symlinks.clear
symlinks {}
notifies :restart, "service[abc]"
end
I have 4 environments (dev, test, staging & production) and i am trying to
make "deploy_revision" to deploy the codes from the specific remote branch
to the specific environment.
And the branches on the repo are:
$ git branch -a
- (detached from origin/test)
master
remotes/origin/HEAD -> origin/master
- remotes/origin/dev*
remotes/origin/master
- remotes/origin/production*
- remotes/origin/staging*
- remotes/origin/test*
To test it, i pushed a new code to the master. Then merge that the 'dev'
branch.
HEAD is now at 63c6388... version change
The below shows that the other 3 remote branches are behind or not in par
with the dev.
$ git checkout origin/test
Previous HEAD position was 63c6388... version change
HEAD is now at ad262df...
$ git checkout origin/staging
HEAD is now at ad262df...
$ git checkout origin/production
HEAD is now at ad262df...
But strange that, when i run chef-client : the code version are same on
dev, stage and prod .. while test have a different version. The deploy job
says "upto date" in test environment.
On Tue, Apr 7, 2015 at 1:51 PM, Daniel DeLeo dan@kallistec.com wrote:
On Tuesday, April 7, 2015 at 1:30 PM, niristotle okram wrote:
i just noticed 'branch' as an attribute. So, i added the line for the
branch like this:
deploy_revision "/opt/mount/#{node[:application_name]}" do
repo "#{node[:application_repo]}"
user "deployer"
branch "node.chef_environment"
keep_releases 10
action :deploy
migrate false
symlink_before_migrate.clear
create_dirs_before_symlink
purge_before_symlink.clear
symlinks.clear
symlinks {}
notifies :restart, "service[abc]"
end
Does this look good and was this attribute designed for this. My test
nodes are in a freeze state & hence i am unable to test out
That will work the way you want.
As for whether you should do code deployments with chef, it’s a
complicated topic. To some degree, your application code and infra code are
coupled, as the point of the infra code is to get you a system that can
correctly run your app code. Since your app code will have different
requirements over time (need different versions of your VM, supporting
libraries, etc.), it makes sense to develop and publish them together. The
downside is that deployment of new code is harder to orchestrate, since you
normally want chef to run on an interval to ensure your config is up to
date. Which means you need to be okay with deployments happening over a
longer timespan, or add some orchestration component (at small enough scale
this can just be knife ssh) to force chef-client runs to occur. Another
downside is that chef-client runs involve idempotency checks for all the
components beneath your app, which in turn means that your deploys can fail
if your other cookbooks depend on an unrelated external resource (like an
apt mirror or something) that happens to be down. Also, chef-client will
spend time running ohai and doing idempotency checks on other resources
before it deploys your application, so it will be slower than using a
different tool. This can be mitigated with override run lists, but there
are some rough edges to those.
HTH,
--
Daniel DeLeo
--
Regards
nirish okram