From cfda2f626d53f43fe7649df45f3cc394167e0ba7 Mon Sep 17 00:00:00 2001 From: Donovan Francesco Date: Thu, 18 Aug 2016 15:46:59 +0200 Subject: [PATCH] Initial Commit --- CHANGELOG | 1 + CONTRIBUTING.md | 1 + LICENSE | 192 +------------- README.md | 32 +++ defaults/main.yml | 92 +++++++ meta/main.yml | 34 +++ setup.cfg | 24 ++ setup.py | 25 ++ tasks/configure_graphana.yml | 51 ++++ tasks/configure_influxdb.yml | 49 ++++ tasks/configure_kafka.yml | 57 ++++ tasks/configure_storm.yml | 48 ++++ tasks/configure_zookeeper.yml | 56 ++++ tasks/install_graphana.yml | 73 +++++ tasks/install_influxdb.yml | 36 +++ tasks/install_kafka.yml | 38 +++ tasks/install_storm.yml | 38 +++ tasks/main.yml | 72 +++++ tasks/post-install.yml | 18 ++ tasks/pre-install.yml | 60 +++++ templates/graphana/graphana-server.j2 | 146 ++++++++++ templates/graphana/graphana.ini.j2 | 13 + templates/influxdb/influxdb.conf.j2 | 322 +++++++++++++++++++++++ templates/influxdb/influxdb.j2 | 18 ++ templates/kafka/kafka-server-start.sh.j2 | 38 +++ templates/kafka/kafka.j2 | 34 +++ templates/kafka/log4j.properties.j2 | 71 +++++ templates/kafka/server.properties.j2 | 118 +++++++++ templates/storm/cluster.xml.j2 | 85 ++++++ templates/storm/storm-nimbus.conf.j2 | 30 +++ templates/storm/storm-supervisor.conf.j2 | 30 +++ templates/storm/storm.yml.j2 | 58 ++++ templates/zookeeper/environment.j2 | 35 +++ templates/zookeeper/log4j.properties.j2 | 68 +++++ templates/zookeeper/zoo.cfg.j2 | 73 +++++ vars/ubuntu-14.04.yml | 35 +++ 36 files changed, 1981 insertions(+), 190 deletions(-) create mode 100644 CHANGELOG create mode 100644 CONTRIBUTING.md create mode 100644 README.md create mode 100644 defaults/main.yml create mode 100644 meta/main.yml create mode 100644 setup.cfg create mode 100644 setup.py create mode 100644 tasks/configure_graphana.yml create mode 100644 tasks/configure_influxdb.yml create mode 100644 tasks/configure_kafka.yml create mode 100644 tasks/configure_storm.yml create mode 100644 tasks/configure_zookeeper.yml create mode 100644 tasks/install_graphana.yml create mode 100644 tasks/install_influxdb.yml create mode 100644 tasks/install_kafka.yml create mode 100644 tasks/install_storm.yml create mode 100644 tasks/main.yml create mode 100644 tasks/post-install.yml create mode 100644 tasks/pre-install.yml create mode 100644 templates/graphana/graphana-server.j2 create mode 100644 templates/graphana/graphana.ini.j2 create mode 100644 templates/influxdb/influxdb.conf.j2 create mode 100644 templates/influxdb/influxdb.j2 create mode 100644 templates/kafka/kafka-server-start.sh.j2 create mode 100644 templates/kafka/kafka.j2 create mode 100644 templates/kafka/log4j.properties.j2 create mode 100644 templates/kafka/server.properties.j2 create mode 100644 templates/storm/cluster.xml.j2 create mode 100644 templates/storm/storm-nimbus.conf.j2 create mode 100644 templates/storm/storm-supervisor.conf.j2 create mode 100644 templates/storm/storm.yml.j2 create mode 100644 templates/zookeeper/environment.j2 create mode 100644 templates/zookeeper/log4j.properties.j2 create mode 100644 templates/zookeeper/zoo.cfg.j2 create mode 100644 vars/ubuntu-14.04.yml diff --git a/CHANGELOG b/CHANGELOG new file mode 100644 index 0000000..505d21d --- /dev/null +++ b/CHANGELOG @@ -0,0 +1 @@ +# CHANGELOG \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..f7add82 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1 @@ +# CONTRIBUTING \ No newline at end of file diff --git a/LICENSE b/LICENSE index 8dada3e..cd1b48a 100644 --- a/LICENSE +++ b/LICENSE @@ -1,192 +1,4 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} +Copyright 2016 Internet Solutions (Pty) Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -198,4 +10,4 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and - limitations under the License. + limitations under the License. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..6c6603c --- /dev/null +++ b/README.md @@ -0,0 +1,32 @@ +# OpenStack Ansible Monasca + +An `openstack-ansible` compatible role for deploying the Monasca Monitoring-as-a-Service +feature to ECS OpenStack clouds. + +## What It Installs + +### Core Monasca Services + +* `monasca-api` +* `monasca-persister` +* `monasca-notification` +* `monasca-thresh` +* `monasca-agent` +* `monasca-dashboard` (Horizon plugin) + +### Additional Services + +* `chrony` +* `zookeeper` +* `kafka` +* `storm` +* `influxdb` +* `grafana` + +## Copyright + +Copyright © 2016 Internet Solutions (Pty) Ltd + +## License + +Licensed under the Apache Software License 2.0. See LICENSE for details. diff --git a/defaults/main.yml b/defaults/main.yml new file mode 100644 index 0000000..93940b6 --- /dev/null +++ b/defaults/main.yml @@ -0,0 +1,92 @@ +--- +# Copyright 2016 Internet Solutions (Pty) Ltd +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# (c) 2016 Donovan Francesco +# (c) 2016 Paul Stevens +# +# +# Originally obtained from https://github.com/elastic/ansible-elasticsearch +# +kafka_directory: "/opt/kafka" + +## Monasca +monasca_common_git_repo: "https://git.openstack.org/openstack/monasca-common.git" +monasca_api_git_repo: "https://git.openstack.org/openstack/monasca-api.git" +monasca_persister_git_repo: "https://git.openstack.org/openstack/monasca-persister.git" +monasca_notification_git_repo: "https://git.openstack.org/openstack/monasca-notification.git" +monasca_thresh_git_repo: "https://git.openstack.org/openstack/monasca-thresh.git" +monasca_ui_git_repo: "https://git.openstack.org/openstack/monasca-ui.git" +monasca_client_git_repo: "https://git.openstack.org/openstack/python-monascaclient.git" +monasca_git_branch: "master" + +## Grafana +grafana_plugins_git_repo: "https://github.com/twc-openstack/grafana-plugins.git" +grafana_plugins_git_branch: "v2.6.0" +grafana_git_repo: "https://github.com/twc-openstack/grafana.git" +grafana_git_branch: "v2.6.0-keystone" + +## Keystone +keystone_ip_address: "127.0.0.1" +# admin credentials +os_username: "admin" +os_password: "secretadmin" +os_project_name: "admin" + +# monasca-user credentials +os_mon_username: "mini-mon" +os_mon_password: "password" +os_mon_project_name: "mini-mon" + +# monasca-agent credentials +os_mon_agent_username: "monasca-agent" +os_mon_agent_password: "password" + +## Database +mysql_root_pass: "secretdatabase" + +## InfluxDB +influxdb_version: "0.9.5" + +## Kafka +base_kafka_version: "0.10.0.0" +kafka_version: "kafka_2.11-{{ base_kafka_version }}" + +## Storm +storm_version: "1.0.1" +storm_logback_dir: "log4j2" + +## NTP +ntp_servers: + - ntp.is.co.za + +## System info +monasca_system_user_name: monasca +monasca_system_group_name: monasca +monasca_system_shell: /bin/false +monasca_system_comment: monasca system user +monasca_system_user_home: "/var/lib/{{ monasca_system_user_name }}" + +pip_install_options: "" + +monasca_required_pip_packages: + - virtualenv + - virtualenv-tools + - httplib2 + +# Common pip packages +monasca_pip_packages: + - python-keystoneclient + - keystoneauth1 + - simport diff --git a/meta/main.yml b/meta/main.yml new file mode 100644 index 0000000..814d3eb --- /dev/null +++ b/meta/main.yml @@ -0,0 +1,34 @@ +--- +# Copyright 2016 Internet Solutions (Pty) Ltd +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# (c) 2016 Donovan Francesco +# (c) 2016 Paul Stevens +# +allow_duplicates: yes + +galaxy_info: + author: "Donovan Francesco, Paul Stevens" + description: "Apache Kafka for ECS" + company: "Internet Solutions" + license: "license (Apache)" + min_ansible_install: 1.9 + platforms: + - name: Ubuntu + versions: + - all + categories: + - system + + dependencies: [] diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..a7eac27 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,24 @@ +[metadata] +name = openstack-ansible-os_monasca +summary = Monitoring-as-a-Service for OpenStack Ansible +description-file = + README.rst +author = IS Open Cloud +author-email = is.cloud.infrastructure.opencloud@is.co.za +home-page = http://www.is.co.za/ +classifier = + Intended Audience :: Developers + Intended Audience :: System Administrators + License :: OSI Approved :: Apache Software License + Operating System :: POSIX :: Linux + +[build_sphinx] +all_files = 1 +build-dir = doc/build +source-dir = doc/source + +[pbr] +warnerrors = True + +[wheel] +universal = 1 diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..ef930b6 --- /dev/null +++ b/setup.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python +# +# Copyright 2016 Internet Solutions (Pty) Ltd +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# (c) 2016 Donovan Francesco +# (c) 2016 Paul Stevens +# +# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT +import setuptools + +setuptools.setup( + setup_requires=['pbr'], + pbr=True) diff --git a/tasks/configure_graphana.yml b/tasks/configure_graphana.yml new file mode 100644 index 0000000..281fe2c --- /dev/null +++ b/tasks/configure_graphana.yml @@ -0,0 +1,51 @@ +--- +# Copyright 2016 Internet Solutions (Pty) Ltd +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# (c) 2016 Donovan Francesco +# (c) 2016 Paul Stevens +# +- name: Copy Graphana Templates + template: + src: "{{ item.src }}" + dest: "{{ item.dest }}" + owner: "{{ item.owner }}" + group: "{{ item.group }}" + mode: "0644" + register: configure_graphana + until: configure_graphana | success + retries: 5 + delay: 3 + with_items: + - src: "grafana/grafana-server.j2" + dest: "/etc/init.d/grafana-server" + owner: "root" + group: "root" + mode: "0775" + - src: "grafana/grafana.ini.j2" + dest: "/etc/grafana/grafana.ini" + owner: "root" + group: "root" + +- name: Setup Graphana to run at boot + command: update-rc.d graphana-server defaults 95 10 + +- name: Start the Graphana Service + service: + name: graphana-server + state: restarted + register: start_graphana + until: start_graphana | success + retries: 5 + delay: 3 diff --git a/tasks/configure_influxdb.yml b/tasks/configure_influxdb.yml new file mode 100644 index 0000000..59fb7bc --- /dev/null +++ b/tasks/configure_influxdb.yml @@ -0,0 +1,49 @@ +--- +# Copyright 2016 Internet Solutions (Pty) Ltd +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# (c) 2016 Donovan Francesco +# (c) 2016 Paul Stevens +# +- name: Copy InfluxDB Templates + template: + src: "{{ item.src }}" + dest: "{{ item.dest }}" + owner: "{{ item.owner }}" + group: "{{ item.group }}" + mode: "0644" + with_items: + - src: "influxdb/influxdb.conf.j2" + dest: "/etc/influxdb/influxdb.conf" + owner: "root" + group: "root" + - src: "influxdb/influxdb.j2" + dest: "/etc/default/influxdb" + owner: "root" + group: "root" + register: configure_influxdb + until: configure_influxdb | success + retries: 5 + delay: 3 + +- name: Restart influxdb + service: + name: "influxdb" + state: "restarted" + when: influxdb_config.changed + +- name: Sleep for 60 seconds to let Influxdb elect a leader + pause: + minutes: 1 + when: influxdb_config.changed diff --git a/tasks/configure_kafka.yml b/tasks/configure_kafka.yml new file mode 100644 index 0000000..98ba4bf --- /dev/null +++ b/tasks/configure_kafka.yml @@ -0,0 +1,57 @@ +--- +# Copyright 2016 Internet Solutions (Pty) Ltd +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# (c) 2016 Donovan Francesco +# (c) 2016 Paul Stevens +# +- name: Copy Kafka templates + template: + src: "{{ item.name }}" + dest: "{{ item.dest }}" + owner: "{{ item.owner }}" + group: "{{ item.group }}" + mode: "{{ item.mode | default('0644') }}" + with_items: + - src: "kafka/kafka-server-start.sh.j2" + dest: "/opt/kafka/bin/kafka-server-start.sh" + owner: "root" + group: "root" + mode: "0755" + - src: "kafka/kafka.j2" + dest: "/etc/init/kafka" + owner: "root" + group: "root" + - src: "kafka/log4j.properties.j2" + dest: "/opt/kafka/config/log4j.properties" + owner: "kafka" + group: "kafka" + - src: "kafka/server.properties.j2" + dest: "/opt/kafka/config/server.properties" + owner: "kafka" + group: "kafka" + register: copy_templates + until: copy_templates | success + retries: 5 + delay: 3 + +- name: Start Kafka + service: + name: "kafka" + state: "restarted" + when: kafka.config.changed + register: restart_kafka + until: restart_kafka | success + retries: 5 + delay: 3 diff --git a/tasks/configure_storm.yml b/tasks/configure_storm.yml new file mode 100644 index 0000000..b140aee --- /dev/null +++ b/tasks/configure_storm.yml @@ -0,0 +1,48 @@ +--- +# Copyright 2016 Internet Solutions (Pty) Ltd +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# (c) 2016 Donovan Francesco +# (c) 2016 Paul Stevens +# +- name: Copy Apache Storm Templates + template: + src: "{{ item.name }}" + dest: "{{ item.dest }}" + owner: "{{ item.owner }}" + group: "{{ item.group }}" + mode: "{{ item.mode | default('0644') }}" + with_items: + - src: "storm/cluster.xml.j2" + dest: "/opt/storm/{{ storm_logback_dir }}/cluster.xml" + owner: "storm" + group: "storm" + mode: "0644" + - src: "storm/storm.yaml.j2" + dest: "/opt/apache-storm-{{ storm_version }}/conf/storm.yaml" + owner: "storm" + group: "storm" + - src: "storm/storm-nimbus.conf.j2" + dest: "/etc/init/storm-nimbus.conf" + owner: "root" + group: "root" + - src: "storm/storm-supervisor.conf.j2" + dest: "/etc/init/storm-supervisor.conf" + owner: "root" + group: "root" + register: storm_config + register: copy_templates + until: copy_templates | success + retries: 5 + delay: 3 diff --git a/tasks/configure_zookeeper.yml b/tasks/configure_zookeeper.yml new file mode 100644 index 0000000..4b194a4 --- /dev/null +++ b/tasks/configure_zookeeper.yml @@ -0,0 +1,56 @@ +--- +# Copyright 2016 Internet Solutions (Pty) Ltd +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# (c) 2016 Donovan Francesco +# (c) 2016 Paul Stevens +# +- name: Copy Zookeeper Templates + template: + src: "{{ item.src }}" + dest: "{{ item.dest }}" + owner: "{{ item.owner }}" + group: "{{ item.group }}" + mode: "0644" + with_items: + - src: "zookeeper/zoo.cfg.j2" + dest: "/etc/zookeeper/conf/zoo.cfg" + owner: "root" + group: "root" + - src: "zookeeper/myid.j2" + dest: "/etc/zookeeper/conf/myid" + owner: "root" + group: "root" + - src: "zookeeper/environment.j2" + dest: "/etc/zookeeper/conf/environment" + owner: "root" + group: "root" + - src: "zookeeper/log4j.properties.j2" + dest: "/etc/zookeeper/conf/log4j.properties" + owner: "root" + group: "root" + register: configure_zookeeper + until: configure_zookeeper | success + retries: 5 + delay: 3 + +- name: Restart zookeeper + service: + name: "zookeeper" + state: "restarted" + when: zookeeper_config.changed + register: restart_zookeeper + until: restart_zookeeper | success + retries: 5 + delay: 3 diff --git a/tasks/install_graphana.yml b/tasks/install_graphana.yml new file mode 100644 index 0000000..c8c11fe --- /dev/null +++ b/tasks/install_graphana.yml @@ -0,0 +1,73 @@ +--- +# Copyright 2016 Internet Solutions (Pty) Ltd +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# (c) 2016 Donovan Francesco +# (c) 2016 Paul Stevens +# +- name: Download Go + get_url: + url: "https://storage.googleapis.com/golang/{{ graphana_golang_version }}.tar.gz" + dest: "/root/{{ graphana_golang_version }}.tar.gz" + mode: 0440 + register: download_go + until: download_go | success + retries: 5 + delay: 3 + +- name: Install Go + unarchive: + src: "/root/{{ graphana_golang_version }}.tar.gz" + dest: "/usr/local" + creates: "/usr/local/go" + copy: "no" + register: install_go + until: install_go | success + retries: 5 + delay: 3 + +- name: Setup Graphana Wheezy Repository + apt_repository: + repo: "deb https://packagecloud.io/grafana/stable/debian/ wheezy main" + state: "present" + register: add_graphana_apt + until: add_grapha_apt | success + retries: 5 + delay: 3 + +- name: Install Graphana Apt Key + apt_key: + url: "deb https://packagecloud.io/grafana/stable/debian/ wheezy main" + state: present + register: add_graphana_apt_key + until: add_graphana_apt_key | success + retries: 5 + delay: 3 + +- name: Update Apt repos + apt: + update_cache: yes + register: update_cache + until: update_cache | success + retries: 5 + delay: 3 + +- name: Install Graphana + apt: + pkg: graphana + state: latest + register: install_graphana + until: install_graphana | success + retries: 5 + delay: 3 diff --git a/tasks/install_influxdb.yml b/tasks/install_influxdb.yml new file mode 100644 index 0000000..8c94c23 --- /dev/null +++ b/tasks/install_influxdb.yml @@ -0,0 +1,36 @@ +--- +# Copyright 2016 Internet Solutions (Pty) Ltd +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# (c) 2016 Donovan Francesco +# (c) 2016 Paul Stevens +# + +- name: Download InfluxDB + get_url: + url: https://dl.influxdata.com/influxdb/releases/{{ influxdb_version }}.deb + dest: /root/{{ influxdb_version }}.deb + mode: 0600 + register: download_influxdb_deb + until: download_influxdb_deb | success + retries: 5 + delay: 5 + +- name: Install InfluxDB + apt: + deb: /root/{{ influxdb_version }}.deb + register: install_influxdb + until: install_influxdb | success + retries: 3 + delay: 2 diff --git a/tasks/install_kafka.yml b/tasks/install_kafka.yml new file mode 100644 index 0000000..1e82b69 --- /dev/null +++ b/tasks/install_kafka.yml @@ -0,0 +1,38 @@ +--- +# Copyright 2016 Internet Solutions (Pty) Ltd +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# (c) 2016 Donovan Francesco +# (c) 2016 Paul Stevens +# +- name: Download Apache Kafka + get_url: + url: http://apache.is.co.za/kafka/0.10.0.0/kafka_2.11-0.10.0.0.tgz + dest: /root/{{ kafka_version }} + mode: 0600 + register: download_kafka_binary + until: download_kafka_binary | success + retries: 5 + delay: 5 + +- name: Extract Apache Kafka archive + unarchive: + src: "/root/{{ kafka_version }}" + dest: "/opt" + creates: "/opt/kafka" + copy: "no" + register: extract_binary + until: extract_binary | success + retries: 5 + delay: 3 diff --git a/tasks/install_storm.yml b/tasks/install_storm.yml new file mode 100644 index 0000000..0db39ce --- /dev/null +++ b/tasks/install_storm.yml @@ -0,0 +1,38 @@ +--- +# Copyright 2016 Internet Solutions (Pty) Ltd +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# (c) 2016 Donovan Francesco +# (c) 2016 Paul Stevens +# +- name: Download Apache Storm + get_url: + url: "https://github.com/apache/storm/archive/{{ storm_version }}.tar.gz" + dest: "/root/apache-storm-{{ storm_version }}.tar.gz" + mode: 0600 + register: download_storm + until: download_storm | success + retries: 5 + delay: 3 + +- name: Extract Apache Storm + unarchive: + src: "/root/apache-storm-{{ storm_version }}.tar.gz" + dest: "/opt" + creates: "/opt/apache-storm-{{ storm_version }}" + copy: "no" + register: extract_storm + until: extract_storm | success + retries: 5 + delay: 3 diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..0d7ebea --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,72 @@ +--- +# Copyright 2016 Internet Solutions (Pty) Ltd +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# (c) 2016 Donovan Francesco +# (c) 2016 Paul Stevens +# +- name: Gather variables for each operating system + include_vars: "{{ item }}" + with_first_found: + - "{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower }}.yml" + - "{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version | lower }}.yml" + - "{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version | lower }}.yml" + - "{{ ansible_distribution | lower }}.yml" + - "{{ ansible_os_family | lower }}.yml" + tags: + - always + +- include: pre-install.yml + tags: + - os_monasca + +- include: configure_zookeeper.yml + tags: + - os_monasca + +- include: install_kafka.yml + tags: + - os_monasca + +- incude: configure_kafka.yml + tags: + - os_monasca + +- include: install_influxdb.yml + tags: + - os_monasca + +- include: configure_influxdb.yml + tags: + - os_monasca + +- include: install_graphana.yml + tags: + - os_monasca + +- include: configure_graphana.yml + tags: + - os_monasca + +- include: install_storm.yml + tags: + - os_monasca + +- include: configure_storm.yml + tags: + - os_monasca + +- include: post-install.yml + tags: + - os_monasca diff --git a/tasks/post-install.yml b/tasks/post-install.yml new file mode 100644 index 0000000..4255e7e --- /dev/null +++ b/tasks/post-install.yml @@ -0,0 +1,18 @@ +--- +# Copyright 2016 Internet Solutions (Pty) Ltd +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# (c) 2016 Donovan Francesco +# (c) 2016 Paul Stevens +# diff --git a/tasks/pre-install.yml b/tasks/pre-install.yml new file mode 100644 index 0000000..086d228 --- /dev/null +++ b/tasks/pre-install.yml @@ -0,0 +1,60 @@ +--- +# Copyright 2016 Internet Solutions (Pty) Ltd +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# (c) 2016 Donovan Francesco +# (c) 2016 Paul Stevens +# +- name: Update Apt sources + apt: + update_cache: yes + register: apt_update + until: apt_update | success + retries: 5 + delay: 2 + +- name: Install Apt dependencies + apt: + pkg: {{ name }} + state: "latest" + register: install_deps + until: install_deps | success + retries: 5 + delay: 2 + with_items: + - "{{ apt_packages }}" + +- name: Add a kafka user with temp sudo permissions # sudo removed in post-install.yml + user: + name: kafka + comment: "Apache Kafka Service" + groups: sudo + append: yes + generate_ssh_key: yes + ssh_key_bits: 2048 + ssh_key_file: .ssh/id_rsa.pub + register: create_kafka_user + until: create_kafka_user | success + retries: 5 + delay: 2 + +- name: Create Kafka directory + file: + path: /opt/kafka + state: directory + mode: 0755 + register: create_install_dir + until: create_install_dir | success + retries: 5 + delay: 2 diff --git a/templates/graphana/graphana-server.j2 b/templates/graphana/graphana-server.j2 new file mode 100644 index 0000000..0a56d4b --- /dev/null +++ b/templates/graphana/graphana-server.j2 @@ -0,0 +1,146 @@ +#! /usr/bin/env bash + +# chkconfig: 2345 80 05 +# description: Grafana web server & backend +# processname: grafana +# config: /etc/grafana/grafana.ini +# pidfile: /var/run/grafana.pid + +### BEGIN INIT INFO +# Provides: grafana +# Required-Start: $all +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Start grafana at boot time +### END INIT INFO + +# tested on +# 1. New lsb that define start-stop-daemon +# 3. Centos with initscripts package installed + +PATH=/bin:/usr/bin:/sbin:/opt/grafana-build/src/github.com/grafana/grafana/bin +NAME=grafana-server +DESC="Grafana Server" +DEFAULT=/etc/default/$NAME + +GRAFANA_USER=grafana +GRAFANA_GROUP=grafana +GRAFANA_HOME=/opt/grafana-build/src/github.com/grafana/grafana +CONF_DIR=/etc/grafana +WORK_DIR=$GRAFANA_HOME +DATA_DIR=/var/lib/grafana +LOG_DIR=/var/log/grafana +CONF_FILE=$CONF_DIR/grafana.ini +MAX_OPEN_FILES=10000 +PID_FILE=/var/run/$NAME.pid +DAEMON=/opt/grafana-build/src/github.com/grafana/grafana/bin/$NAME + +umask 0027 + +if [ `id -u` -ne 0 ]; then + echo "You need root privileges to run this script" + exit 4 +fi + +if [ ! -x $DAEMON ]; then + echo "Program not installed or not executable" + exit 5 +fi + +. /lib/lsb/init-functions + +if [ -r /etc/default/rcS ]; then + . /etc/default/rcS +fi + +# overwrite settings from default file +if [ -f "$DEFAULT" ]; then + . "$DEFAULT" +fi + +DAEMON_OPTS="--pidfile=${PID_FILE} --config=${CONF_FILE} cfg:default.paths.data=${DATA_DIR} cfg:default.paths.logs=${LOG_DIR}" + +case "$1" in + start) + + log_daemon_msg "Starting $DESC" + + pid=`pidofproc -p $PID_FILE grafana` + if [ -n "$pid" ] ; then + log_begin_msg "Already running." + log_end_msg 0 + exit 0 + fi + + # Prepare environment + mkdir -p "$LOG_DIR" "$DATA_DIR" && chown "$GRAFANA_USER":"$GRAFANA_GROUP" "$LOG_DIR" "$DATA_DIR" + touch "$PID_FILE" && chown "$GRAFANA_USER":"$GRAFANA_GROUP" "$PID_FILE" + + if [ -n "$MAX_OPEN_FILES" ]; then + ulimit -n $MAX_OPEN_FILES + fi + + # Start Daemon + start-stop-daemon --start -b --chdir "$WORK_DIR" --user "$GRAFANA_USER" -c "$GRAFANA_USER" --pidfile "$PID_FILE" --exec $DAEMON -- $DAEMON_OPTS + return=$? + if [ $return -eq 0 ] + then + sleep 1 + + # check if pid file has been written two + if ! [[ -s $PID_FILE ]]; then + log_end_msg 1 + exit 1 + fi + + i=0 + timeout=10 + # Wait for the process to be properly started before exiting + until { cat "$PID_FILE" | xargs kill -0; } >/dev/null 2>&1 + do + sleep 1 + i=$(($i + 1)) + if [ $i -gt $timeout ]; then + log_end_msg 1 + exit 1 + fi + done + fi + log_end_msg $return + ;; + stop) + log_daemon_msg "Stopping $DESC" + + if [ -f "$PID_FILE" ]; then + start-stop-daemon --stop --pidfile "$PID_FILE" \ + --user "$GRAFANA_USER" \ + --retry=TERM/20/KILL/5 >/dev/null + if [ $? -eq 1 ]; then + log_progress_msg "$DESC is not running but pid file exists, cleaning up" + elif [ $? -eq 3 ]; then + PID="`cat $PID_FILE`" + log_failure_msg "Failed to stop $DESC (pid $PID)" + exit 1 + fi + rm -f "$PID_FILE" + else + log_progress_msg "(not running)" + fi + log_end_msg 0 + ;; + status) + status_of_proc -p $PID_FILE grafana grafana && exit 0 || exit $? + ;; + restart|force-reload) + if [ -f "$PID_FILE" ]; then + $0 stop + sleep 1 + fi + $0 start + ;; + *) + log_success_msg "Usage: $0 {start|stop|restart|force-reload|status}" + exit 3 + ;; +esac diff --git a/templates/graphana/graphana.ini.j2 b/templates/graphana/graphana.ini.j2 new file mode 100644 index 0000000..279039a --- /dev/null +++ b/templates/graphana/graphana.ini.j2 @@ -0,0 +1,13 @@ +[auth.keystone] +enabled = true +auth_url = http://{{ internal_lb_vip_address }}:5000 +[database] +type = mysql +host = {{ internal_lb_vip_address }}:3306 +name = graphana +user = graphana +password = {{ graphana_mysql_password }} +ssl_mode = skip-verify +[security] +admin_user = admin +admin_password = {{ graphana_admin_password }} diff --git a/templates/influxdb/influxdb.conf.j2 b/templates/influxdb/influxdb.conf.j2 new file mode 100644 index 0000000..a697357 --- /dev/null +++ b/templates/influxdb/influxdb.conf.j2 @@ -0,0 +1,322 @@ +### Welcome to the InfluxDB configuration file. + +# Once every 24 hours InfluxDB will report anonymous data to m.influxdb.com +# The data includes raft id (random 8 bytes), os, arch, version, and metadata. +# We don't track ip addresses of servers reporting. This is only used +# to track the number of instances running and the versions, which +# is very helpful for us. +# Change this option to true to disable reporting. +reporting-disabled = false + +### +### Enterprise registration control +### + +[registration] +# enabled = true +# url = "https://enterprise.influxdata.com" # The Enterprise server URL +# token = "" # Registration token for Enterprise server + +### +### [meta] +### +### Controls the parameters for the Raft consensus group that stores metadata +### about the InfluxDB cluster. +### + +[meta] + dir = "/var/lib/influxdb/meta" + hostname = "{{ ansible_default_ipv4.address }}" + bind-address = ":8089" + retention-autocreate = true + election-timeout = "1s" + heartbeat-timeout = "1s" + leader-lease-timeout = "500ms" + commit-timeout = "50ms" + cluster-tracing = false + + # If enabled, when a Raft cluster loses a peer due to a `DROP SERVER` command, + # the leader will automatically ask a non-raft peer node to promote to a raft + # peer. This only happens if there is a non-raft peer node available to promote. + # This setting only affects the local node, so to ensure if operates correctly, be sure to set + # it in the config of every node. + raft-promotion-enabled = true + +### +### [data] +### +### Controls where the actual shard data for InfluxDB lives and how it is +### flushed from the WAL. "dir" may need to be changed to a suitable place +### for your system, but the WAL settings are an advanced configuration. The +### defaults should work for most systems. +### + +[data] + dir = "/var/lib/influxdb/data" + + # Controls the engine type for new shards. Options are b1, bz1, or tsm1. + # b1 is the 0.9.2 storage engine, bz1 is the 0.9.3 and 0.9.4 engine. + # tsm1 is the 0.9.5 engine and is currently EXPERIMENTAL. Until 0.9.5 is + # actually released data written into a tsm1 engine may be need to be wiped + # between upgrades. + # engine ="bz1" + + # The following WAL settings are for the b1 storage engine used in 0.9.2. They won't + # apply to any new shards created after upgrading to a version > 0.9.3. + max-wal-size = 104857600 # Maximum size the WAL can reach before a flush. Defaults to 100MB. + wal-flush-interval = "10m" # Maximum time data can sit in WAL before a flush. + wal-partition-flush-delay = "2s" # The delay time between each WAL partition being flushed. + + # These are the WAL settings for the storage engine >= 0.9.3 + wal-dir = "/var/lib/influxdb/wal" + wal-enable-logging = true + + # When a series in the WAL in-memory cache reaches this size in bytes it is marked as ready to + # flush to the index + # wal-ready-series-size = 25600 + + # Flush and compact a partition once this ratio of series are over the ready size + # wal-compaction-threshold = 0.6 + + # Force a flush and compaction if any series in a partition gets above this size in bytes + # wal-max-series-size = 2097152 + + # Force a flush of all series and full compaction if there have been no writes in this + # amount of time. This is useful for ensuring that shards that are cold for writes don't + # keep a bunch of data cached in memory and in the WAL. + # wal-flush-cold-interval = "10m" + + # Force a partition to flush its largest series if it reaches this approximate size in + # bytes. Remember there are 5 partitions so you'll need at least 5x this amount of memory. + # The more memory you have, the bigger this can be. + # wal-partition-size-threshold = 20971520 + + # Whether queries should be logged before execution. Very useful for troubleshooting, but will + # log any sensitive data contained within a query. + # query-log-enabled = true + +### +### [hinted-handoff] +### +### Controls the hinted handoff feature, which allows nodes to temporarily +### store queued data when one node of a cluster is down for a short period +### of time. +### + +[hinted-handoff] + enabled = true + dir = "/var/lib/influxdb/hh" + max-size = 1073741824 + max-age = "168h" + retry-rate-limit = 0 + + # Hinted handoff will start retrying writes to down nodes at a rate of once per second. + # If any error occurs, it will backoff in an exponential manner, until the interval + # reaches retry-max-interval. Once writes to all nodes are successfully completed the + # interval will reset to retry-interval. + retry-interval = "1s" + retry-max-interval = "1m" + + # Interval between running checks for data that should be purged. Data is purged from + # hinted-handoff queues for two reasons. 1) The data is older than the max age, or + # 2) the target node has been dropped from the cluster. Data is never dropped until + # it has reached max-age however, for a dropped node or not. + purge-interval = "1h" + +### +### [cluster] +### +### Controls non-Raft cluster behavior, which generally includes how data is +### shared across shards. +### + +[cluster] + shard-writer-timeout = "10s" # The time within which a shard must respond to write. + write-timeout = "5s" # The time within which a write operation must complete on the cluster. + +### +### [retention] +### +### Controls the enforcement of retention policies for evicting old data. +### + +[retention] + enabled = true + check-interval = "30m" + +### +### [shard-precreation] +### +### Controls the precreation of shards, so they are created before data arrives. +### Only shards that will exist in the future, at time of creation, are precreated. + +[shard-precreation] + enabled = true + check-interval = "10m" + advance-period = "30m" + +### +### Controls the system self-monitoring, statistics and diagnostics. +### +### The internal database for monitoring data is created automatically if +### if it does not already exist. The target retention within this database +### is called 'monitor' and is also created with a retention period of 7 days +### and a replication factor of 1, if it does not exist. In all cases the +### this retention policy is configured as the default for the database. + +[monitor] + store-enabled = true # Whether to record statistics internally. + store-database = "_internal" # The destination database for recorded statistics + store-interval = "10s" # The interval at which to record statistics + +### +### [admin] +### +### Controls the availability of the built-in, web-based admin interface. If HTTPS is +### enabled for the admin interface, HTTPS must also be enabled on the [http] service. +### + +[admin] + enabled = true + bind-address = ":8083" + https-enabled = false + https-certificate = "/etc/ssl/influxdb.pem" + +### +### [http] +### +### Controls how the HTTP endpoints are configured. These are the primary +### mechanism for getting data into and out of InfluxDB. +### + +[http] + enabled = true + bind-address = ":8086" + auth-enabled = false + log-enabled = true + write-tracing = false + pprof-enabled = false + https-enabled = false + https-certificate = "/etc/ssl/influxdb.pem" + +### +### [[graphite]] +### +### Controls one or many listeners for Graphite data. +### + +[[graphite]] + enabled = false + # database = "graphite" + # bind-address = ":2003" + # protocol = "tcp" + # consistency-level = "one" + # name-separator = "." + + # These next lines control how batching works. You should have this enabled + # otherwise you could get dropped metrics or poor performance. Batching + # will buffer points in memory if you have many coming in. + + # batch-size = 1000 # will flush if this many points get buffered + # batch-pending = 5 # number of batches that may be pending in memory + # batch-timeout = "1s" # will flush at least this often even if we haven't hit buffer limit + # udp-read-buffer = 0 # UDP Read buffer size, 0 means OS default. UDP listener will fail if set above OS max. + + ## "name-schema" configures tag names for parsing the metric name from graphite protocol; + ## separated by `name-separator`. + ## The "measurement" tag is special and the corresponding field will become + ## the name of the metric. + ## e.g. "type.host.measurement.device" will parse "server.localhost.cpu.cpu0" as + ## { + ## measurement: "cpu", + ## tags: { + ## "type": "server", + ## "host": "localhost, + ## "device": "cpu0" + ## } + ## } + # name-schema = "type.host.measurement.device" + + ## If set to true, when the input metric name has more fields than `name-schema` specified, + ## the extra fields will be ignored. + ## Otherwise an error will be logged and the metric rejected. + # ignore-unnamed = true + +### +### [collectd] +### +### Controls the listener for collectd data. +### + +[collectd] + enabled = false + # bind-address = "" + # database = "" + # typesdb = "" + + # These next lines control how batching works. You should have this enabled + # otherwise you could get dropped metrics or poor performance. Batching + # will buffer points in memory if you have many coming in. + + # batch-size = 1000 # will flush if this many points get buffered + # batch-pending = 5 # number of batches that may be pending in memory + # batch-timeout = "1s" # will flush at least this often even if we haven't hit buffer limit + # read-buffer = 0 # UDP Read buffer size, 0 means OS default. UDP listener will fail if set above OS max. + +### +### [opentsdb] +### +### Controls the listener for OpenTSDB data. +### + +[opentsdb] + enabled = false + # bind-address = ":4242" + # database = "opentsdb" + # retention-policy = "" + # consistency-level = "one" + # tls-enabled = false + # certificate= "" + + # These next lines control how batching works. You should have this enabled + # otherwise you could get dropped metrics or poor performance. Only points + # metrics received over the telnet protocol undergo batching. + + # batch-size = 1000 # will flush if this many points get buffered + # batch-pending = 5 # number of batches that may be pending in memory + # batch-timeout = "1s" # will flush at least this often even if we haven't hit buffer limit + +### +### [[udp]] +### +### Controls the listeners for InfluxDB line protocol data via UDP. +### + +[[udp]] + enabled = false + # bind-address = "" + # database = "udp" + # retention-policy = "" + + # These next lines control how batching works. You should have this enabled + # otherwise you could get dropped metrics or poor performance. Batching + # will buffer points in memory if you have many coming in. + + # batch-size = 1000 # will flush if this many points get buffered + # batch-pending = 5 # number of batches that may be pending in memory + # batch-timeout = "1s" # will flush at least this often even if we haven't hit buffer limit + # read-buffer = 0 # UDP Read buffer size, 0 means OS default. UDP listener will fail if set above OS max. + +### +### [continuous_queries] +### +### Controls how continuous queries are run within InfluxDB. +### + +[continuous_queries] + log-enabled = true + enabled = true + recompute-previous-n = 2 + recompute-no-older-than = "10m" + compute-runs-per-interval = 10 + compute-no-more-than = "2m" diff --git a/templates/influxdb/influxdb.j2 b/templates/influxdb/influxdb.j2 new file mode 100644 index 0000000..ec24ffe --- /dev/null +++ b/templates/influxdb/influxdb.j2 @@ -0,0 +1,18 @@ +# (C) Copyright 2015 Hewlett Packard Enterprise Development Company LP +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +#    http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# Logging +STDERR="/var/log/influxdb/influxd.log" diff --git a/templates/kafka/kafka-server-start.sh.j2 b/templates/kafka/kafka-server-start.sh.j2 new file mode 100644 index 0000000..87b31d5 --- /dev/null +++ b/templates/kafka/kafka-server-start.sh.j2 @@ -0,0 +1,38 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if [ $# -lt 1 ]; +then + echo "USAGE: $0 [-daemon] server.properties" + exit 1 +fi +base_dir=$(dirname $0) +export KAFKA_LOG4J_OPTS="-Dlog4j.configuration=file:$base_dir/../config/log4j.properties" +export KAFKA_HEAP_OPTS="-Xms256m -Xmx256m" + +EXTRA_ARGS="-name kafkaServer -loggc" + +COMMAND=$1 +case $COMMAND in + -daemon) + EXTRA_ARGS="-daemon "$EXTRA_ARGS + shift + ;; + *) + ;; +esac + +exec $base_dir/kafka-run-class.sh $EXTRA_ARGS kafka.Kafka $@ diff --git a/templates/kafka/kafka.j2 b/templates/kafka/kafka.j2 new file mode 100644 index 0000000..49d0456 --- /dev/null +++ b/templates/kafka/kafka.j2 @@ -0,0 +1,34 @@ +# (C) Copyright 2015 Hewlett Packard Enterprise Development Company LP +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +#    http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +description "Kafka" + +start on runlevel [2345] +stop on runlevel [!2345] + +respawn + +limit nofile 32768 32768 + +# If zookeeper is running on this box also give it time to start up properly +pre-start script + if [ -e /etc/init.d/zookeeper ]; then + /etc/init.d/zookeeper start || true + fi +end script + +# Rather than using setuid/setgid sudo is used because the pre-start task must run as root +exec sudo -Hu kafka -g kafka KAFKA_HEAP_OPTS="-Xmx128m" /opt/kafka/bin/kafka-server-start.sh /etc/kafka/server.properties diff --git a/templates/kafka/log4j.properties.j2 b/templates/kafka/log4j.properties.j2 new file mode 100644 index 0000000..0a03b66 --- /dev/null +++ b/templates/kafka/log4j.properties.j2 @@ -0,0 +1,71 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +log4j.rootLogger=WARN, stdout + +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=[%d] %p %m (%c)%n + +log4j.appender.kafkaAppender=org.apache.log4j.RollingFileAppender +log4j.appender.kafkaAppender.MaxFileSize=50MB +log4j.appender.kafkaAppender.MaxBackupIndex=4 +log4j.appender.kafkaAppender.File=/var/log/kafka/server.log +log4j.appender.kafkaAppender.layout=org.apache.log4j.PatternLayout +log4j.appender.kafkaAppender.layout.ConversionPattern=[%d] %p %m (%c)%n + +log4j.appender.stateChangeAppender=org.apache.log4j.RollingFileAppender +log4j.appender.stateChangeAppender.MaxFileSize=50MB +log4j.appender.stateChangeAppender.MaxBackupIndex=4 +log4j.appender.stateChangeAppender.File=/var/log/kafka/state-change.log +log4j.appender.stateChangeAppender.layout=org.apache.log4j.PatternLayout +log4j.appender.stateChangeAppender.layout.ConversionPattern=[%d] %p %m (%c)%n + +log4j.appender.controllerAppender=org.apache.log4j.RollingFileAppender +log4j.appender.controllerAppender.MaxFileSize=50MB +log4j.appender.controllerAppender.MaxBackupIndex=4 +log4j.appender.controllerAppender.File=/var/log/kafka/controller.log +log4j.appender.controllerAppender.layout=org.apache.log4j.PatternLayout +log4j.appender.controllerAppender.layout.ConversionPattern=[%d] %p %m (%c)%n + +# Turn on all our debugging info +#log4j.logger.kafka.producer.async.DefaultEventHandler=DEBUG, kafkaAppender +#log4j.logger.kafka.client.ClientUtils=DEBUG, kafkaAppender +#log4j.logger.kafka.perf=DEBUG, kafkaAppender +#log4j.logger.kafka.perf.ProducerPerformance$ProducerThread=DEBUG, kafkaAppender +#log4j.logger.org.I0Itec.zkclient.ZkClient=DEBUG +log4j.logger.kafka=WARN, kafkaAppender + +# Tracing requests results in large logs +#log4j.appender.requestAppender=org.apache.log4j.RollingFileAppender +#log4j.appender.requestAppender.MaxFileSize=50MB +#log4j.appender.requestAppender.MaxBackupIndex=4 +#log4j.appender.requestAppender.File=/var/log/kafka/kafka-request.log +#log4j.appender.requestAppender.layout=org.apache.log4j.PatternLayout +#log4j.appender.requestAppender.layout.ConversionPattern=[%d] %p %m (%c)%n +# +#log4j.logger.kafka.network.RequestChannel$=TRACE, requestAppender +#log4j.additivity.kafka.network.RequestChannel$=false +# +#log4j.logger.kafka.network.Processor=TRACE, requestAppender +#log4j.logger.kafka.server.KafkaApis=TRACE, requestAppender +#log4j.additivity.kafka.server.KafkaApis=false +#log4j.logger.kafka.request.logger=TRACE, requestAppender +#log4j.additivity.kafka.request.logger=false + +log4j.logger.kafka.controller=TRACE, controllerAppender +log4j.additivity.kafka.controller=false + +log4j.logger.state.change.logger=TRACE, stateChangeAppender +log4j.additivity.state.change.logger=false diff --git a/templates/kafka/server.properties.j2 b/templates/kafka/server.properties.j2 new file mode 100644 index 0000000..2d53e16 --- /dev/null +++ b/templates/kafka/server.properties.j2 @@ -0,0 +1,118 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# see kafka.server.KafkaConfig for additional details and defaults + +############################# Server Basics ############################# + +# The id of the broker. This must be set to a unique integer for each broker. +broker.id=0 + +############################# Socket Server Settings ############################# + +# The address the socket server listens on. It will get the value returned from +# java.net.InetAddress.getCanonicalHostName() if not configured. +# FORMAT: +# listeners = security_protocol://host_name:port +# EXAMPLE: +# listeners = PLAINTEXT://your.host.name:9092 +#listeners=PLAINTEXT://:9092 + +# Hostname and port the broker will advertise to producers and consumers. If not set, +# it uses the value for "listeners" if configured. Otherwise, it will use the value +# returned from java.net.InetAddress.getCanonicalHostName(). +#advertised.listeners=PLAINTEXT://your.host.name:9092 + +# The number of threads handling network requests +num.network.threads=3 + +# The number of threads doing disk I/O +num.io.threads=8 + +# The send buffer (SO_SNDBUF) used by the socket server +socket.send.buffer.bytes=102400 + +# The receive buffer (SO_RCVBUF) used by the socket server +socket.receive.buffer.bytes=102400 + +# The maximum size of a request that the socket server will accept (protection against OOM) +socket.request.max.bytes=104857600 + +########################### Queue Basics ############################# + +delete.topic.enable=true + +############################# Log Basics ############################# + +# A comma seperated list of directories under which to store log files +log.dirs=/tmp/kafka-logs + +# The default number of log partitions per topic. More partitions allow greater +# parallelism for consumption, but this will also result in more files across +# the brokers. +num.partitions=1 + +# The number of threads per data directory to be used for log recovery at startup and flushing at shutdown. +# This value is recommended to be increased for installations with data dirs located in RAID array. +num.recovery.threads.per.data.dir=1 + +############################# Log Flush Policy ############################# + +# Messages are immediately written to the filesystem but by default we only fsync() to sync +# the OS cache lazily. The following configurations control the flush of data to disk. +# There are a few important trade-offs here: +# 1. Durability: Unflushed data may be lost if you are not using replication. +# 2. Latency: Very large flush intervals may lead to latency spikes when the flush does occur as there will be a lot of data to flush. +# 3. Throughput: The flush is generally the most expensive operation, and a small flush interval may lead to exceessive seeks. +# The settings below allow one to configure the flush policy to flush data after a period of time or +# every N messages (or both). This can be done globally and overridden on a per-topic basis. + +# The number of messages to accept before forcing a flush of data to disk +log.flush.interval.messages=10000 + +# The maximum amount of time a message can sit in a log before we force a flush +log.flush.interval.ms=1000 + +############################# Log Retention Policy ############################# + +# The following configurations control the disposal of log segments. The policy can +# be set to delete segments after a period of time, or after a given size has accumulated. +# A segment will be deleted whenever *either* of these criteria are met. Deletion always happens +# from the end of the log. + +# The minimum age of a log file to be eligible for deletion +log.retention.hours=168 + +# A size-based retention policy for logs. Segments are pruned from the log as long as the remaining +# segments don't drop below log.retention.bytes. +#log.retention.bytes=1073741824 + +# The maximum size of a log segment file. When this size is reached a new log segment will be created. +log.segment.bytes=1073741824 + +# The interval at which log segments are checked to see if they can be deleted according +# to the retention policies +log.retention.check.interval.ms=300000 + +############################# Zookeeper ############################# + +# Zookeeper connection string (see zookeeper docs for details). +# This is a comma separated host:port pairs, each corresponding to a zk +# server. e.g. "127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002". +# You can also append an optional chroot string to the urls to specify the +# root directory for all kafka znodes. +zookeeper.connect=localhost:2181 + +# Timeout in ms for connecting to zookeeper +zookeeper.connection.timeout.ms=6000 diff --git a/templates/storm/cluster.xml.j2 b/templates/storm/cluster.xml.j2 new file mode 100644 index 0000000..e5144d4 --- /dev/null +++ b/templates/storm/cluster.xml.j2 @@ -0,0 +1,85 @@ + + + + + + ${storm.home}/logs/${logfile.name} + + ${storm.home}/logs/${logfile.name}.%i + 1 + 9 + + + + 100MB + + + + %d{yyyy-MM-dd HH:mm:ss} %c{1} [%p] %m%n + + + + + ${storm.home}/logs/access.log + + ${storm.home}/logs/access.log.%i + 1 + 9 + + + + 100MB + + + + %d{yyyy-MM-dd HH:mm:ss} %c{1} [%p] %m%n + + + + + ${storm.home}/logs/metrics.log + + ${storm.home}/logs/metrics.log.%i + 1 + 9 + + + + 2MB + + + + %d %-8r %m%n + + + + + + + + + + + + + + + + + + diff --git a/templates/storm/storm-nimbus.conf.j2 b/templates/storm/storm-nimbus.conf.j2 new file mode 100644 index 0000000..b4ec769 --- /dev/null +++ b/templates/storm/storm-nimbus.conf.j2 @@ -0,0 +1,30 @@ +# (C) Copyright 2015 Hewlett Packard Enterprise Development Company LP +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +#    http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Startup script for Storm Nimbus + +description "Storm Nimbus daemon" +start on runlevel [2345] + +console log +respawn + +kill timeout 240 +respawn limit 25 5 + +setgid storm +setuid storm +chdir /opt/storm +exec /opt/storm/bin/storm nimbus diff --git a/templates/storm/storm-supervisor.conf.j2 b/templates/storm/storm-supervisor.conf.j2 new file mode 100644 index 0000000..e548f48 --- /dev/null +++ b/templates/storm/storm-supervisor.conf.j2 @@ -0,0 +1,30 @@ +# (C) Copyright 2015 Hewlett Packard Enterprise Development Company LP +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +#    http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Startup script for Storm Supervisor + +description "Storm Supervisor daemon" +start on runlevel [2345] + +console log +respawn + +kill timeout 240 +respawn limit 25 5 + +setgid storm +setuid storm +chdir /opt/storm +exec /opt/storm/bin/storm supervisor diff --git a/templates/storm/storm.yml.j2 b/templates/storm/storm.yml.j2 new file mode 100644 index 0000000..686ea1e --- /dev/null +++ b/templates/storm/storm.yml.j2 @@ -0,0 +1,58 @@ +# (C) Copyright 2015 Hewlett Packard Enterprise Development Company LP +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +#    http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +### base +java.library.path: "/usr/local/lib:/opt/local/lib:/usr/lib" +storm.local.dir: "/var/storm" + +### zookeeper.* +storm.zookeeper.servers: + - "{{ ansible_default_ipv4.address }}" +storm.zookeeper.port: 2181 +storm.zookeeper.retry.interval: 5000 +storm.zookeeper.retry.times: 60 +storm.zookeeper.root: /storm +storm.zookeeper.session.timeout: 3000 + +### supervisor.* configs are for node supervisors +supervisor.slots.ports: + - 6701 + - 6702 +supervisor.childopts: -Xmx256m + +### worker.* configs are for task workers +worker.childopts: -Xmx1280m -XX:+UseConcMarkSweepGC -Dcom.sun.management.jmxremote + +### nimbus.* configs are for the master +nimbus.host: "{{ ansible_default_ipv4.address }}" +nimbus.thrift.port: 6627 +nimbus.childopts: -Xmx256m + +### ui.* configs are for the master +ui.host: {{ ansible_default_ipv4.address }} +ui.port: 8088 +ui.childopts: -Xmx768m + +### drpc.* configs + +### transactional.* configs +transactional.zookeeper.servers: + - "{{ ansible_default_ipv4.address }}" +transactional.zookeeper.port: 2181 +transactional.zookeeper.root: /storm-transactional + +### topology.* configs are for specific executing storms +topology.acker.executors: 1 +topology.debug: False diff --git a/templates/zookeeper/environment.j2 b/templates/zookeeper/environment.j2 new file mode 100644 index 0000000..bf18b0b --- /dev/null +++ b/templates/zookeeper/environment.j2 @@ -0,0 +1,35 @@ +# (C) Copyright 2015 Hewlett Packard Enterprise Development Company LP +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +#    http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# Modified from http://packages.ubuntu.com/saucy/zookeeperd +NAME=zookeeper +ZOOCFGDIR=/etc/zookeeper/conf + +# seems, that log4j requires the log4j.properties file to be in the classpath +CLASSPATH="$ZOOCFGDIR:/usr/share/java/jline.jar:/usr/share/java/log4j-1.2.jar:/usr/share/java/xercesImpl.jar:/usr/share/java/xmlParserAPIs.jar:/usr/share/java/netty.jar:/usr/share/java/slf4j-api.jar:/usr/share/java/slf4j-log4j12.jar:/usr/share/java/zookeeper.jar" + +ZOOCFG="$ZOOCFGDIR/zoo.cfg" +ZOO_LOG_DIR=/var/log/zookeeper +USER=$NAME +GROUP=$NAME +PIDDIR=/var/run/$NAME +PIDFILE=$PIDDIR/$NAME.pid +SCRIPTNAME=/etc/init.d/$NAME +JAVA=/usr/bin/java +ZOOMAIN="org.apache.zookeeper.server.quorum.QuorumPeerMain" +ZOO_LOG4J_PROP="INFO,ROLLINGFILE" +JMXLOCALONLY=false +JAVA_OPTS="" diff --git a/templates/zookeeper/log4j.properties.j2 b/templates/zookeeper/log4j.properties.j2 new file mode 100644 index 0000000..5c39819 --- /dev/null +++ b/templates/zookeeper/log4j.properties.j2 @@ -0,0 +1,68 @@ +# (C) Copyright 2015 Hewlett Packard Enterprise Development Company LP +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +#    http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# From http://packages.ubuntu.com/saucy/zookeeperd + +# ZooKeeper Logging Configuration +# + +# Format is " (, )+ + +log4j.rootLogger=${zookeeper.root.logger} + +# Example: console appender only +# log4j.rootLogger=INFO, CONSOLE + +# Example with rolling log file +#log4j.rootLogger=DEBUG, CONSOLE, ROLLINGFILE + +# Example with rolling log file and tracing +#log4j.rootLogger=TRACE, CONSOLE, ROLLINGFILE, TRACEFILE + +# +# Log INFO level and above messages to the console +# +log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender +log4j.appender.CONSOLE.Threshold=INFO +log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout +log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} - %-5p [%t:%C{1}@%L] - %m%n + +# +# Add ROLLINGFILE to rootLogger to get log file output +# Log DEBUG level and above messages to a log file +log4j.appender.ROLLINGFILE=org.apache.log4j.RollingFileAppender +log4j.appender.ROLLINGFILE.Threshold=WARN +log4j.appender.ROLLINGFILE.File=${zookeeper.log.dir}/zookeeper.log + +# Max log file size of 10MB +log4j.appender.ROLLINGFILE.MaxFileSize=10MB +# uncomment the next line to limit number of backup files +#log4j.appender.ROLLINGFILE.MaxBackupIndex=10 + +log4j.appender.ROLLINGFILE.layout=org.apache.log4j.PatternLayout +log4j.appender.ROLLINGFILE.layout.ConversionPattern=%d{ISO8601} - %-5p [%t:%C{1}@%L] - %m%n + + +# +# Add TRACEFILE to rootLogger to get log file output +# Log DEBUG level and above messages to a log file +log4j.appender.TRACEFILE=org.apache.log4j.FileAppender +log4j.appender.TRACEFILE.Threshold=TRACE +log4j.appender.TRACEFILE.File=${zookeeper.log.dir}/zookeeper_trace.log + +log4j.appender.TRACEFILE.layout=org.apache.log4j.PatternLayout +### Notice we are including log4j's NDC here (%x) +log4j.appender.TRACEFILE.layout.ConversionPattern=%d{ISO8601} - %-5p [%t:%C{1}@%L][%x] - %m%n diff --git a/templates/zookeeper/zoo.cfg.j2 b/templates/zookeeper/zoo.cfg.j2 new file mode 100644 index 0000000..c6f89a6 --- /dev/null +++ b/templates/zookeeper/zoo.cfg.j2 @@ -0,0 +1,73 @@ +# (C) Copyright 2015 Hewlett Packard Enterprise Development Company LP +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +#    http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# http://hadoop.apache.org/zookeeper/docs/current/zookeeperAdmin.html + +# The number of milliseconds of each tick +tickTime=2000 +# The number of ticks that the initial +# synchronization phase can take +initLimit=10 +# The number of ticks that can pass between +# sending a request and getting an acknowledgement +syncLimit=5 +# the directory where the snapshot is stored. +dataDir=/var/lib/zookeeper +# Place the dataLogDir to a separate physical disc for better performance +# dataLogDir=/disk2/zookeeper + +# the port at which the clients will connect +clientPort=2181 + +# Maximum number of clients that can connect from one client +maxClientCnxns=60 + +# specify all zookeeper servers +# The fist port is used by followers to connect to the leader +# The second one is used for leader election + +server.0={{ ansible_default_ipv4.address }}:2888:3888 + +# To avoid seeks ZooKeeper allocates space in the transaction log file in +# blocks of preAllocSize kilobytes. The default block size is 64M. One reason +# for changing the size of the blocks is to reduce the block size if snapshots +# are taken more often. (Also, see snapCount). +#preAllocSize=65536 + +# Clients can submit requests faster than ZooKeeper can process them, +# especially if there are a lot of clients. To prevent ZooKeeper from running +# out of memory due to queued requests, ZooKeeper will throttle clients so that +# there is no more than globalOutstandingLimit outstanding requests in the +# system. The default limit is 1,000.ZooKeeper logs transactions to a +# transaction log. After snapCount transactions are written to a log file a +# snapshot is started and a new transaction log file is started. The default +# snapCount is 10,000. +#snapCount=1000 + +# If this option is defined, requests will be will logged to a trace file named +# traceFile.year.month.day. +#traceFile= + +# Leader accepts client connections. Default value is "yes". The leader machine +# coordinates updates. For higher update throughput at thes slight expense of +# read throughput the leader can be configured to not accept clients and focus +# on coordination. +#leaderServes=yes + +# Autopurge every hour to avoid using lots of disk in bursts +# Order of the next 2 properties matters. +# autopurge.snapRetainCount must be before autopurge.purgeInterval. +autopurge.snapRetainCount=3 +autopurge.purgeInterval=1 diff --git a/vars/ubuntu-14.04.yml b/vars/ubuntu-14.04.yml new file mode 100644 index 0000000..c7d47ae --- /dev/null +++ b/vars/ubuntu-14.04.yml @@ -0,0 +1,35 @@ +--- +# Copyright 2016 Internet Solutions (Pty) Ltd +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# (c) 2016 Donovan Francesco +# (c) 2016 Paul Stevens +# +# Originally obtained from https://github.com/elastic/ansible-elasticsearch +# +apt_packages: + - build-essential + - chrony + - git + - libmysqlclient-dev + - mailutils + - mariadb-client + - maven + - nodejs + - openjdk-7-jdk + - python-software-properties + - python-dev + - python-mysqldb + - python-pip + - zookeeperd