rhtconsulting / puppet-jboss_admin

Puppet module for runtime configuration of a JBoss container
MIT License
15 stars 12 forks source link

Allow for multiple instances based on multiple configuration sets #85

Open vsimhv opened 9 years ago

vsimhv commented 9 years ago

Hi, Right now I see that running jboss-cli.sh is based on ${base_path/bin/jboss_cli.sh souldn't there be options to use different configuration set by setting -Djboss.server.base.dir ? Then it should be possible to have multiple instances with single binaries, right? Second advantage would be to use non-standard configuration directory, therefore being more secure when doing updates. Default configuration can be overwriten but not the used one. What do you think?

itewk commented 9 years ago

Simhpl,

Personally I always push for one JBoss EAP instance per VM and the JBoss EAP 6 updates, even if there is a change to the default configuration files, does not update the existing configuration files, rather it makes a secondary copy that has the updates.

That all being said, this is already implemented.

If you look at the jboss_admin::server type there is a "base_path" property you can override to specify the base path of your installation. So that should allow you to spin up multiple instances.

vsimhv commented 9 years ago

itewk, when I specify the base_path like that then puppet does not find jboss-cli.sh because it is being searched for in $base_path/bin/ Am I missing something?

--- EDIT: To better describe my environment: /opt/jboss/eap/jboss-eap-6.3/ # here are all the ZIP provided files

/opt/jboss/instances/jboss01/ # here is configuration and deployment for instance jboss01 /opt/jboss/instances/jboss02/ # here is configuration and deployment for instance jboss02

itewk commented 9 years ago

@simhpl

oooh. I got it now. the feature is really designed to have multiple full copies all installed on the same host, not re-use the same installation for multiple instances.

If you want to submit a patch up stream to be able to use jboss_admin::server to instantiate multiple servers from the same installation I will review and merge for you.

vsimhv commented 9 years ago

@itewk, I tried to prepare a patch but, unfortunately, failed. I wanted to make sure that new users are not confused and existing setup does not break. What I did was:

define jboss_admin::server (
  $base_path,
  $jboss_home_dir  = undef,
  $jboss_base_dir  = undef,
...
  if !$jboss_home_dir {
    validate_absolute_path($base_path)
    $jboss_bin_path = $base_path
  } else {
    validate_absolute_path($jboss_home_dir)
    $jboss_bin_path = $jboss_home_dir
  }

and then in cli-_execution.rb:

cli_path = "#{server['jboss_bin_path']}/bin/jboss-cli.sh"

But puppet fails because the jboss_bin_path is empty when the fuction is being run. I think it's a problem with ordering. I know it's more puppet related than jboss_admin related but do you have an idea how to fix it? or do it better?

--- EDIT: OK, I think that is more tricky than I thought. I tried to setup two instances (standalone) and it's failing because of duplicate declarations for jboss_admin::resource::interface. Is there a way to use porcelain type and setup '/interface=public' for two instances? I am asking about interfaces here but the same issue applies to every other resource, right? Does that mean that multiple instances are not supported? What about Domain mode?

itewk commented 9 years ago

@simhpl

the duplicate resource thing is an issue for sure. I know there is a concept of multi part titles but I am having a hard time finding the documenation right now on it. But could do something with having the title contain both the CLI command and the server.

But the simplier solution would be:

jboss_admin::resource::interface { 'Server 1: interface':
  server   => 'server1',
  cli_path => '/interface=public',
  ...
}

jboss_admin::resource::interface { 'Server 2: interface':
  server   => 'server2',
  cli_path => '/interface=public',
  ...
}

This will avoid the duplicate resource problem because both resources will have a different name.

vsimhv commented 9 years ago

@itewk unfortunately that will not help because we still have the same issue with jboss_resource, where the $cli_path is used as a name

itewk commented 9 years ago

@simhpl

Good point. I opened #87 for that. If you want to update the ruby code to change the jboss_admin::resource::* generation and regenerate all the types using the provided rake commands then I can review and merge the change.

vsimhv commented 9 years ago

@itewk

Could you point me what and where should be changed? I would be more than happy to try submitting PR but I am failing to find the origin of the problem. For me thare are two issues: 1) cli_path being the title of the jboss_resource 2) base_path being used to build path for jboss_cli.sh - I already tried to solve it, like I mentioned before, but there is a problem with ordering. The base_path is not "ready" at the time when puppet wants to use it that makes it fail.

itewk commented 9 years ago

@simhpl i put a comment on bug #87 to get you started.