Giter VIP home page Giter VIP logo

puppet-activemq's Introduction

puppet-activemq

Build Status Puppet Forge Puppet Forge

Table of Contents

  1. Overview
  2. Requirements
  3. Usage
  4. Reference
  5. Limitations
  6. Development

Overview

A puppet module to install and configure ActiveMQ Artemis.

PLEASE NOTE: Legacy ActiveMQ is NOT supported by this module.

Requirements

A working Java installation is required (puppetlabs-java is highly recommended). The module is designed for Hiera, so there may be some rough edges when used without Hiera.

Usage

Basic usage

The minimum configuration should at least specify the admin password, the desired version and the checksum of the distribution archive (bin.tar.gz). The checksum is available from ActiveMQ's download page.

class { 'java': }
class { 'activemq':
  admin_password => 'seCReT',
  admin_user => 'admin',
  checksum => 'a73331cb959bb0ba9667414682c279bc9ce2aec4c8fecbcdee4670bf9d63bf66010c8c55a6b727b1ad6d51bbccadd663b96a70b867721d9388d54a9391c6af85',
  instances => {'activemq' => {}},
  version => '2.23.1',
}

This will install and configure a standalone instance of ActiveMQ Artemis.

Multiple instances

Multiple instances can be setup like this:

$instances = {
  'instance1' => {
    bind => '127.0.0.1',
    port => 61616,
    web_port => 8161,
    acceptors => {
      artemis => { port => 61616 },
      amqp => { port => 5672 },
    },
  },
  'instance2' => {
    bind => '127.0.0.1',
    port => 62616,
    web_port => 8261,
    acceptors => {
      artemis => { port => 62616 },
      amqp => { port => 5772 },
    },
  },
  'instance3' => {
    bind => '127.0.0.1',
    port => 63616,
    web_port => 8361,
    acceptors => {
      artemis => { port => 63616 },
      amqp => { port => 5872 },
    },
  }
}

class { 'java': }
class { 'activemq':
  checksum => 'a73331cb959bb0ba9667414682c279bc9ce2aec4c8fecbcdee4670bf9d63bf66010c8c55a6b727b1ad6d51bbccadd663b96a70b867721d9388d54a9391c6af85',
  instances => $instances,
  version => '2.23.1',
}

Note that you need to modify the port numbers for each instance when running on the same host (as demonstrated in this example), so that they do not try to bind on the same IP:PORT combination.

Instead of using the $instances parameter, the defined type can also be used directly:

activemq::instance { 'test1':
  bind => $facts['networking']['ip'],
  port => 61616,
  ...
}

But contrary to the $instances parameter, all required parameters have to be provided when using the defined type directly.

Clusters

Complex cluster configurations are also supported. You should provide a complete $cluster_topology on every node. Use target_host to let the module automatically setup the instances on the correct servers. For example:

$cluster_topology = {
  'node1' => {
    target_host => 'server1.example.com',
    bind => '10.0.0.1',
    group => 'green'
  },
  'node2' => {
    target_host => 'server3.example.com',
    bind => '10.0.0.2',
    group => 'green',
    role => 'slave'
  },
  'node3' => {
    target_host => 'server2.example.com',
    bind => '10.0.0.3',
    group => 'yellow'
  },
  'node4' => {
    target_host => 'server1.example.com',
    bind => '10.0.0.4',
    group => 'yellow',
    role => 'slave'
  },
  'node5' => {
    target_host => 'server3.example.com',
    bind => '10.0.0.5',
    group => 'white'
  },
  'node6' => {
    target_host => 'server2.example.com',
    bind => '10.0.0.6',
    group => 'white',
    role => 'slave'
  },
}

class { 'java': }
class { 'activemq':
  checksum => '84b5a65d8eb2fc8cf3f17df524d586b0c6a2acfa9a09089d5ffdfc1323ff99dfdc775b2e95eec264cfeddc4742839ba9b0f3269351a5c955dd4bbf6d5ec5dfa9',
  cluster => true,
  cluster_name => 'cluster001',
  cluster_password => 'seCReT'
  cluster_user => 'clusteradmin'
  cluster_topology => $cluster_topology,
  instances => $cluster_topology,
  server_discovery => 'static',
  version => '2.14.0',
}

Note that the parameters $cluster_topology and $instances both use the same values. If this configuration is used on host server1.example.com, then the module ensures that only instances node1 and node4 are installed, all other instances are ignored and will be installed only on the specified target host.

Also note that this examples assumes that each instance is running on it's own IP address. If multiple instances share the same IP address you need to change the port numbers to avoid conflicts (see "Multiple instances").

The $cluster_topology parameter is also used by the module to setup communication between cluster nodes (depending on your configuration).

Security, Roles, Users and Queues

The instance configuration can be changed by using the required parameter or by modifying $activemq::instance_defaults (which will apply to all instances). The module data contains pretty verbose examples on how to configure queues, roles and users. Please open a GitHub issue if these examples require further explanation.

Custom configuration

The module should provide a sane default configuration for many use-cases, but overriding these values for all instances is pretty easy:

class { 'activemq':
  instance_defaults => {
    acceptors => {
      artemis => {
        enable => false,
      },
      stomp => {
        enable => true,
      },
    },
    acceptor_settings => [
      'tcpSendBufferSize=1048576',
    ],
    allow_failback => false,
    check_for_live_server => false,
    max_hops => 2,
  },
}

Please have a look at the examples in the module data to find all supported settings.

The module is designed for Hiera so it is highly recommended if you need to change the default configuration.

Reference

Classes and parameters are documented in REFERENCE.md.

Limitations

Upgrades of ActiveMQ Artemis are supported to a certain degree, provided that the new version is compatible with this module. Please note that in-place upgrades are performed and the official upgrade script is not used. This may have unwanted side-effect. Overall this upgrade procedure should be pretty safe for multi-instance primary/backup setups.

Development

Contributing

Please use the GitHub issues functionality to report any bugs or requests for new features. Feel free to fork and submit pull requests for potential contributions.

All contributions must pass all existing tests, new features should provide additional unit/acceptance tests.

puppet-activemq's People

Contributors

fraenki avatar lightning- avatar michaelkoettenstorfer avatar

Stargazers

Jonny van der Hoeven avatar Luander avatar Birger J. Nordølum avatar  avatar

Watchers

Peter Gierl avatar James Cloos avatar  avatar

puppet-activemq's Issues

Not compatible with live-only ha-policy

<ha-policy>
<<%= $ha_policy %>>
<<%= $role %>>
<% if !empty($group) { -%>
<group-name><%= $group %></group-name>
<% } -%>
<cluster-name><%= $activemq::cluster_name %></cluster-name>
<% if $ha_policy == 'replication' { -%>
<initial-replication-sync-timeout><%= $initial_replication_sync_timeout %></initial-replication-sync-timeout>
<% if $check_for_live_server and $role == 'master' { -%>
<check-for-live-server>true</check-for-live-server>
<% } -%>
<% if $vote_on_replication_failure and $role == 'master' { -%>
<vote-on-replication-failure>true</vote-on-replication-failure>
<% } -%>
<% } -%>
<% if $ha_policy == 'shared-storage' { -%>
<% if $failover_on_shutdown and $role == 'master' { -%>
<failover-on-shutdown>true</failover-on-shutdown>
<% } -%>
<% } -%>
<% if $allow_failback and $role == 'slave' { -%>
<allow-failback>true</allow-failback>
<% } -%>
</<%= $role %>>
</<%= $ha_policy %>>
</ha-policy>
<% } -%>

If you want to set up a cluster without having persistent replication, i.e. live-only. This module will produce an invalid configuration file.

If you want the default cluster configuration of Artemis you would omit the whole <ha-policy> element. But this is not possible.
If you set the $ha-policy to live-only it will start producing invalid configurations like:

<ha-policy>
	<live-only>
		<scale-down>
			<master>
				<group-name>devgroup</group-name>
				<cluster-name>development</cluster-name>
			</master>
		</scale-down>
	</live-only>
</ha-policy>
ERROR [org.apache.activemq.artemis.core.client] AMQ214019: Invalid configuration
org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element '{"urn:activemq:core":master}'. One of '{"urn:activemq:core":enabled, "urn:activemq:core":group-name, "urn:activemq:core":discovery-group-ref, "urn:activemq:core":connectors}' is expected.

The correct config would be either no ha-policy element. Or

<ha-policy>
	<live-only />
</ha-policy>

Further more, using live-only with scale down is also not possible. Due to the way the config is created.

See also the schema for live-only

Failed at step EXEC spawning /var/lib/activemq-brokers/%i/bin/artemis-service: No such file or directory

Hello. I'm having a issue when try to provision artemis in single instance. Thats my hieradata:

activemq::version: "2.19.0"
activemq::download_url: "http://archive.apache.org/dist/activemq/activemq-artemis/2.19.0/apache-artemis-2.19.0-bin.tar.gz"
activemq::checksum: "dec3227cac1eb864c1c7f229cb9b392d3fa38f5022579375fda1ba378997b166cf13e4f0182a1081c6e8592e737ac665e3b4c7fb7795646ba2122d2c9a18d550"
activemq::cluster_name: "cluster-artemis"
activemq::admin_user: "admin"
activemq::admin_password: "vagrant"
activemq::instances:
  instance1:
    bind: "%{facts.networking.interfaces.eth0.ip}"
    port: 61616
    web_bind: "%{facts.networking.interfaces.eth0.ip}"
    web_port: 8161
    acceptors:
      artemis:
        port: 61616
      amqp: 
        port: 5672

I receive this output below

Debug: Executing: '/usr/bin/systemctl is-active activemq@instance1'
Debug: Executing: '/usr/bin/systemctl is-enabled activemq@instance1'
Debug: Executing: '/usr/bin/systemctl unmask activemq@instance1'
Debug: Executing: '/usr/bin/systemctl start activemq@instance1'
Debug: Running journalctl command to get logs for systemd start failure: journalctl -n 50 --since '5 minutes ago' -u activemq@instance1 --no-pager
Debug: Executing: 'journalctl -n 50 --since '5 minutes ago' -u activemq@instance1 --no-pager'
Error: Systemd start for activemq@instance1 failed!
journalctl log for activemq@instance1:
-- Logs begin at Tue 2022-02-22 16:56:00 -03, end at Wed 2022-02-23 09:25:31 -03. --
Feb 23 09:20:41 n221t032294 systemd[1]: [email protected] holdoff time over, scheduling restart.
Feb 23 09:20:41 n221t032294 systemd[1]: Starting "ActiveMQ Artemis instance instance1"...
Feb 23 09:20:41 n221t032294 systemd[1]: [email protected]: control process exited, code=exited status=203
Feb 23 09:20:41 n221t032294 systemd[1]: Failed to start "ActiveMQ Artemis instance instance1".
Feb 23 09:20:41 n221t032294 systemd[1]: Unit [email protected] entered failed state.
Feb 23 09:20:41 n221t032294 systemd[1]: [email protected] failed.
Feb 23 09:20:51 n221t032294 systemd[1]: [email protected] holdoff time over, scheduling restart.
Feb 23 09:20:51 n221t032294 systemd[1]: Starting "ActiveMQ Artemis instance instance1"...
Feb 23 09:20:51 n221t032294 systemd[1]: [email protected]: control process exited, code=exited status=203
Feb 23 09:20:51 n221t032294 systemd[1]: Failed to start "ActiveMQ Artemis instance instance1".
Feb 23 09:20:51 n221t032294 systemd[1]: Unit [email protected] entered failed state.
Feb 23 09:20:51 n221t032294 systemd[1]: [email protected] failed.
Feb 23 09:21:01 n221t032294 systemd[1]: [email protected] holdoff time over, scheduling restart.
Feb 23 09:21:01 n221t032294 systemd[1]: Starting "ActiveMQ Artemis instance instance1"...
Feb 23 09:21:01 n221t032294 systemd[1]: [email protected]: control process exited, code=exited status=203
Feb 23 09:21:01 n221t032294 systemd[1]: Failed to start "ActiveMQ Artemis instance instance1".
Feb 23 09:21:01 n221t032294 systemd[1]: Unit [email protected] entered failed state.
Feb 23 09:21:01 n221t032294 systemd[1]: [email protected] failed.
Feb 23 09:21:11 n221t032294 systemd[1]: [email protected] holdoff time over, scheduling restart.
Feb 23 09:21:11 n221t032294 systemd[1]: Starting "ActiveMQ Artemis instance instance1"...
Feb 23 09:21:11 n221t032294 systemd[1]: [email protected]: control process exited, code=exited status=203
Feb 23 09:21:11 n221t032294 systemd[1]: Failed to start "ActiveMQ Artemis instance instance1".
Feb 23 09:21:11 n221t032294 systemd[1]: Unit [email protected] entered failed state.
Feb 23 09:21:11 n221t032294 systemd[1]: [email protected] failed.
Feb 23 09:21:22 n221t032294 systemd[1]: [email protected] holdoff time over, scheduling restart.
Feb 23 09:21:22 n221t032294 systemd[1]: Starting "ActiveMQ Artemis instance instance1"...
Feb 23 09:21:22 n221t032294 systemd[16140]: Failed at step EXEC spawning /var/lib/activemq-brokers/%i/bin/artemis-service: No such file or directory

Installation throws unexpected token error.

During installation this error occurs. It seems that with the transition to markt-de forge account some hidden character has been added to some json somewhere.

Error: Received a Log attribute with invalid encoding:"unexpected token at '\x1F\x8B\b'"\nBacktrace:
C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/puppet-7.24.0/lib/puppet/util/log.rb:194:in `newmessage'
C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/puppet-7.24.0/lib/puppet/util/log.rb:319:in `initialize'
C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/puppet-7.24.0/lib/puppet/util/log.rb:87:in `new'
C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/puppet-7.24.0/lib/puppet/util/log.rb:87:in `create'
C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/puppet-7.24.0/lib/puppet/util/logging.rb:9:in `send_log'
C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/puppet-7.24.0/lib/puppet/util/logging.rb:69:in `log_exception'
C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/puppet-7.24.0/lib/puppet/application/face_base.rb:270:in `rescue in main'
C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/puppet-7.24.0/lib/puppet/application/face_base.rb:266:in `main'
C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/puppet-7.24.0/lib/puppet/application.rb:437:in `run_command'
C:/Ruby32-x64/lib/ruby/gems/3.2.0/gems/puppet-7.24.0/lib/puppet/application.rb:421:in `block in run'
Error: Try 'puppet help module install' for usage

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.