# remote\_file resource -- new to Chef

**URL:** <https://discourse.chef.io/t/remote-file-resource-new-to-chef/2453>\
**Category:** Chef Infra (archive)\
**Created:** [February 13, 2012, 8:03pm UTC](https://discourse.chef.io/t/remote-file-resource-new-to-chef/2453 "2012-02-13T20:03:27Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![mark\_bradley](https://avatars.discourse-cdn.com/v4/letter/m/a87d85/32.png) [@mark\_bradley](https://discourse.chef.io/u/mark_bradley)\
**Post date:** [February 13, 2012, 8:03pm UTC](https://discourse.chef.io/t/remote-file-resource-new-to-chef/2453/1 "2012-02-13T20:03:27Z")

</div>

Hi, I’m trying to copy a file on change (both files are in /tmp for now):

default.rb

default[“FOO”][“latest\_war”] = “/tmp/app.war”

default[“FOO”][“target\_war”] = “/tmp/dest.war”

My resource specification looks like this:

remote\_file node.default[“FOO”][“target\_war”] do  
action :create  
source node.default[“FOO”][“latest\_war”]  
end

When I run the Chef client I get an error:

[Mon, 13 Feb 2012 19:55:09 +0000] FATAL: Chef::Exceptions::FileNotFound:  
remote\_file[/tmp/dest.war] (XX line 65) had an error:  
Chef::Exceptions::FileNotFound: Cookbook ‘XX’ (0.0.1) does not contain a  
file at any of these locations:  
files/amazon-2011.09//tmp/app.war  
files/amazon//tmp/app.war  
files/default//tmp/app.war

Is there a way of forcing remote\_file to look outside the cookbook? Have I  
misunderstood this resource? Is there a better one to use?

Thanks,  
Mark

---

<div class="post-metadata">

**Author:** ![Bryan\_Berry](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/bryan_berry/32/213_2.png) [@Bryan\_Berry](https://discourse.chef.io/u/Bryan_Berry)\
**Post date:** [February 13, 2012, 8:38pm UTC](https://discourse.chef.io/t/remote-file-resource-new-to-chef/2453/2 "2012-02-13T20:38:08Z")

</div>

from what I can tell remote\_file only supports pulling from a url or the  
files/ subdirectory of your cookbook. Where do you get app.war from in the  
first place?

btw, if you are working on a java stack these java-related cookbooks may be  
useful to you [cookbooks/java at master · bryanwb/cookbooks · GitHub](https://github.com/bryanwb/cookbooks/tree/master/java)  
[cookbooks/tomcat at master · bryanwb/cookbooks · GitHub](https://github.com/bryanwb/cookbooks/tree/master/tomcat) (alpha)

On Mon, Feb 13, 2012 at 9:03 PM, mark bradley [gopearls42@gmail.com](mailto:gopearls42@gmail.com) wrote:

> Hi, I'm trying to copy a file on change (both files are in /tmp for now):
> 
> default.rb
> 
> default["FOO"]["latest\_war"] = "/tmp/app.war"
> 
> default["FOO"]["target\_war"] = "/tmp/dest.war"
> 
> My resource specification looks like this:
> 
> remote\_file node.default["FOO"]["target\_war"] do  
> action :create  
> source node.default["FOO"]["latest\_war"]  
> end
> 
> When I run the Chef client I get an error:
> 
> [Mon, 13 Feb 2012 19:55:09 +0000] FATAL: Chef::Exceptions::FileNotFound:  
> remote\_file[/tmp/dest.war] (XX line 65) had an error:  
> Chef::Exceptions::FileNotFound: Cookbook 'XX' (0.0.1) does not contain a  
> file at any of these locations:  
> files/amazon-2011.09//tmp/app.war  
> files/amazon//tmp/app.war  
> files/default//tmp/app.war
> 
> Is there a way of forcing remote\_file to look outside the cookbook? Have I  
> misunderstood this resource? Is there a better one to use?
> 
> Thanks,  
> Mark

---

<div class="post-metadata">

**Author:** ![mark\_bradley](https://avatars.discourse-cdn.com/v4/letter/m/a87d85/32.png) [@mark\_bradley](https://discourse.chef.io/u/mark_bradley)\
**Post date:** [February 13, 2012, 8:42pm UTC](https://discourse.chef.io/t/remote-file-resource-new-to-chef/2453/3 "2012-02-13T20:42:06Z")

</div>

The war file is copied into /tmp from a CI server at the moment.

Thanks for the pointer! It'll come in useful.

Mark

On Mon, Feb 13, 2012 at 3:38 PM, Bryan Berry [bryan.berry@gmail.com](mailto:bryan.berry@gmail.com) wrote:

> from what I can tell remote\_file only supports pulling from a url or the  
> files/ subdirectory of your cookbook. Where do you get app.war from in the  
> first place?
> 
> btw, if you are working on a java stack these java-related cookbooks may  
> be useful to you [cookbooks/java at master · bryanwb/cookbooks · GitHub](https://github.com/bryanwb/cookbooks/tree/master/java)  
> [cookbooks/tomcat at master · bryanwb/cookbooks · GitHub](https://github.com/bryanwb/cookbooks/tree/master/tomcat) (alpha)
> 
> On Mon, Feb 13, 2012 at 9:03 PM, mark bradley [gopearls42@gmail.com](mailto:gopearls42@gmail.com)wrote:
> 
> > Hi, I'm trying to copy a file on change (both files are in /tmp for now):
> > 
> > default.rb
> > 
> > default["FOO"]["latest\_war"] = "/tmp/app.war"
> > 
> > default["FOO"]["target\_war"] = "/tmp/dest.war"
> > 
> > My resource specification looks like this:
> > 
> > remote\_file node.default["FOO"]["target\_war"] do  
> > action :create  
> > source node.default["FOO"]["latest\_war"]  
> > end
> > 
> > When I run the Chef client I get an error:
> > 
> > [Mon, 13 Feb 2012 19:55:09 +0000] FATAL: Chef::Exceptions::FileNotFound:  
> > remote\_file[/tmp/dest.war] (XX line 65) had an error:  
> > Chef::Exceptions::FileNotFound: Cookbook 'XX' (0.0.1) does not contain a  
> > file at any of these locations:  
> > files/amazon-2011.09//tmp/app.war  
> > files/amazon//tmp/app.war  
> > files/default//tmp/app.war
> > 
> > Is there a way of forcing remote\_file to look outside the cookbook? Have  
> > I misunderstood this resource? Is there a better one to use?
> > 
> > Thanks,  
> > Mark

---

<div class="post-metadata">

**Author:** ![Bryan\_Berry](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/bryan_berry/32/213_2.png) [@Bryan\_Berry](https://discourse.chef.io/u/Bryan_Berry)\
**Post date:** [February 13, 2012, 8:45pm UTC](https://discourse.chef.io/t/remote-file-resource-new-to-chef/2453/4 "2012-02-13T20:45:49Z")

</div>

why don't u use the url from the ci server? what is your ci server?  
artifactory?

umm, do you use maven? I was thinking of writing a maven lwrp to fetch wars  
like this much like the deploy resources works

We use jenkins + artifactory at my office. I am looking for a collaborator  
on this topic as I know ruby + chef fairly well but not much about the java  
deployment chain. I will write the maven lwrp either way but having some  
feedback from someone who actually understands these systems will make it  
more effective 🙂

On Mon, Feb 13, 2012 at 9:42 PM, mark bradley [gopearls42@gmail.com](mailto:gopearls42@gmail.com) wrote:

> The war file is copied into /tmp from a CI server at the moment.
> 
> Thanks for the pointer! It'll come in useful.
> 
> Mark
> 
> On Mon, Feb 13, 2012 at 3:38 PM, Bryan Berry [bryan.berry@gmail.com](mailto:bryan.berry@gmail.com)wrote:
> 
> > from what I can tell remote\_file only supports pulling from a url or the  
> > files/ subdirectory of your cookbook. Where do you get app.war from in the  
> > first place?
> > 
> > btw, if you are working on a java stack these java-related cookbooks may  
> > be useful to you [cookbooks/java at master · bryanwb/cookbooks · GitHub](https://github.com/bryanwb/cookbooks/tree/master/java)  
> > [cookbooks/tomcat at master · bryanwb/cookbooks · GitHub](https://github.com/bryanwb/cookbooks/tree/master/tomcat) (alpha)
> > 
> > On Mon, Feb 13, 2012 at 9:03 PM, mark bradley [gopearls42@gmail.com](mailto:gopearls42@gmail.com)wrote:
> > 
> > > Hi, I'm trying to copy a file on change (both files are in /tmp for now):
> > > 
> > > default.rb
> > > 
> > > default["FOO"]["latest\_war"] = "/tmp/app.war"
> > > 
> > > default["FOO"]["target\_war"] = "/tmp/dest.war"
> > > 
> > > My resource specification looks like this:
> > > 
> > > remote\_file node.default["FOO"]["target\_war"] do  
> > > action :create  
> > > source node.default["FOO"]["latest\_war"]  
> > > end
> > > 
> > > When I run the Chef client I get an error:
> > > 
> > > [Mon, 13 Feb 2012 19:55:09 +0000] FATAL: Chef::Exceptions::FileNotFound:  
> > > remote\_file[/tmp/dest.war] (XX line 65) had an error:  
> > > Chef::Exceptions::FileNotFound: Cookbook 'XX' (0.0.1) does not contain a  
> > > file at any of these locations:  
> > > files/amazon-2011.09//tmp/app.war  
> > > files/amazon//tmp/app.war  
> > > files/default//tmp/app.war
> > > 
> > > Is there a way of forcing remote\_file to look outside the cookbook? Have  
> > > I misunderstood this resource? Is there a better one to use?
> > > 
> > > Thanks,  
> > > Mark

---

<div class="post-metadata">

**Author:** ![mark\_bradley](https://avatars.discourse-cdn.com/v4/letter/m/a87d85/32.png) [@mark\_bradley](https://discourse.chef.io/u/mark_bradley)\
**Post date:** [February 13, 2012, 8:48pm UTC](https://discourse.chef.io/t/remote-file-resource-new-to-chef/2453/5 "2012-02-13T20:48:57Z")

</div>

It's a Jenkins server but it's behind a firewall and this server has to  
stay outside it for the (undefined duration) moment ☹

We're using Jenkins and Maven here. I'd be glad to help if I can!

Mark

On Mon, Feb 13, 2012 at 3:45 PM, Bryan Berry [bryan.berry@gmail.com](mailto:bryan.berry@gmail.com) wrote:

> why don't u use the url from the ci server? what is your ci server?  
> artifactory?
> 
> umm, do you use maven? I was thinking of writing a maven lwrp to fetch  
> wars like this much like the deploy resources works
> 
> We use jenkins + artifactory at my office. I am looking for a collaborator  
> on this topic as I know ruby + chef fairly well but not much about the java  
> deployment chain. I will write the maven lwrp either way but having some  
> feedback from someone who actually understands these systems will make it  
> more effective 🙂
> 
> On Mon, Feb 13, 2012 at 9:42 PM, mark bradley [gopearls42@gmail.com](mailto:gopearls42@gmail.com)wrote:
> 
> > The war file is copied into /tmp from a CI server at the moment.
> > 
> > Thanks for the pointer! It'll come in useful.
> > 
> > Mark
> > 
> > On Mon, Feb 13, 2012 at 3:38 PM, Bryan Berry [bryan.berry@gmail.com](mailto:bryan.berry@gmail.com)wrote:
> > 
> > > from what I can tell remote\_file only supports pulling from a url or the  
> > > files/ subdirectory of your cookbook. Where do you get app.war from in the  
> > > first place?
> > > 
> > > btw, if you are working on a java stack these java-related cookbooks may  
> > > be useful to you [cookbooks/java at master · bryanwb/cookbooks · GitHub](https://github.com/bryanwb/cookbooks/tree/master/java)  
> > > [cookbooks/tomcat at master · bryanwb/cookbooks · GitHub](https://github.com/bryanwb/cookbooks/tree/master/tomcat) (alpha)
> > > 
> > > On Mon, Feb 13, 2012 at 9:03 PM, mark bradley [gopearls42@gmail.com](mailto:gopearls42@gmail.com)wrote:
> > > 
> > > > Hi, I'm trying to copy a file on change (both files are in /tmp for  
> > > > now):
> > > > 
> > > > default.rb
> > > > 
> > > > default["FOO"]["latest\_war"] = "/tmp/app.war"
> > > > 
> > > > default["FOO"]["target\_war"] = "/tmp/dest.war"
> > > > 
> > > > My resource specification looks like this:
> > > > 
> > > > remote\_file node.default["FOO"]["target\_war"] do  
> > > > action :create  
> > > > source node.default["FOO"]["latest\_war"]  
> > > > end
> > > > 
> > > > When I run the Chef client I get an error:
> > > > 
> > > > [Mon, 13 Feb 2012 19:55:09 +0000] FATAL:  
> > > > Chef::Exceptions::FileNotFound: remote\_file[/tmp/dest.war] (XX line 65) had  
> > > > an error: Chef::Exceptions::FileNotFound: Cookbook 'XX' (0.0.1) does not  
> > > > contain a file at any of these locations:  
> > > > files/amazon-2011.09//tmp/app.war  
> > > > files/amazon//tmp/app.war  
> > > > files/default//tmp/app.war
> > > > 
> > > > Is there a way of forcing remote\_file to look outside the  
> > > > cookbook? Have I misunderstood this resource? Is there a better one to use?
> > > > 
> > > > Thanks,  
> > > > Mark

---

<div class="post-metadata">

**Author:** ![Bryan\_Berry](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/bryan_berry/32/213_2.png) [@Bryan\_Berry](https://discourse.chef.io/u/Bryan_Berry)\
**Post date:** [February 13, 2012, 8:50pm UTC](https://discourse.chef.io/t/remote-file-resource-new-to-chef/2453/6 "2012-02-13T20:50:56Z")

</div>

does the jenkins server make the .war available from a url?  
do you have a maven repository to the war goes into after it is built?

On Mon, Feb 13, 2012 at 9:48 PM, mark bradley [gopearls42@gmail.com](mailto:gopearls42@gmail.com) wrote:

> It's a Jenkins server but it's behind a firewall and this server has to  
> stay outside it for the (undefined duration) moment ☹
> 
> We're using Jenkins and Maven here. I'd be glad to help if I can!
> 
> Mark
> 
> On Mon, Feb 13, 2012 at 3:45 PM, Bryan Berry [bryan.berry@gmail.com](mailto:bryan.berry@gmail.com)wrote:
> 
> > why don't u use the url from the ci server? what is your ci server?  
> > artifactory?
> > 
> > umm, do you use maven? I was thinking of writing a maven lwrp to fetch  
> > wars like this much like the deploy resources works
> > 
> > We use jenkins + artifactory at my office. I am looking for a  
> > collaborator on this topic as I know ruby + chef fairly well but not much  
> > about the java deployment chain. I will write the maven lwrp either way but  
> > having some feedback from someone who actually understands these systems  
> > will make it more effective 🙂
> > 
> > On Mon, Feb 13, 2012 at 9:42 PM, mark bradley [gopearls42@gmail.com](mailto:gopearls42@gmail.com)wrote:
> > 
> > > The war file is copied into /tmp from a CI server at the moment.
> > > 
> > > Thanks for the pointer! It'll come in useful.
> > > 
> > > Mark
> > > 
> > > On Mon, Feb 13, 2012 at 3:38 PM, Bryan Berry [bryan.berry@gmail.com](mailto:bryan.berry@gmail.com)wrote:
> > > 
> > > > from what I can tell remote\_file only supports pulling from a url or  
> > > > the files/ subdirectory of your cookbook. Where do you get app.war from in  
> > > > the first place?
> > > > 
> > > > btw, if you are working on a java stack these java-related cookbooks  
> > > > may be useful to you  
> > > > [cookbooks/java at master · bryanwb/cookbooks · GitHub](https://github.com/bryanwb/cookbooks/tree/master/java)  
> > > > [cookbooks/tomcat at master · bryanwb/cookbooks · GitHub](https://github.com/bryanwb/cookbooks/tree/master/tomcat) (alpha)
> > > > 
> > > > On Mon, Feb 13, 2012 at 9:03 PM, mark bradley [gopearls42@gmail.com](mailto:gopearls42@gmail.com)wrote:
> > > > 
> > > > > Hi, I'm trying to copy a file on change (both files are in /tmp for  
> > > > > now):
> > > > > 
> > > > > default.rb
> > > > > 
> > > > > default["FOO"]["latest\_war"] = "/tmp/app.war"
> > > > > 
> > > > > default["FOO"]["target\_war"] = "/tmp/dest.war"
> > > > > 
> > > > > My resource specification looks like this:
> > > > > 
> > > > > remote\_file node.default["FOO"]["target\_war"] do  
> > > > > action :create  
> > > > > source node.default["FOO"]["latest\_war"]  
> > > > > end
> > > > > 
> > > > > When I run the Chef client I get an error:
> > > > > 
> > > > > [Mon, 13 Feb 2012 19:55:09 +0000] FATAL:  
> > > > > Chef::Exceptions::FileNotFound: remote\_file[/tmp/dest.war] (XX line 65) had  
> > > > > an error: Chef::Exceptions::FileNotFound: Cookbook 'XX' (0.0.1) does not  
> > > > > contain a file at any of these locations:  
> > > > > files/amazon-2011.09//tmp/app.war  
> > > > > files/amazon//tmp/app.war  
> > > > > files/default//tmp/app.war
> > > > > 
> > > > > Is there a way of forcing remote\_file to look outside the  
> > > > > cookbook? Have I misunderstood this resource? Is there a better one to use?
> > > > > 
> > > > > Thanks,  
> > > > > Mark

---

<div class="post-metadata">

**Author:** ![mark\_bradley](https://avatars.discourse-cdn.com/v4/letter/m/a87d85/32.png) [@mark\_bradley](https://discourse.chef.io/u/mark_bradley)\
**Post date:** [February 13, 2012, 8:56pm UTC](https://discourse.chef.io/t/remote-file-resource-new-to-chef/2453/7 "2012-02-13T20:56:00Z")

</div>

Yes, there is a URL but it's blocked off my a firewall unfortunately.

On Mon, Feb 13, 2012 at 3:50 PM, Bryan Berry [bryan.berry@gmail.com](mailto:bryan.berry@gmail.com) wrote:

> does the jenkins server make the .war available from a url?  
> do you have a maven repository to the war goes into after it is built?
> 
> On Mon, Feb 13, 2012 at 9:48 PM, mark bradley [gopearls42@gmail.com](mailto:gopearls42@gmail.com)wrote:
> 
> > It's a Jenkins server but it's behind a firewall and this server has to  
> > stay outside it for the (undefined duration) moment ☹
> > 
> > We're using Jenkins and Maven here. I'd be glad to help if I can!
> > 
> > Mark
> > 
> > On Mon, Feb 13, 2012 at 3:45 PM, Bryan Berry [bryan.berry@gmail.com](mailto:bryan.berry@gmail.com)wrote:
> > 
> > > why don't u use the url from the ci server? what is your ci server?  
> > > artifactory?
> > > 
> > > umm, do you use maven? I was thinking of writing a maven lwrp to fetch  
> > > wars like this much like the deploy resources works
> > > 
> > > We use jenkins + artifactory at my office. I am looking for a  
> > > collaborator on this topic as I know ruby + chef fairly well but not much  
> > > about the java deployment chain. I will write the maven lwrp either way but  
> > > having some feedback from someone who actually understands these systems  
> > > will make it more effective 🙂
> > > 
> > > On Mon, Feb 13, 2012 at 9:42 PM, mark bradley [gopearls42@gmail.com](mailto:gopearls42@gmail.com)wrote:
> > > 
> > > > The war file is copied into /tmp from a CI server at the moment.
> > > > 
> > > > Thanks for the pointer! It'll come in useful.
> > > > 
> > > > Mark
> > > > 
> > > > On Mon, Feb 13, 2012 at 3:38 PM, Bryan Berry [bryan.berry@gmail.com](mailto:bryan.berry@gmail.com)wrote:
> > > > 
> > > > > from what I can tell remote\_file only supports pulling from a url or  
> > > > > the files/ subdirectory of your cookbook. Where do you get app.war from in  
> > > > > the first place?
> > > > > 
> > > > > btw, if you are working on a java stack these java-related cookbooks  
> > > > > may be useful to you  
> > > > > [cookbooks/java at master · bryanwb/cookbooks · GitHub](https://github.com/bryanwb/cookbooks/tree/master/java)  
> > > > > [cookbooks/tomcat at master · bryanwb/cookbooks · GitHub](https://github.com/bryanwb/cookbooks/tree/master/tomcat) (alpha)
> > > > > 
> > > > > On Mon, Feb 13, 2012 at 9:03 PM, mark bradley [gopearls42@gmail.com](mailto:gopearls42@gmail.com)wrote:
> > > > > 
> > > > > > Hi, I'm trying to copy a file on change (both files are in /tmp for  
> > > > > > now):
> > > > > > 
> > > > > > default.rb
> > > > > > 
> > > > > > default["FOO"]["latest\_war"] = "/tmp/app.war"
> > > > > > 
> > > > > > default["FOO"]["target\_war"] = "/tmp/dest.war"
> > > > > > 
> > > > > > My resource specification looks like this:
> > > > > > 
> > > > > > remote\_file node.default["FOO"]["target\_war"] do  
> > > > > > action :create  
> > > > > > source node.default["FOO"]["latest\_war"]  
> > > > > > end
> > > > > > 
> > > > > > When I run the Chef client I get an error:
> > > > > > 
> > > > > > [Mon, 13 Feb 2012 19:55:09 +0000] FATAL:  
> > > > > > Chef::Exceptions::FileNotFound: remote\_file[/tmp/dest.war] (XX line 65) had  
> > > > > > an error: Chef::Exceptions::FileNotFound: Cookbook 'XX' (0.0.1) does not  
> > > > > > contain a file at any of these locations:  
> > > > > > files/amazon-2011.09//tmp/app.war  
> > > > > > files/amazon//tmp/app.war  
> > > > > > files/default//tmp/app.war
> > > > > > 
> > > > > > Is there a way of forcing remote\_file to look outside the  
> > > > > > cookbook? Have I misunderstood this resource? Is there a better one to use?
> > > > > > 
> > > > > > Thanks,  
> > > > > > Mark

---

<div class="post-metadata">

**Author:** ![Bryan\_Berry](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/bryan_berry/32/213_2.png) [@Bryan\_Berry](https://discourse.chef.io/u/Bryan_Berry)\
**Post date:** [February 13, 2012, 8:58pm UTC](https://discourse.chef.io/t/remote-file-resource-new-to-chef/2453/8 "2012-02-13T20:58:26Z")

</div>

then u use ssh to copy over the file?

On Mon, Feb 13, 2012 at 9:56 PM, mark bradley [gopearls42@gmail.com](mailto:gopearls42@gmail.com) wrote:

> Yes, there is a URL but it's blocked off my a firewall unfortunately.
> 
> On Mon, Feb 13, 2012 at 3:50 PM, Bryan Berry [bryan.berry@gmail.com](mailto:bryan.berry@gmail.com)wrote:
> 
> > does the jenkins server make the .war available from a url?  
> > do you have a maven repository to the war goes into after it is built?
> > 
> > On Mon, Feb 13, 2012 at 9:48 PM, mark bradley [gopearls42@gmail.com](mailto:gopearls42@gmail.com)wrote:
> > 
> > > It's a Jenkins server but it's behind a firewall and this server has to  
> > > stay outside it for the (undefined duration) moment ☹
> > > 
> > > We're using Jenkins and Maven here. I'd be glad to help if I can!
> > > 
> > > Mark
> > > 
> > > On Mon, Feb 13, 2012 at 3:45 PM, Bryan Berry [bryan.berry@gmail.com](mailto:bryan.berry@gmail.com)wrote:
> > > 
> > > > why don't u use the url from the ci server? what is your ci server?  
> > > > artifactory?
> > > > 
> > > > umm, do you use maven? I was thinking of writing a maven lwrp to fetch  
> > > > wars like this much like the deploy resources works
> > > > 
> > > > We use jenkins + artifactory at my office. I am looking for a  
> > > > collaborator on this topic as I know ruby + chef fairly well but not much  
> > > > about the java deployment chain. I will write the maven lwrp either way but  
> > > > having some feedback from someone who actually understands these systems  
> > > > will make it more effective 🙂
> > > > 
> > > > On Mon, Feb 13, 2012 at 9:42 PM, mark bradley [gopearls42@gmail.com](mailto:gopearls42@gmail.com)wrote:
> > > > 
> > > > > The war file is copied into /tmp from a CI server at the moment.
> > > > > 
> > > > > Thanks for the pointer! It'll come in useful.
> > > > > 
> > > > > Mark
> > > > > 
> > > > > On Mon, Feb 13, 2012 at 3:38 PM, Bryan Berry [bryan.berry@gmail.com](mailto:bryan.berry@gmail.com)wrote:
> > > > > 
> > > > > > from what I can tell remote\_file only supports pulling from a url or  
> > > > > > the files/ subdirectory of your cookbook. Where do you get app.war from in  
> > > > > > the first place?
> > > > > > 
> > > > > > btw, if you are working on a java stack these java-related cookbooks  
> > > > > > may be useful to you  
> > > > > > [cookbooks/java at master · bryanwb/cookbooks · GitHub](https://github.com/bryanwb/cookbooks/tree/master/java)  
> > > > > > [cookbooks/tomcat at master · bryanwb/cookbooks · GitHub](https://github.com/bryanwb/cookbooks/tree/master/tomcat) (alpha)
> > > > > > 
> > > > > > On Mon, Feb 13, 2012 at 9:03 PM, mark bradley [gopearls42@gmail.com](mailto:gopearls42@gmail.com)wrote:
> > > > > > 
> > > > > > > Hi, I'm trying to copy a file on change (both files are in /tmp for  
> > > > > > > now):
> > > > > > > 
> > > > > > > default.rb
> > > > > > > 
> > > > > > > default["FOO"]["latest\_war"] = "/tmp/app.war"
> > > > > > > 
> > > > > > > default["FOO"]["target\_war"] = "/tmp/dest.war"
> > > > > > > 
> > > > > > > My resource specification looks like this:
> > > > > > > 
> > > > > > > remote\_file node.default["FOO"]["target\_war"] do  
> > > > > > > action :create  
> > > > > > > source node.default["FOO"]["latest\_war"]  
> > > > > > > end
> > > > > > > 
> > > > > > > When I run the Chef client I get an error:
> > > > > > > 
> > > > > > > [Mon, 13 Feb 2012 19:55:09 +0000] FATAL:  
> > > > > > > Chef::Exceptions::FileNotFound: remote\_file[/tmp/dest.war] (XX line 65) had  
> > > > > > > an error: Chef::Exceptions::FileNotFound: Cookbook 'XX' (0.0.1) does not  
> > > > > > > contain a file at any of these locations:  
> > > > > > > files/amazon-2011.09//tmp/app.war  
> > > > > > > files/amazon//tmp/app.war  
> > > > > > > files/default//tmp/app.war
> > > > > > > 
> > > > > > > Is there a way of forcing remote\_file to look outside the  
> > > > > > > cookbook? Have I misunderstood this resource? Is there a better one to use?
> > > > > > > 
> > > > > > > Thanks,  
> > > > > > > Mark

---

<div class="post-metadata">

**Author:** ![mark\_bradley](https://avatars.discourse-cdn.com/v4/letter/m/a87d85/32.png) [@mark\_bradley](https://discourse.chef.io/u/mark_bradley)\
**Post date:** [February 13, 2012, 8:59pm UTC](https://discourse.chef.io/t/remote-file-resource-new-to-chef/2453/9 "2012-02-13T20:59:47Z")

</div>

Yes, from Jenkins to this server, into /tmp

On Mon, Feb 13, 2012 at 3:58 PM, Bryan Berry [bryan.berry@gmail.com](mailto:bryan.berry@gmail.com) wrote:

> then u use ssh to copy over the file?
> 
> On Mon, Feb 13, 2012 at 9:56 PM, mark bradley [gopearls42@gmail.com](mailto:gopearls42@gmail.com)wrote:
> 
> > Yes, there is a URL but it's blocked off my a firewall unfortunately.
> > 
> > On Mon, Feb 13, 2012 at 3:50 PM, Bryan Berry [bryan.berry@gmail.com](mailto:bryan.berry@gmail.com)wrote:
> > 
> > > does the jenkins server make the .war available from a url?  
> > > do you have a maven repository to the war goes into after it is built?
> > > 
> > > On Mon, Feb 13, 2012 at 9:48 PM, mark bradley [gopearls42@gmail.com](mailto:gopearls42@gmail.com)wrote:
> > > 
> > > > It's a Jenkins server but it's behind a firewall and this server has to  
> > > > stay outside it for the (undefined duration) moment ☹
> > > > 
> > > > We're using Jenkins and Maven here. I'd be glad to help if I can!
> > > > 
> > > > Mark
> > > > 
> > > > On Mon, Feb 13, 2012 at 3:45 PM, Bryan Berry [bryan.berry@gmail.com](mailto:bryan.berry@gmail.com)wrote:
> > > > 
> > > > > why don't u use the url from the ci server? what is your ci server?  
> > > > > artifactory?
> > > > > 
> > > > > umm, do you use maven? I was thinking of writing a maven lwrp to fetch  
> > > > > wars like this much like the deploy resources works
> > > > > 
> > > > > We use jenkins + artifactory at my office. I am looking for a  
> > > > > collaborator on this topic as I know ruby + chef fairly well but not much  
> > > > > about the java deployment chain. I will write the maven lwrp either way but  
> > > > > having some feedback from someone who actually understands these systems  
> > > > > will make it more effective 🙂
> > > > > 
> > > > > On Mon, Feb 13, 2012 at 9:42 PM, mark bradley [gopearls42@gmail.com](mailto:gopearls42@gmail.com)wrote:
> > > > > 
> > > > > > The war file is copied into /tmp from a CI server at the moment.
> > > > > > 
> > > > > > Thanks for the pointer! It'll come in useful.
> > > > > > 
> > > > > > Mark
> > > > > > 
> > > > > > On Mon, Feb 13, 2012 at 3:38 PM, Bryan Berry [bryan.berry@gmail.com](mailto:bryan.berry@gmail.com)wrote:
> > > > > > 
> > > > > > > from what I can tell remote\_file only supports pulling from a url or  
> > > > > > > the files/ subdirectory of your cookbook. Where do you get app.war from in  
> > > > > > > the first place?
> > > > > > > 
> > > > > > > btw, if you are working on a java stack these java-related cookbooks  
> > > > > > > may be useful to you  
> > > > > > > [cookbooks/java at master · bryanwb/cookbooks · GitHub](https://github.com/bryanwb/cookbooks/tree/master/java)  
> > > > > > > [cookbooks/tomcat at master · bryanwb/cookbooks · GitHub](https://github.com/bryanwb/cookbooks/tree/master/tomcat) (alpha)
> > > > > > > 
> > > > > > > On Mon, Feb 13, 2012 at 9:03 PM, mark bradley [gopearls42@gmail.com](mailto:gopearls42@gmail.com)wrote:
> > > > > > > 
> > > > > > > > Hi, I'm trying to copy a file on change (both files are in /tmp for  
> > > > > > > > now):
> > > > > > > > 
> > > > > > > > default.rb
> > > > > > > > 
> > > > > > > > default["FOO"]["latest\_war"] = "/tmp/app.war"
> > > > > > > > 
> > > > > > > > default["FOO"]["target\_war"] = "/tmp/dest.war"
> > > > > > > > 
> > > > > > > > My resource specification looks like this:
> > > > > > > > 
> > > > > > > > remote\_file node.default["FOO"]["target\_war"] do  
> > > > > > > > action :create  
> > > > > > > > source node.default["FOO"]["latest\_war"]  
> > > > > > > > end
> > > > > > > > 
> > > > > > > > When I run the Chef client I get an error:
> > > > > > > > 
> > > > > > > > [Mon, 13 Feb 2012 19:55:09 +0000] FATAL:  
> > > > > > > > Chef::Exceptions::FileNotFound: remote\_file[/tmp/dest.war] (XX line 65) had  
> > > > > > > > an error: Chef::Exceptions::FileNotFound: Cookbook 'XX' (0.0.1) does not  
> > > > > > > > contain a file at any of these locations:  
> > > > > > > > files/amazon-2011.09//tmp/app.war  
> > > > > > > > files/amazon//tmp/app.war  
> > > > > > > > files/default//tmp/app.war
> > > > > > > > 
> > > > > > > > Is there a way of forcing remote\_file to look outside the  
> > > > > > > > cookbook? Have I misunderstood this resource? Is there a better one to use?
> > > > > > > > 
> > > > > > > > Thanks,  
> > > > > > > > Mark

---

<div class="post-metadata">

**Author:** ![Bryan\_Berry](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/bryan_berry/32/213_2.png) [@Bryan\_Berry](https://discourse.chef.io/u/Bryan_Berry)\
**Post date:** [February 13, 2012, 9:16pm UTC](https://discourse.chef.io/t/remote-file-resource-new-to-chef/2453/10 "2012-02-13T21:16:08Z")

</div>

for quick and dirty, use a ruby\_block

ruby\_block "move wars" do  
block do  
require 'fileutils'  
# this is pseudo-code  
app\_war = File('/tmp/app.war')  
dest\_war = File('/tmp/dest.war')  
app\_checksum = Sha256sum(app\_war)  
dest\_checksum = Sha256sum(dest\_war)  
if app\_checksum != dest\_checksum  
FileUtils.cp\_f app\_war, dest\_war  
end  
end  
end

though remote\_file should really support a file path rather than just a  
URL, I recommend filing a bug on [tickets.opscode.com](http://tickets.opscode.com)

On Mon, Feb 13, 2012 at 9:59 PM, mark bradley [gopearls42@gmail.com](mailto:gopearls42@gmail.com) wrote:

> Yes, from Jenkins to this server, into /tmp
> 
> On Mon, Feb 13, 2012 at 3:58 PM, Bryan Berry [bryan.berry@gmail.com](mailto:bryan.berry@gmail.com)wrote:
> 
> > then u use ssh to copy over the file?
> > 
> > On Mon, Feb 13, 2012 at 9:56 PM, mark bradley [gopearls42@gmail.com](mailto:gopearls42@gmail.com)wrote:
> > 
> > > Yes, there is a URL but it's blocked off my a firewall unfortunately.
> > > 
> > > On Mon, Feb 13, 2012 at 3:50 PM, Bryan Berry [bryan.berry@gmail.com](mailto:bryan.berry@gmail.com)wrote:
> > > 
> > > > does the jenkins server make the .war available from a url?  
> > > > do you have a maven repository to the war goes into after it is built?
> > > > 
> > > > On Mon, Feb 13, 2012 at 9:48 PM, mark bradley [gopearls42@gmail.com](mailto:gopearls42@gmail.com)wrote:
> > > > 
> > > > > It's a Jenkins server but it's behind a firewall and this server has  
> > > > > to stay outside it for the (undefined duration) moment ☹
> > > > > 
> > > > > We're using Jenkins and Maven here. I'd be glad to help if I can!
> > > > > 
> > > > > Mark
> > > > > 
> > > > > On Mon, Feb 13, 2012 at 3:45 PM, Bryan Berry [bryan.berry@gmail.com](mailto:bryan.berry@gmail.com)wrote:
> > > > > 
> > > > > > why don't u use the url from the ci server? what is your ci server?  
> > > > > > artifactory?
> > > > > > 
> > > > > > umm, do you use maven? I was thinking of writing a maven lwrp to  
> > > > > > fetch wars like this much like the deploy resources works
> > > > > > 
> > > > > > We use jenkins + artifactory at my office. I am looking for a  
> > > > > > collaborator on this topic as I know ruby + chef fairly well but not much  
> > > > > > about the java deployment chain. I will write the maven lwrp either way but  
> > > > > > having some feedback from someone who actually understands these systems  
> > > > > > will make it more effective 🙂
> > > > > > 
> > > > > > On Mon, Feb 13, 2012 at 9:42 PM, mark bradley [gopearls42@gmail.com](mailto:gopearls42@gmail.com)wrote:
> > > > > > 
> > > > > > > The war file is copied into /tmp from a CI server at the moment.
> > > > > > > 
> > > > > > > Thanks for the pointer! It'll come in useful.
> > > > > > > 
> > > > > > > Mark
> > > > > > > 
> > > > > > > On Mon, Feb 13, 2012 at 3:38 PM, Bryan Berry [bryan.berry@gmail.com](mailto:bryan.berry@gmail.com)wrote:
> > > > > > > 
> > > > > > > > from what I can tell remote\_file only supports pulling from a url  
> > > > > > > > or the files/ subdirectory of your cookbook. Where do you get app.war from  
> > > > > > > > in the first place?
> > > > > > > > 
> > > > > > > > btw, if you are working on a java stack these java-related  
> > > > > > > > cookbooks may be useful to you  
> > > > > > > > [cookbooks/java at master · bryanwb/cookbooks · GitHub](https://github.com/bryanwb/cookbooks/tree/master/java)  
> > > > > > > > [cookbooks/tomcat at master · bryanwb/cookbooks · GitHub](https://github.com/bryanwb/cookbooks/tree/master/tomcat) (alpha)
> > > > > > > > 
> > > > > > > > On Mon, Feb 13, 2012 at 9:03 PM, mark bradley \<[gopearls42@gmail.com](mailto:gopearls42@gmail.com)
> > > > > > > > 
> > > > > > > > > wrote:
> > > > > > > > 
> > > > > > > > > Hi, I'm trying to copy a file on change (both files are in /tmp  
> > > > > > > > > for now):
> > > > > > > > > 
> > > > > > > > > default.rb
> > > > > > > > > 
> > > > > > > > > default["FOO"]["latest\_war"] = "/tmp/app.war"
> > > > > > > > > 
> > > > > > > > > default["FOO"]["target\_war"] = "/tmp/dest.war"
> > > > > > > > > 
> > > > > > > > > My resource specification looks like this:
> > > > > > > > > 
> > > > > > > > > remote\_file node.default["FOO"]["target\_war"] do  
> > > > > > > > > action :create  
> > > > > > > > > source node.default["FOO"]["latest\_war"]  
> > > > > > > > > end
> > > > > > > > > 
> > > > > > > > > When I run the Chef client I get an error:
> > > > > > > > > 
> > > > > > > > > [Mon, 13 Feb 2012 19:55:09 +0000] FATAL:  
> > > > > > > > > Chef::Exceptions::FileNotFound: remote\_file[/tmp/dest.war] (XX line 65) had  
> > > > > > > > > an error: Chef::Exceptions::FileNotFound: Cookbook 'XX' (0.0.1) does not  
> > > > > > > > > contain a file at any of these locations:  
> > > > > > > > > files/amazon-2011.09//tmp/app.war  
> > > > > > > > > files/amazon//tmp/app.war  
> > > > > > > > > files/default//tmp/app.war
> > > > > > > > > 
> > > > > > > > > Is there a way of forcing remote\_file to look outside the  
> > > > > > > > > cookbook? Have I misunderstood this resource? Is there a better one to use?
> > > > > > > > > 
> > > > > > > > > Thanks,  
> > > > > > > > > Mark

---

<div class="post-metadata">

**Author:** ![realityforge](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/realityforge/32/395_2.png) [@realityforge](https://discourse.chef.io/u/realityforge)\
**Post date:** [February 13, 2012, 9:52pm UTC](https://discourse.chef.io/t/remote-file-resource-new-to-chef/2453/11 "2012-02-13T21:52:04Z")

</div>

Hi,

On Tue, Feb 14, 2012 at 7:38 AM, Bryan Berry [bryan.berry@gmail.com](mailto:bryan.berry@gmail.com) wrote:

> from what I can tell remote\_file only supports pulling from a url or the  
> files/ subdirectory of your cookbook. Where do you get app.war from in the  
> first place?
> 
> btw, if you are working on a java stack these java-related cookbooks may  
> be useful to you [cookbooks/java at master · bryanwb/cookbooks · GitHub](https://github.com/bryanwb/cookbooks/tree/master/java)  
> [cookbooks/tomcat at master · bryanwb/cookbooks · GitHub](https://github.com/bryanwb/cookbooks/tree/master/tomcat) (alpha)

And if you are using GlassFish v3 checkout

> **[GitHub - realityforge/chef-glassfish](https://github.com/realityforge/chef-glassfish)**
>
> Contribute to realityforge/chef-glassfish development by creating an account on GitHub.

and for bonita (a java BPMN server)

> **[GitHub - realityforge/chef-bonita: A cookbook for installing the Bonita BPM...](https://github.com/realityforge/chef-bonita)**
>
> A cookbook for installing the Bonita BPM software. Contribute to realityforge/chef-bonita development by creating an account on GitHub.

--  
Cheers,

Peter Donald

---

<div class="post-metadata">

**Author:** ![Bryan\_Berry](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/bryan_berry/32/213_2.png) [@Bryan\_Berry](https://discourse.chef.io/u/Bryan_Berry)\
**Post date:** [February 14, 2012, 6:34am UTC](https://discourse.chef.io/t/remote-file-resource-new-to-chef/2453/12 "2012-02-14T06:34:14Z")

</div>

Hey Peter,

It looks like we are shaving the similar yaks 🙂

your method of installing glassfish looks almost exactly the same as my  
java\_ark lwrp. The only exception is that you have a different way to  
avoid downloading the tarball each time.

> **[GitHub - bryanwb/chef-java: java cookbook](https://github.com/bryanwb/chef-java)**
>
> java cookbook . Contribute to bryanwb/chef-java development by creating an account on GitHub.

java\_ark "glassfish" do  
url "path"  
checksum "..sha256sum..."  
app\_home "/usr/local/glassfish/default"  
owner "glassfish"  
end

I am not sure any more whether I really need to provide the checksum after  
all. also, app\_home could probably be changed to `prefix_dir` and provided  
the value /usr/local/ rather than /usr/local/glassfish/default

java\_ark handles unpacking .zip, .tar.gz, and .tar.bz2

Your lwrps for glassfish look remarkably like what I am trying to do w/ the  
tomcat and jboss cookbooks.

It would be great if we could chat on IRC or skype (berrdawg) about the  
challenges of creating java-related, esp. consistent system v init scripts  
for both debian and EL (rhel) and how to install multiple instances  
containers on the same system.

hope to hear from you soon!

BryanWB

On Mon, Feb 13, 2012 at 10:52 PM, Peter Donald [peter@realityforge.org](mailto:peter@realityforge.org)wrote:

> Hi,
> 
> On Tue, Feb 14, 2012 at 7:38 AM, Bryan Berry [bryan.berry@gmail.com](mailto:bryan.berry@gmail.com)wrote:
> 
> > from what I can tell remote\_file only supports pulling from a url or the  
> > files/ subdirectory of your cookbook. Where do you get app.war from in the  
> > first place?
> > 
> > btw, if you are working on a java stack these java-related cookbooks may  
> > be useful to you [cookbooks/java at master · bryanwb/cookbooks · GitHub](https://github.com/bryanwb/cookbooks/tree/master/java)  
> > [cookbooks/tomcat at master · bryanwb/cookbooks · GitHub](https://github.com/bryanwb/cookbooks/tree/master/tomcat) (alpha)
> 
> And if you are using GlassFish v3 checkout
> 
> [GitHub - realityforge/chef-glassfish](https://github.com/realityforge/chef-glassfish)
> 
> and for bonita (a java BPMN server)
> 
> [GitHub - realityforge/chef-bonita: A cookbook for installing the Bonita BPM software](https://github.com/realityforge/chef-bonita)
> 
> --  
> Cheers,
> 
> Peter Donald

---

<div class="post-metadata">

**Author:** ![Bryan\_Berry](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/bryan_berry/32/213_2.png) [@Bryan\_Berry](https://discourse.chef.io/u/Bryan_Berry)\
**Post date:** [February 14, 2012, 6:34am UTC](https://discourse.chef.io/t/remote-file-resource-new-to-chef/2453/13 "2012-02-14T06:34:31Z")

</div>

On Tue, Feb 14, 2012 at 7:34 AM, Bryan Berry [bryan.berry@gmail.com](mailto:bryan.berry@gmail.com) wrote:

> Hey Peter,
> 
> It looks like we are shaving the similar yaks 🙂
> 
> your method of installing glassfish looks almost exactly the same as my  
> java\_ark lwrp. The only exception is that you have a different way to  
> avoid downloading the tarball each time.
> 
> [GitHub - bryanwb/chef-java: java cookbook](https://github.com/bryanwb/chef-java)  
> java\_ark "glassfish" do  
> url "path"  
> checksum "..sha256sum..."  
> app\_home "/usr/local/glassfish/default"  
> owner "glassfish"  
> end
> 
> I am not sure any more whether I really need to provide the checksum after  
> all. also, app\_home could probably be changed to `prefix_dir` and provided  
> the value /usr/local/ rather than /usr/local/glassfish/default
> 
> java\_ark handles unpacking .zip, .tar.gz, and .tar.bz2
> 
> Your lwrps for glassfish look remarkably like what I am trying to do w/  
> the tomcat and jboss cookbooks.
> 
> It would be great if we could chat on IRC or skype (berrdawg) about the  
> challenges of creating java-related, esp. consistent system v init scripts  
> for both debian and EL (rhel) and how to install multiple instances  
> containers on the same system.
> 
> hope to hear from you soon!
> 
> BryanWB
> 
> On Mon, Feb 13, 2012 at 10:52 PM, Peter Donald [peter@realityforge.org](mailto:peter@realityforge.org)wrote:
> 
> > Hi,
> > 
> > On Tue, Feb 14, 2012 at 7:38 AM, Bryan Berry [bryan.berry@gmail.com](mailto:bryan.berry@gmail.com)wrote:
> > 
> > > from what I can tell remote\_file only supports pulling from a url or the  
> > > files/ subdirectory of your cookbook. Where do you get app.war from in the  
> > > first place?
> > > 
> > > btw, if you are working on a java stack these java-related cookbooks may  
> > > be useful to you [cookbooks/java at master · bryanwb/cookbooks · GitHub](https://github.com/bryanwb/cookbooks/tree/master/java)  
> > > [cookbooks/tomcat at master · bryanwb/cookbooks · GitHub](https://github.com/bryanwb/cookbooks/tree/master/tomcat) (alpha)
> > 
> > And if you are using GlassFish v3 checkout
> > 
> > [GitHub - realityforge/chef-glassfish](https://github.com/realityforge/chef-glassfish)
> > 
> > and for bonita (a java BPMN server)
> > 
> > [GitHub - realityforge/chef-bonita: A cookbook for installing the Bonita BPM software](https://github.com/realityforge/chef-bonita)
> > 
> > --  
> > Cheers,
> > 
> > Peter Donald
