Custom cook book to deploy java app on tomcat using AWS CLoudFormation template

986 views Asked by At

i am trying to deploy a java webapp/tomcat using AWS opsworks, but i am not finding any cookbooks which configures tomcat on ec2 and then deploy my java app. can someone please provide me with the custom cookbook for that. I need both the link to the application and the custom cookbook. actually i am trying to do it with the cloud formation template.

My cloud formation template

    "myStack": {
            "Type": "AWS::OpsWorks::Stack",
            "Properties": {
                             "CustomCookbooksSource": {
                             "Type": "git",
                             **"Url": "xxx (url for the cookbook)"**
                              }
                          }
     }

--

"myApp": {
                "Type": "AWS::OpsWorks::App",
                "Properties": {
                    "StackId": {
                        "Ref": "myStack"
                    },
                    "Type": "java",
                    "Name": {
                        "Ref": "AppName"
                    },
                    "AppSource": {
                        "Type": "git",
                        **"Url": "xxx (url for the java app)",**
                        "Revision": "version2"
                    },
                    "Attributes": {
                        "DocumentRoot": "web"
                    }
                }
            }

**shows where the changes are required.

1

There are 1 answers

0
Don Cheadle On

Maybe I'm not understanding a certain caveat, but is there something wrong with OpsWorks' default deployment of your app?

In OpsWorks, if you go to Apps, you can choose to add an App and then deploy it to any/all running instances in your Java app Server layer. If you choose to add/deploy your App this way, OpsWorks does a lot of leg work for you and gets your app running/setup correctly with sensible defaults.

I don't know the specifics of what OpsWorks does when it deploys, but one can view the Chef recipes OpsWorks uses during different Lifecycle events on GitHub. You can view them at https://github.com/aws/opsworks-cookbooks or within OpsWorks itself click on a Layer and then Recipes, and then click on the recipe you want to view.

This default add App and Deploy through the OpsWorks console has worked for me.

Note: What I usually do is rely on OpsWorks' default deployment of my Java webapp, but then I have additional custom cookbooks for making some directories, setting environment variables, etc. -- but for the deployment of the webapp, I let OpsWorks handle that.