11 Replies Latest reply on Sep 27, 2011 10:58 AM by chrishiner

    Creating the default domain configuration from the CLI

    chrishiner

      While learning my way around the CLI management interface, I created a script that creates nearly the entire domain.xml file using the CLI.  I figured others might find it useful.  This is just the web profile domain.xml, not the preview stuff, as I found some rough spots there (the jacorb subsystem doesn't appear to be configurable at all from the CLI for example.)

       

      The only parts that don't work currently:

      /profile=default:add()

      /profile=ha:add()

      I don't see a way from the CLI to set advertise-socket="modcluster" in the modcluster subsystem.

        • 1. Re: Creating the default domain configuration from the CLI
          jaikiran

          Chris Hiner wrote:

           

          The only parts that don't work currently:

          /profile=default:add()

          /profile=ha:add()

           

          Is that this issue http://community.jboss.org/thread/172087?tstart=30?

          • 2. Re: Creating the default domain configuration from the CLI
            chrishiner

            Yes.  I just created AS7-1801 for that, as I mentioned in that thread.

            • 3. Re: Creating the default domain configuration from the CLI
              emuckenhuber

              Chris Hiner wrote:

               

              Yes.  I just created AS7-1801 for that, as I mentioned in that thread.

              Thanks. Yeah, that should be fixed.

               

              In the meatime you could try to use the batch mode of the CLI - which would create a composite operation and only try to persist the complete model after all operations complete successfully. In order to do that you would need to add 'batch' and 'run-batch' to the script. I haven't tired myself, but perhaps you want to give that a try.

              • 4. Re: Creating the default domain configuration from the CLI
                chrishiner

                That does work:

                batch

                /profile=exampleprofile:add()

                /profile=exampleprofile/subsystem=ee:add()

                run-batch

                 

                 

                While I'm on the subject of CLI profile management:

                /profile=exampleprofile:remove()

                    "failure-description" => {"domain-failure-description" => "subsytems are not empty"},

                 

                 

                Since many of the subsystems don't have remove() operations yet, it's not possible to remove profiles.

                Would it make sense for removing a profile to just remove all the subsystems in it?

                • 5. Re: Creating the default domain configuration from the CLI
                  emuckenhuber

                  Chris Hiner wrote:

                   

                  That does work:

                  batch

                  /profile=exampleprofile:add()

                  /profile=exampleprofile/subsystem=ee:add()

                  run-batch

                  Yes, that's what i meant.

                  Chris Hiner wrote:

                   

                  While I'm on the subject of CLI profile management:

                  /profile=exampleprofile:remove()

                      "failure-description" => {"domain-failure-description" => "subsytems are not empty"},

                   

                   

                  Since many of the subsystems don't have remove() operations yet, it's not possible to remove profiles.

                  Would it make sense for removing a profile to just remove all the subsystems in it?

                  Yes, having to remove a profile wouldn't make sense, just to remove a single subsystem. Unfortunately most of the subsystem remove operations are missing. We already have a open jira issue to track that: https://issues.jboss.org/browse/AS7-470

                  • 6. Re: Creating the default domain configuration from the CLI
                    chrishiner

                    I'm working towards completely automating the creation and updating of all the configuration information so I can tie it into our existing deployment system, like we've done for several other application servers. 

                     

                    I was thinking that until all the subsystems have remove operations (and writable attributes or other operations to configure everything), it'd be simplest to just remove the entire profile (and all the subsystems) and recreate it with the new options.  About the same amount of scripting compared to reading the existing configuration and figuring out what has changed or needs to be changed.

                    • 7. Re: Creating the default domain configuration from the CLI
                      mylos78

                      Hello,

                      thanks for the useful post. Have you perhaps managed to add the messaging subsystem (contained in the preview configuration file) via the CLI ? I'd like to add and remove it using CLI scripts. Any help ?

                      Thanks in advance

                      Mylos

                      • 8. Re: Creating the default domain configuration from the CLI
                        emuckenhuber

                        The next release of AS7 should contain a lot more management operations, particular in the messaging subsystem.

                        • 9. Re: Creating the default domain configuration from the CLI
                          emuckenhuber

                          sounds interesting, perhaps you can let use know how that works out for you.

                           

                          One thing which might i should have mention regarding composite operations (or a batch in the CLI) is that in case there is failure we rollback the complete composite operation / batch. This might be interesting for you as well.

                          • 10. Re: Creating the default domain configuration from the CLI
                            chrishiner

                            I did some initial work on the preview configuration parts as well, but I found more gaps in the management interface there.

                            Here's a file with the messaging and webservices subsystems.  I didn't test these as much as the non-preview stuff, so you might find some issues.

                            The messaging subsystem does have a remove operation:

                            /profile=ha/subsystem=messaging:remove()

                             

                            The messaging subsystem has lots of operations available.  Seems to be one of the more complete subsystems when it comes to management operations.

                            • 11. Re: Creating the default domain configuration from the CLI
                              chrishiner

                              In domain-controller/src/main/java/org/jboss/as/domain/controller/operations/ProfileRemoveHandler.java I commented out these lines:

                              if (context.readModel(PathAddress.EMPTY_ADDRESS).get(SUBSYSTEM).keys().size() > 0) { // TODO replace with a reasonable check 

                                throw new OperationFailedException(new ModelNode().set("subsytems are not empty"));

                              }

                               

                              Now I can remove the whole profile and rebuild it via my script to workaround not being able to remove subsystems.