Graeme, First option sounds great. Yes, I would like to work on that and get a PR merged into Brooklyn with your help. I will take a look into the airline framework until then and pull the codebase. I know you guys have changed the code structure and moved things around.
Let us tackle this once you are back from vacation. I am off a few days myself. And again thanks so much for the help from all of you. Really appreciate it. Already in love with Brooklyn :) Thanks. Abhishek On Thu, Dec 24, 2015 at 3:51 AM, Graeme Miller < [email protected]> wrote: > Hi Abhishek, > > The Brooklyn Main class is used to set properties on BrooklynLauncher, > which is in turn responsible for running the Brooklyn instance. The > BrooklynLauncher can already be configured with multiple applications > (appsToManage variable). > > So there are two things I can suggest here. Firstly, the cleanest > solution would be to modify the Brooklyn Main class so that the -a option > takes in multiple applications and hands them to the launcher. This > shouldn't be too complicated, we use a framework called airline > <https://github.com/airlift/airline> to handle the CLI options. > > If that is not going to be possible, a quick solution would be to override > the Main.customize method and add multiple applications there, in a similar > way to how the Main.computeAndSetApp method does. > > If you go with the first option, I am more than happy to lend a hand. We > can even create a PR and get it merged back into Brooklyn main. > > Just a heads up, as it is Christmas things might get delayed a little. I am > on Holiday, back on the 5th of Jan (I will be in the office on Wed the 30th > of December). > > Regards, > Graeme > > > On 23 December 2015 at 19:48, Abhishek Sharma <[email protected]> > wrote: > > > Grame, > > > > Until you get a chance to respond to my earlier email. > > > > The YAML approach of starting that app works like a charm. Thanks.. > > > > Thanks, > > A > > > > On Wed, Dec 23, 2015 at 11:05 AM, Abhishek Sharma < > [email protected]> > > wrote: > > > > > Thanks for the inputs, Graeme. > > > > > > It is necessary for me to go beyond the YAML approach you mentioned. > > Would > > > deeply appreciate if you can give me pointers on how that can be done. > > > > > > Here are few of my top reasons: > > > 1. I want to be able to deploy my services (built on Brooklyn) on bare > > > metal, IaaS and any PaaS that we plan to support. I want a single entry > > > point and ease for deployment. > > > So based on a particular custom added CLI options I change by > > > brooklyn.properties files to run services with particular settings. > > > > > > 2. We have done a lot of stuff in Java Blueprints and want to keep it > > that > > > way. > > > > > > 3. Based on certain flags that are set we have some existing code that > > > initializes some Guice modules. > > > > > > I do not want to disrupt all that for now and just have my > > ApplicationMain > > > class which extends Brooklyn Main class start multiple applications. > > > The locations, environment etc all other settings are specified in java > > > classes already for my services. Just want to be able to run multiple > > > services from Main class. > > > > > > Thanks, > > > Abhishek > > > > > > > > > On Wed, Dec 23, 2015 at 9:30 AM, Graeme Miller < > > > [email protected]> wrote: > > > > > >> Hello, > > >> > > >> I can try this. Is there an actual code example of such a kind you can > > >> point me to ? > > >> > > >> The three lines I provided in the previous email should be enough, > just > > >> replace "com.abhishek.dropwizzard" and "com.abhishek.nodejs" with your > > >> classes and set the '-a' option to point to the YAML file. You'll also > > >> need > > >> to specify a location either in the yaml or via the '-l' option. > > >> > > >> 1. Treating Brooklyn as my central guy for deploying and monitoring > all > > my > > >> services > > >> > > >> Would highly recommend it :) > > >> > > >> 2. I have extending the Main class and added some custom flags for my > > own > > >> needs. I also extend the main.launch command and use my own. Were I > have > > >> over-ridden the call method. I use setAppToLaunch() to set the app I > > want > > >> to launch. I was looking for some way to set multiple apps. > > >> > > >> Would not recommend this unless necessary. Apart from multiple apps, > > what > > >> else is required? It is possible that this can be done via YAML, which > > >> should be easier to use. > > >> > > >> The Yaml file option you mentioned must also have to do something on > > >> similar lines, can I do something similar is my own AppMain which > > extends > > >> Brooklyn's Main Class. > > >> > > >> See above, what else would it need to do? > > >> > > >> Another option would be to use the Brooklyn CLI which is currently > being > > >> developed, see here <https://github.com/brooklyncentral/brooklyn-cli > >. > > >> Please note this is a fairly new project that is under active > > development. > > >> > > >> Regards, > > >> Graeme > > >> > > >> On 23 December 2015 at 17:10, Abhishek Sharma <[email protected] > > > > >> wrote: > > >> > > >> > Hey Graeme, > > >> > > > >> > I can try this. Is there an actual code example of such a kind you > can > > >> > point me to ? > > >> > > > >> > Although, Ideally I would like to be able to do this from Java code > > >> itself. > > >> > The way I am looking at this is following: > > >> > > > >> > 1. Treating Brooklyn as my central guy for deploying and monitoring > > all > > >> my > > >> > services > > >> > > > >> > 2. I have extending the Main class and added some custom flags for > my > > >> own > > >> > needs. I also extend the main.launch command and use my own. Were I > > have > > >> > over-ridden the call method. I use setAppToLaunch() to set the app I > > >> want > > >> > to launch. I was looking for some way to set multiple apps. > > >> > > > >> > The Yaml file option you mentioned must also have to do something on > > >> > similar lines, can I do something similar is my own AppMain which > > >> extends > > >> > Brooklyn's Main Class. > > >> > > > >> > Thanks, > > >> > Abhi > > >> > > > >> > On Wed, Dec 23, 2015 at 2:53 AM Graeme Miller < > > >> > [email protected]> wrote: > > >> > > > >> > > Hi Abhishek, > > >> > > > > >> > > The Brooklyn launch command allows you to specify an application > > with > > >> the > > >> > > '-a' option. However, it only allows you to specify one > application. > > >> > > > > >> > > This specified application can be either a Java Class or a YAML > > file. > > >> One > > >> > > solution to this would be to write a small YAML file that defines > an > > >> > > application that starts both your node.js and drop-wizard > entities. > > >> The > > >> > > file would contain only three lines: > > >> > > > > >> > > > services: > > >> > > > > >> > > - type: com.abhishek.dropwizzard > > >> > > > > >> > > - type: com.abhishek.nodejs > > >> > > > > >> > > > > >> > > > > >> > > You can then use the YAML file as the -a option. Would that be a > > >> suitable > > >> > > solution? > > >> > > > > >> > > Regards, > > >> > > Graeme > > >> > > > > >> > > > > >> > > > > >> > > On 23 December 2015 at 07:12, Abhishek Sharma < > > [email protected] > > >> > > > >> > > wrote: > > >> > > > > >> > > > Hey guys, > > >> > > > > > >> > > > I am trying to make Brooklyn start my node.js web application > and > > >> also > > >> > a > > >> > > > drop-wizard based java service. I am using Java Blueprints and > not > > >> > YAML. > > >> > > > > > >> > > > How do I make brooklyn start multiple applications ? > > >> > > > My goal is to start these based on a command line parameters > > passed > > >> > when > > >> > > > starting brooklyn. > > >> > > > > > >> > > > Thanks in advance, > > >> > > > Abhi > > >> > > > > > >> > > > > >> > > > >> > > > > > > > > >
