Merge "Optimize kitchen tests for Travis CI"
diff --git a/README.rst b/README.rst
index 6a8a131..16f89e8 100644
--- a/README.rst
+++ b/README.rst
@@ -27,11 +27,11 @@
plugins:
- amqp_client
- rabbitmq_management
- virtual_hosts:
- - enabled: true
- host: '/monitor'
- user: 'monitor'
- password: 'password'
+ host:
+ '/monitor':
+ enabled: true
+ user: 'monitor'
+ password: 'password'
RabbitMQ as a Stomp broker
@@ -44,11 +44,11 @@
bind:
address: 0.0.0.0
port: 5672
- virtual_hosts:
- - enabled: true
- host: '/monitor'
- user: 'monitor'
- password: 'password'
+ host:
+ '/monitor':
+ enabled: true
+ user: 'monitor'
+ password: 'password'
plugins:
- rabbitmq_stomp
@@ -87,16 +87,15 @@
server:
enabled: true
...
- virtual_hosts:
- - enabled: true
- host: '/monitor'
- user: 'monitor'
- password: 'password'
- policies:
- - name: HA
- pattern: '^(?!amq\.).*'
- definition: '{"ha-mode": "all"}'
-
+ host:
+ '/monitor':
+ enabled: true
+ user: 'monitor'
+ password: 'password'
+ policies:
+ - name: HA
+ pattern: '^(?!amq\.).*'
+ definition: '{"ha-mode": "all"}'
Enable TLS support
diff --git a/metadata/service/support.yml b/metadata/service/support.yml
index 8430304..afaa3b6 100644
--- a/metadata/service/support.yml
+++ b/metadata/service/support.yml
@@ -19,3 +19,5 @@
enabled: true
prometheus:
enabled: true
+ fluentd:
+ enabled: true
diff --git a/rabbitmq/files/limits.conf b/rabbitmq/files/limits.conf
new file mode 100644
index 0000000..c44792b
--- /dev/null
+++ b/rabbitmq/files/limits.conf
@@ -0,0 +1,4 @@
+{%- from "rabbitmq/map.jinja" import server with context -%}
+# Managed by Salt
+[Service]
+LimitNOFILE={{ server.ulimit }}
diff --git a/rabbitmq/files/rabbitmq.config b/rabbitmq/files/rabbitmq.config
index 5f1352a..4cef5ca 100644
--- a/rabbitmq/files/rabbitmq.config
+++ b/rabbitmq/files/rabbitmq.config
@@ -5,7 +5,7 @@
{disk_free_limit, {{ server.disk_free_limit }}},
{%- if pillar.rabbitmq.cluster is defined %}
{%- from "rabbitmq/map.jinja" import cluster with context %}
- {cluster_partition_handling, autoheal},
+ {cluster_partition_handling, {{ cluster.partition_handling }}},
{tcp_listen_options,
[binary,
{packet, raw},
diff --git a/rabbitmq/map.jinja b/rabbitmq/map.jinja
index ab96873..f169d0b 100644
--- a/rabbitmq/map.jinja
+++ b/rabbitmq/map.jinja
@@ -12,6 +12,7 @@
'env_file': '/etc/rabbitmq/rabbitmq-env.conf',
'cookie_file': '/var/lib/rabbitmq/.erlang.cookie',
'ulimit': 8192,
+ 'limits_file': '/etc/systemd/system/rabbitmq-server.service.d/limits.conf',
'disk_free_limit': 50000000,
'bind': {
'address': '0.0.0.0',
@@ -43,8 +44,11 @@
},
}, merge=pillar.rabbitmq.get('server', {}), base='default') %}
-{% set cluster = pillar.rabbitmq.get('cluster', {}) %}
-
+{% set cluster = salt['grains.filter_by']({
+ 'default': {
+ 'partition_handling': 'autoheal',
+ },
+}, merge=salt['pillar.get']('rabbitmq:cluster'), base='default') %}
{%- set rabbitmq_users = {} %}
{%- for host_name, host in server.get('host', {}).iteritems() %}
{%- do rabbitmq_users.update({host.user: [host]}) %}
diff --git a/rabbitmq/meta/fluentd.yml b/rabbitmq/meta/fluentd.yml
new file mode 100644
index 0000000..0b75d10
--- /dev/null
+++ b/rabbitmq/meta/fluentd.yml
@@ -0,0 +1,37 @@
+{%- if pillar.get('fluentd', {}).get('agent', {}).get('enabled', False) %}
+agent:
+ config:
+ label:
+ rabbitmq:
+ input:
+ tail_rabbitmq:
+ type: tail
+ tag: rabbitmq
+ path: /var/log/rabbitmq/rabbit*.log
+ pos_file: {{ pillar.fluentd.agent.dir.positiondb }}/rabbitmq.pos
+ parser:
+ type: multiline
+ time_key: Timestamp
+ time_format: '%d-%b-%Y::%H:%M:%S'
+ keep_time_key: false
+ format_firstline: '/=[A-Z]+\sREPORT====/'
+ format: '/^=(?<orig_severity_label>[A-Z]+)\sREPORT====\s(?<Timestamp>.*)\s===\n(?<Payload>.*)/'
+ filter:
+ match_severity:
+ type: record_transformer
+ tag: rabbitmq
+ remove_keys: orig_severity_label
+ enable_ruby: true
+ record:
+ - name: programname
+ value: rabbitmq
+ - name: severity_label
+ value: ${ {'INFO'=>'INFO','NOTICE'=>'NOTICE','SUPERVISOR'=>'NOTICE','WARNING'=>'WARNING','ERROR'=>'ERROR','CRASH'=>'CRITICAL'}[record['orig_severity_label']] }
+ - name: Severity
+ value: ${ {'INFO'=>6,'NOTICE'=>5,'SUPERVISOR'=>5,'WARNING'=>4,'ERROR'=>3,'CRASH'=>2}[record['orig_severity_label']].to_i }
+ match:
+ push_to_default:
+ tag: rabbitmq
+ type: relabel
+ label: default_output
+{%- endif %}
diff --git a/rabbitmq/server/service.sls b/rabbitmq/server/service.sls
index 363c23b..1333144 100644
--- a/rabbitmq/server/service.sls
+++ b/rabbitmq/server/service.sls
@@ -32,6 +32,22 @@
{%- endif %}
+{%- if grains.init == 'systemd' %}
+
+rabbitmq_limits_systemd:
+ file.managed:
+ - name: {{ server.limits_file }}
+ - source: salt://rabbitmq/files/limits.conf
+ - template: jinja
+ - user: root
+ - group: root
+ - makedirs: True
+ - mode: 0644
+ - require:
+ - pkg: rabbitmq_packages
+
+{%- endif %}
+
{%- if server.secret_key is defined and not grains.get('noservices', False) %}
{%- if salt['cmd.run']('cat '+server.cookie_file) != server.secret_key %}
@@ -96,6 +112,9 @@
- name: {{ server.service }}
- watch:
- file: rabbitmq_config
+ {%- if grains.init == 'systemd' %}
+ - file: rabbitmq_limits_systemd
+ {%- endif %}
{% if server.ssl.enabled %}
- file: rabbitmq_cacertificate
- file: rabbitmq_certificate
diff --git a/tests/run_tests.sh b/tests/run_tests.sh
index 3f42101..9451611 100755
--- a/tests/run_tests.sh
+++ b/tests/run_tests.sh
@@ -110,7 +110,7 @@
}
salt_run() {
- [ -e ${VEN_DIR}/bin/activate ] && source ${VENV_DIR}/bin/activate
+ [ -e ${VENV_DIR}/bin/activate ] && source ${VENV_DIR}/bin/activate
salt-call ${SALT_OPTS} $*
}