- From: Seth Chisamore <
>
- To:
- Subject: [chef] Re: Re: RE: Re: Re: Re: Re: Deploying .war files?
- Date: Thu, 23 Jun 2011 11:21:59 -0400
Edmund,
I was looking over your enhancements/changes in the application and tomcat
cookbooks...good stuff!
I def want to move all recipes in the application cookbook over to LWRPs (vs
definitions as you mention). I would also really like to merge in your
tomcat_context LWRP, this would make deploying multiple WARs into a single
tomcat instance easier!
Seth
--
Opscode, Inc.
Seth Chisamore, Senior Technical Evangelist
IRC, Skype, Twitter, Github: schisamo
On Thursday, June 23, 2011 at 10:01 AM, Haselwanter Edmund wrote:
>
Hi,
>
>
I've uploaded a reworked application and tomcat cookbook
>
>
http://www.iteh.at/en/blog/2011/06/23/deployment-of-java-web-applications-with-chef-from-opscode/
>
https://github.com/iteh/vagrant-demos/tree/master/vagrant-java-application-reworked
>
>
which allows for something like this:
>
>
# load a json or do a search like in the application cookbook
>
#
>
https://github.com/iteh/vagrant-demos/blob/master/vagrant-java-application-reworked/databags/apps/java_app.json
>
>
>
app = JSON.parse(File.open( File.join( File.dirname(__FILE__), \
>
"../databags/my_webapp.json")).read)
>
>
node.run_state[:current_app] = app
>
>
application_java_webapp “my_webapp”
>
application_tomcat “my_webapp_tomcat”
>
>
node.run_state.delete(:current_app)
>
>
it uses a tomcat_context LWRP with shasum checking
>
>
tomcat_context app['path'] do
>
config "#{app['deploy_to']}/shared/#{app['id']}.xml"
>
checksum app['war'][node.app_environment]['checksum']
>
admin node["tomcat"]["admin"]
>
password node["tomcat"]["password"]
>
action [:update,:start]
>
end
>
>
>
might need some tuning and cleanup
>
>
i think the definition should move to a LWRP too
>
>
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:
>
>
>
>
>
> (mailto:
)
>
> 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
>
> >
>
> >
>
> > [0] http://community.opscode.com/cookbooks/application
>
> >
>
> > [1]
>
> > https://github.com/opscode/cookbooks/blob/master/application/README.md
>
> >
>
> >
>
> > [2] http://help.opscode.com/kb/otherhelp/build-a-java-web-stack
>
> >
>
> >
>
> >
>
> > On Mon, Jun 20, 2011 at 11:35 PM, Ken Mazaika
>
> > <
>
> >
>
> > (mailto:
)>
>
> > wrote:
>
> > could you use something like capistrano for java?
>
> >
>
> >
>
> >
>
> > On Mon, Jun 20, 2011 at 11:32 PM, Edward Sargisson
>
> > <
>
> >
>
> > (mailto:
)>
>
> > wrote:
>
> > 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,
>
> > <
>
> >
>
> > (mailto:
)>
>
> > 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
>
>
>
>
--
>
DI Edmund Haselwanter,
>
>
>
(mailto:
),
>
http://edmund.haselwanter.com/
>
http://www.iteh.at | http://facebook.com/iTeh.solutions |
>
http://at.linkedin.com/in/haselwanteredmund
- [chef] Re: Re: Re: Deploying .war files?, (continued)
Archive powered by MHonArc 2.6.16.