[chef] Re: RE: Re: Re: Re: Re: Deploying .war files?


Chronological Thread 
  • From: Haselwanter Edmund < >
  • To:
  • Subject: [chef] Re: RE: Re: Re: Re: Re: Deploying .war files?
  • Date: Thu, 23 Jun 2011 13:10:33 +0200

Hi,

I did a example installation with the application cookbook here:


cu edi

On 22.06.2011, at 20:11, Matthew Drobnak wrote:

Ok, so I did the following:
 
Created a role called spark_server:
 
{
  "name": "spark_server",
  "default_attributes": {
  },
  "json_class": "Chef::Role",
  "env_run_lists": {
  },
  "run_list": [
    "recipe[application]"
  ],
  "description": "Spark Tomcat Server",
  "chef_type": "role",
  "override_attributes": {
  }
}
 
Created data bag apps:
 
{
  "group": "nogroup",
  "server_roles": [
    "spark_server"
  ],
  "databases": {
    "_default": {
      "max_active": "100",
      "port": "1433",
      "username": "user",
      "adapter": "sqlserver",
      "max_idle": "30",
      "database": "appname",
      "driver": "com.microsoft.sqlserver.jdbc.SQLServerDriver",
      "max_wait": "10000",
      "password": "awesome_password"
    },
    "dev": {
      "max_active": "100",
      "port": "1433",
      "username": "user",
      "adapter": "sqlserver",
      "max_idle": "30",
      "database": "appname",
      "driver": "com.microsoft.sqlserver.jdbc.SQLServerDriver",
      "max_wait": "10000",
      "password": "apppass"
    }
  },
  "id": "AppName",
  "mysql_repl_password": {
   "_default": "mysql_repl"
  },
  "type": {
    "spark_server": [
      "java_webapp",
      "tomcat"
    ]
  },
  "war": {
    "_default": {
      "checksum": "06880edebbf24c4000da4d45d26aa97ddc2a6ad1ae3e4365c755fdb5a1ad481a",
      "source": "http://redacted/spark_server.war"
    }
  },
  "mysql_root_password": {
    "_default": "mysql_root"
  },
  "mysql_debian_password": {
    "_default": "mysql_debian"
  },
  "deploy_to": "/srv/spark_server",
  "owner": "nobody"
}
 
These are the cookbooks I have installed:
 
apache2             0.99.4
application         0.99.11
apt                 1.1.2
build-essential     1.0.0
chef-client         0.99.5
gunicorn            1.0.0
java                1.1.0
jpackage            0.10.0
mysql               1.0.6
openssl             1.0.0
passenger_apache2   0.99.0
php                 1.0.0
python              1.0.2
runit               0.14.2
tomcat              0.10.3
unicorn             1.0.0
xml                 1.0.0
 
 
So at this point:
I have a node, with Tomcat installed. But, I have /srv/spark_sever/releases/<sha256sum>.war plus a shared/logs, shared/pids,shared/system directories which are empty. /etc/tomcat6/Catalina/localhost/ROOT.xml points to /srv/spark_server/shared/AppName.xml, which does not exist.
/var/lib/tomcat6/webapps is empty (ROOT was deleted by the java_webapp recipe…), so there’s nothing actually running.
 
So two things:
What happened to my context.xml file?
How can I deploy to a named context instead of the ROOT context?
 
Thanks.
 
-Matt
 
 
From: Matthew Drobnak [mailto:  
Sent: Tuesday, June 21, 2011 7:45 AM
To:  " style="color: blue; text-decoration: underline; ">
Subject: [chef] Re: Re: Re: Re: Deploying .war files?
 
I appreciate everyone's input so far.
 
Seth, I totally missed the application cookbook. I'll look into that and hopefully can get at least 1 piece running with Chef!
 
I love the premise, but all of the configuration management systems seem to have a bit of a steep climb before it becomes easy and powerful. :)
 
Thanks again.
 
-Matt
 
On Jun 21, 2011, at 12:10 AM, Seth Chisamore wrote:
 
The java_webapp recipe in the application cookbook [0][1] was created to accomplish just this task!
 
The Java Quick Start [1] has a full working example of using this recipe to deploy a Java webapp, including setting up an environment specific context.xml with database connection information.

Seth

--
Opscode, Inc.
Seth Chisamore, Senior Technical Evangelist
IRC, Skype, Twitter, Github: schisamo
 

[2] http://help.opscode.com/kb/otherhelp/build-a-java-web-stack

could you use something like capistrano for java?

 

I need to do the same thing but haven't written it yet. Here's my plan
- hopefully others can critique.

Firstly, you don't want to stop tomcat. Chef runs every 20 minutes or
so (or whenever you set it for) so it would stop your server every 20
minutes. Instead, you should work out if the file on your file server
has changed and then do the update. In my case, my build artifacts
have a build id. I plan to store the desired build id in a data bag *.
The deployed data bag goes into the node data. Then, on the chef run
it can compare and then run the update if required.

When you do the update you don't need to stop tomcat. Instead you
download the WAR to a temp directory then go to the webapps dir and
delete the directory for your webapp as well as the old WAR. Then you
copy the WAR in. (You can't download directly because then Tomcat
un-jars it before it's downloaded). Tomcat then un-jars it and starts
it up for you.

Cheers,
Edward

* Amusingly, I forgot the name for data bag and my mind came up with
drop bag. Once a trail runner, always a trail runner... :-)

On Mon, Jun 20, 2011 at 8:25 PM,  < " target="_blank" style="color: blue; text-decoration: underline; "> > wrote:
> Hi everyone,
> I'm fairly new to Chef. I downloaded and deployed the tomcat cookbook to a
> node, and now I'm trying to add a recipe? or another cookbook, I'm not sure
> really...to deploy our web app that should run on Tomcat.
>
> I basically want the node to stop tomcat, delete everything in the webapps
> directory, and scp a file to the right spot..then start tomcat.
>
> I looked briefly at the deploy resource, but that's from a version control
> system...we don't keep builds in version control, only the source..the binary
> builds are on a server, so I don't think that's what I want.
>
> If anyone can point me in the right direction to get this going, that would be
> greatly appreciated.
>
> Thanks.
>
> -Matt
>
 
 
 





Archive powered by MHonArc 2.6.16.

§