Open mbopp opened 11 years ago
Hi,
Which version of chef are you using ?
chef 11.6
There is a compatibility issue whith chef in the application_java cookbook. We've made a patch but I don't think we have released it. I'll look into it.
Thank You!
I found the fork by youscribe https://github.com/Youscribe/application_java-cookbook... I'll give it a try.
@mbopp I think you must try test branch... But not sure.. sorry
I have the same NoMethodError as described above. I tried following versions of application_java:
always with the same error.
@kYann : have you found a patch? @mbopp : have you found a solution for this problem?
@kYann @mbopp Hi folks, any updates about this issue? Did anyone who write application_java cookbook try to execute it?
Hi,
The application_java original cookbook is a real mess and is not compatible with chef 11.6. We made a fix and used it in production. The fix is available in this branch https://github.com/Youscribe/application_java-cookbook/tree/test
You should try it.
@kYann Thanks, and could you write small example how to deploy sample war file? if I use examples from Readme file - I get error "No resource found for tomcat. Tried application_tomcat, application_java_tomcat, tomcat" but I have this recipe, and install Tomcat via this recipe
EDIT: Anyone in the same boat can use remote_file to download file locally (eg /opt/repo/latest/my.war) and then deploy application using scm_provider Chef::Provider::File::Deploy and reference your local repository file (eg /opt/repo/latest/my.war).
ORIGINAL POST: I'm using chef 11.10.4 and the patched version of application_java-cookbook-test as referenced above. Deployments with scm_provider Chef::Provider::RemoteFile::Deploy fail on first clean deployment with "chef-client is confused, trying to deploy a file that has no path or does not exist..." or subsequent deployments with "Errno::ENAMETOOLONG". Deployments with scm_provider Chef::Provider::File::Deploy are successful.
Any insight would be greatly appreciated.
Relevant output below:
When I deploy an application using scm_provider Chef::Provider::RemoteFile::Deploy, it fails on first deployment with error:
- change owner from '' to 'tomcat7'
- change group from '' to 'tomcat7'
- purge old downloads[2014-03-15T12:07:42-07:00] WARN: Error on deploying /var/lib/mycompany/api/deploy/locator/releases/[#<MonoLogger:0x000000025eede8 @progname=nil, @level=2, @default_formatter=#<Logger::Formatter:0x000000025eedc0 @datetime_format=nil>, @formatter=#<Mixlib::Log::Formatter:0x000000025eec08 @datetime_format=nil>, @logdev=#<MonoLogger::LocklessLogDevice:0x000000025eed70 @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<IO:<STDOUT>>>>]: chef-client is confused, trying to deploy a file that has no path or does not exist...
- remove failed deploy /var/lib/mycompany/api/deploy/locator/releases/[#<MonoLogger:0x000000025eede8 @progname=nil, @level=2, @default_formatter=#<Logger::Formatter:0x000000025eedc0 @datetime_format=nil>, @formatter=#<Mixlib::Log::Formatter:0x000000025eec08 @datetime_format=nil>, @logdev=#<MonoLogger::LocklessLogDevice:0x000000025eed70 @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<IO:<STDOUT>>>>]
================================================================================
Error executing action `deploy` on resource 'deploy_revision[locator]'
================================================================================
RuntimeError
------------
chef-client is confused, trying to deploy a file that has no path or does not exist...
Cookbook Trace:
---------------
/var/chef/cache/cookbooks/application_java-cookbook-test/libraries/provider_remote_file_deploy.rb:49:in `action_sync'
Resource Declaration:
---------------------
# In /var/chef/cache/cookbooks/application/providers/default.rb
130: @deploy_resource = send(new_resource.strategy.to_sym, new_resource.name) do
131: action force ? :force_deploy : :deploy
132: scm_provider new_resource.scm_provider
133: revision new_resource.revision
134: repository new_resource.repository
135: enable_submodules new_resource.enable_submodules
136: user new_resource.owner
137: group new_resource.group
138: deploy_to new_resource.path
139: ssh_wrapper "#{new_resource.path}/deploy-ssh-wrapper" if new_resource.deploy_key
140: shallow_clone new_resource.shallow_clone
141: rollback_on_error new_resource.rollback_on_error
142: all_environments = ([new_resource.environment]+new_resource.sub_resources.map{|res| res.environment}).inject({}){|acc, val| acc.merge(val)}
143: environment all_environments
144: migrate new_resource.migrate
145: all_migration_commands = ([new_resource.migration_command]+new_resource.sub_resources.map{|res| res.migration_command}).select{|cmd| cmd && !cmd.empty?}
146: migration_command all_migration_commands.join(' && ')
147: restart_command do
148: ([new_resource]+new_resource.sub_resources).each do |res|
149: cmd = res.restart_command
150: if cmd.is_a? Proc
151: version = Chef::Version.new(Chef::VERSION)
152: provider = if version.major > 10 || version.minor >= 14
153: Chef::Platform.provider_for_resource(res, :nothing)
154: else
155: Chef::Platform.provider_for_resource(res)
156: end
157: provider.load_current_resource
158: provider.instance_eval(&cmd)
159: elsif cmd && !cmd.empty?
160: execute cmd do
161: user new_resource.owner
162: group new_resource.group
163: environment all_environments
164: end
165: end
166: end
167: end
Compiled Resource:
------------------
# Declared in /var/chef/cache/cookbooks/application/providers/default.rb:130:in `run_deploy'
deploy_revision("locator") do
provider Chef::Provider::Deploy::Revision
action [:deploy]
retries 0
retry_delay 2
deploy_to "/var/lib/mycompany/api/deploy/locator"
repository_cache "cached-copy"
revision "HEAD"
rollback_on_error true
remote "origin"
shallow_clone true
scm_provider Chef::Provider::RemoteFile::Deploy
keep_releases 5
enable_checkout true
checkout_branch "deploy"
cookbook_name "api_app"
repo "http://jenkins.mycompany.com:8080/job/RELEASE/lastSuccessfulBuild/artifact/locator/target/locator.war"
user "tomcat7"
group "tomcat7"
restart_command #<Proc:0x00000002f48038@/var/chef/cache/cookbooks/application/providers/default.rb:147>
before_migrate #<Proc:0x00000002f4ce80@/var/chef/cache/cookbooks/application/providers/default.rb:174>
before_symlink #<Proc:0x00000002f4cc28@/var/chef/cache/cookbooks/application/providers/default.rb:177>
before_restart #<Proc:0x00000002f4c958@/var/chef/cache/cookbooks/application/providers/default.rb:180>
after_restart #<Proc:0x00000002f4c688@/var/chef/cache/cookbooks/application/providers/default.rb:183>
shared_path "/var/lib/mycompany/api/deploy/locator/shared"
destination "/var/lib/mycompany/api/deploy/locator/shared/cached-copy"
current_path "/var/lib/mycompany/api/deploy/locator/current"
end
All subsequent chef-client runs fail with error:
* deploy_revision[locator] action deploy
- purge old downloads
- purge old downloads
- force ownership of /var/lib/mycompany/api/deploy/locator to tomcat7:tomcat7[2014-03-15T12:19:57-07:00] WARN: Error on deploying /var/lib/mycompany/api/deploy/locator/releases/[#<MonoLogger:0x00000003ab38c8 @progname=nil, @level=2, @default_formatter=#<Logger::Formatter:0x00000003ab38a0 @datetime_format=nil>, @formatter=#<Mixlib::Log::Formatter:0x00000003ab3738 @datetime_format=nil>, @logdev=#<MonoLogger::LocklessLogDevice:0x00000003ab3878 @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<IO:<STDOUT>>>>]: File name too long - /var/lib/mycompany/api/deploy/locator/releases/[#<MonoLogger:0x00000003ab38c8 @progname=nil, @level=2, @default_formatter=#<Logger::Formatter:0x00000003ab38a0 @datetime_format=nil>, @formatter=#<Mixlib::Log::Formatter:0x00000003ab3738 @datetime_format=nil>, @logdev=#<MonoLogger::LocklessLogDevice:0x00000003ab3878 @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<IO:<STDOUT>>>>]
- remove failed deploy /var/lib/mycompany/api/deploy/locator/releases/[#<MonoLogger:0x00000003ab38c8 @progname=nil, @level=2, @default_formatter=#<Logger::Formatter:0x00000003ab38a0 @datetime_format=nil>, @formatter=#<Mixlib::Log::Formatter:0x00000003ab3738 @datetime_format=nil>, @logdev=#<MonoLogger::LocklessLogDevice:0x00000003ab3878 @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<IO:<STDOUT>>>>]
================================================================================
Error executing action `deploy` on resource 'deploy_revision[locator]'
================================================================================
Errno::ENAMETOOLONG
-------------------
File name too long - /var/lib/mycompany/api/deploy/locator/releases/[#<MonoLogger:0x00000003ab38c8 @progname=nil, @level=2, @default_formatter=#<Logger::Formatter:0x00000003ab38a0 @datetime_format=nil>, @formatter=#<Mixlib::Log::Formatter:0x00000003ab3738 @datetime_format=nil>, @logdev=#<MonoLogger::LocklessLogDevice:0x00000003ab3878 @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<IO:<STDOUT>>>>]
Deploying with scm_provider Chef::Provider::File::Deploy works fine.
Using test-kitchen with chef-zero & application_java v. 3.0.0, I ran into a similar problem when provisioning.
https://github.com/poise/application_java/issues/9#issuecomment-42449323
I am continuing to run into the following error on ubuntu 10.04 LTS. I don't believe I WAS getting this error, so something in the environment must have changed? Below is a copy of the relevant output.
Are you able to see what is going on here. I apologize in advance if this is not a bug.