From e5d5c9010869c4753c5711771e4712878282ba2b Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Mon, 29 Dec 2014 07:41:12 +0100 Subject: [PATCH 01/67] improve Vagrant readability --- Vagrantfile | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index dc2442d..c78ded7 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,12 +1,12 @@ -# -*- mode: ruby -*- -# vi: set ft=ruby : +# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! +VAGRANTFILE_API_VERSION = "2" -Vagrant.configure("2") do |config| +Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.hostname = 'puppet-influxdb' - config.vm.synced_folder "modules", "/tmp/puppet-modules", type: "rsync", rsync__exclude: ".git/" - config.vm.synced_folder ".", "/tmp/puppet-modules/influxdb", type: "rsync", rsync__exclude: ".git/" + config.vm.synced_folder "modules", "/tmp/puppet-modules", type: "rsync", rsync__exclude: ".git/" + config.vm.synced_folder ".", "/tmp/puppet-modules/influxdb", type: "rsync", rsync__exclude: ".git/" - config.vm.define "centos", primary: true do |centos| + config.vm.define "centos6", primary: true do |centos| centos.vm.box = "puppetlabs/centos-6.5-64-puppet" centos.vm.provision :puppet do |puppet| puppet.manifests_path = "tests" @@ -15,6 +15,15 @@ Vagrant.configure("2") do |config| end end + config.vm.define "centos7", autostart: false do |centos| + centos.vm.box = "puppetlabs/centos-7.0-64-puppet" + centos.vm.provision :puppet do |puppet| + puppet.manifests_path = "tests" + puppet.manifest_file = "vagrant.pp" + puppet.options = ["--modulepath", "/tmp/puppet-modules"] + end + end + config.vm.define "ubuntu", autostart: false do |ubuntu| ubuntu.vm.box = "puppetlabs/ubuntu-14.04-64-puppet" ubuntu.vm.provision :puppet do |puppet| @@ -24,3 +33,6 @@ Vagrant.configure("2") do |config| end end end + +# -*- mode: ruby -*- +# vi: set ft=ruby : From ff4c7cfcc968255604719e43cf24a0c1a78881ba Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Mon, 29 Dec 2014 08:10:17 +0100 Subject: [PATCH 02/67] Changed Travis to my own travis system updated docu to current fork system state --- .gitignore | 1 + .travis.yml | 5 ++++- README.md | 9 ++++----- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 85e6787..452bfe3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +DEADJOE Gemfile.lock *.swp .librarian/ diff --git a/.travis.yml b/.travis.yml index fb77a9e..5eab22d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,9 @@ env: - PUPPET_VERSION="3.2.4" - PUPPET_VERSION="3.3.2" - PUPPET_VERSION="3.4.2" + - PUPPET_VERSION="3.5.1" + - PUPPET_VERSION="3.6.2" + - PUPPET_VERSION="3.7.3" notifications: email: - - justin@downing.us + - roman@plessl.info diff --git a/README.md b/README.md index 7ff4bd8..53fd6a2 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,16 @@ # influxdb -[![Puppet Forge](http://img.shields.io/puppetforge/v/jdowning/influxdb.svg)](https://forge.puppetlabs.com/jdowning/influxdb) [![Build Status](https://travis-ci.org/justindowning/puppet-influxdb.png)](https://travis-ci.org/justindowning/puppet-influxdb) +[![Build Status](https://travis-ci.org/rplessl/puppet-influxdb.png)](https://travis-ci.org/rplessl/puppet-influxdb) ## Description -This Puppet module will install [influxdb](https://influxdb.org) on Debian or RedHat. +puppet module to install and configure [influxdb](https://influxdb.org). -This module is still under active development so things are likely to change. If -you have any ideas or contributions, feel free to open a pull request! +This module bases on the module of [puppet-influx module of justin downing](https://github.com/justindowning/puppet-influxdb). ## Installation -`puppet module install --modulepath /path/to/puppet/modules jdowning-influxdb` +`puppet module install --modulepath /path/to/puppet/modules rplessl-influxdb` ## Usage From 6aa5e50005e5139cc448497f051a7e4720faa375 Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Mon, 29 Dec 2014 08:17:59 +0100 Subject: [PATCH 03/67] updated documentation for testing with my own fork / branch --- .gitignore | 1 + LICENSE | 3 +++ metadata.json | 20 ++++++++++---------- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 452bfe3..f8ceb7a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ DEADJOE +*~ Gemfile.lock *.swp .librarian/ diff --git a/LICENSE b/LICENSE index 605f773..9b595ae 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,7 @@ +The MIT License (MIT) + Copyright (c) 2014 Justin Downing +Copyright (c) 2014 Roman Plessl Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff --git a/metadata.json b/metadata.json index 32db868..3a3535d 100644 --- a/metadata.json +++ b/metadata.json @@ -1,12 +1,12 @@ { - "name": "jdowning-influxdb", - "version": "0.3.0", - "source": "https://github.com/justindowning/puppet-influxdb", - "author": "Justin Downing", - "license": "Apache License, Version 2.0", + "name": "rplessl-influxdb", + "version": "0.4.0", + "source": "https://github.com/rplessl/puppet-influxdb", + "author": "Roman Plessl", + "license": "MIT License", "summary": "Setup and manage influxdb", "description": "Setup and manage influxdb", - "project_page": "https://github.com/justindowning/puppet-influxdb", + "project_page": "https://github.com/rplessl/puppet-influxdb", "dependencies": [ { "name": "nanliu/staging", "version_requirement": ">= 0.4.0" }, { "name": "puppetlabs/inifile", "version_requirement": ">= 1.0.0" } @@ -14,19 +14,19 @@ "operatingsystem_support": [ { "operatingsystem": "RedHat", - "operatingsystemrelease": [ "5", "6" ] + "operatingsystemrelease": [ "5", "6", "7" ] }, { "operatingsystem": "CentOS", - "operatingsystemrelease": [ "5", "6" ] + "operatingsystemrelease": [ "5", "6", "7" ] }, { "operatingsystem": "OracleLinux", - "operatingsystemrelease": [ "5", "6" ] + "operatingsystemrelease": [ "5", "6", "7" ] }, { "operatingsystem": "Scientific", - "operatingsystemrelease": [ "5", "6" ] + "operatingsystemrelease": [ "5", "6", "7" ] }, { "operatingsystem": "Debian", From 3b268ee03322e8ad583bc3c48267d40d1b7a3b53 Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Mon, 29 Dec 2014 08:27:08 +0100 Subject: [PATCH 04/67] enhance coverage by testing also on Debian 7 and Centos 7 --- Vagrantfile | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Vagrantfile b/Vagrantfile index c78ded7..facfd58 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -3,6 +3,7 @@ VAGRANTFILE_API_VERSION = "2" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.hostname = 'puppet-influxdb' + config.vm.synced_folder "modules", "/tmp/puppet-modules", type: "rsync", rsync__exclude: ".git/" config.vm.synced_folder ".", "/tmp/puppet-modules/influxdb", type: "rsync", rsync__exclude: ".git/" @@ -32,6 +33,16 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| puppet.options = ["--modulepath", "/tmp/puppet-modules"] end end + + config.vm.define "debian", autostart: false do |ubuntu| + ubuntu.vm.box = "puppetlabs/debian-7.6-64-puppet" + ubuntu.vm.provision :puppet do |puppet| + puppet.manifests_path = "tests" + puppet.manifest_file = "vagrant.pp" + puppet.options = ["--modulepath", "/tmp/puppet-modules"] + end + end + end # -*- mode: ruby -*- From 664212cd389f7aa2e4abc4e04a439848780402d8 Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Mon, 29 Dec 2014 11:22:17 +0100 Subject: [PATCH 05/67] remove staging system and external module keep the functionality to packages from s3 buckets with the option !(install_from_repository) --- .fixtures.yml | 1 - Puppetfile | 1 - Puppetfile.lock | 2 - manifests/config.pp | 197 +++-------------------------------------- manifests/init.pp | 49 +++-------- manifests/install.pp | 60 ++++++++----- manifests/params.pp | 51 +---------- templates/config.toml | 199 ++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 266 insertions(+), 294 deletions(-) create mode 100644 templates/config.toml diff --git a/.fixtures.yml b/.fixtures.yml index 92436be..838325e 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -2,6 +2,5 @@ fixtures: repositories: inifile: https://github.com/puppetlabs/puppetlabs-inifile - staging: https://github.com/nanliu/puppet-staging symlinks: influxdb: "#{source_dir}" diff --git a/Puppetfile b/Puppetfile index cb63748..98da5ff 100644 --- a/Puppetfile +++ b/Puppetfile @@ -1,4 +1,3 @@ forge 'http://forge.puppetlabs.com' -mod 'nanliu/staging', '>= 0.4.0' mod 'puppetlabs/inifile', '>= 1.0.0' diff --git a/Puppetfile.lock b/Puppetfile.lock index 26b5799..1f64d80 100644 --- a/Puppetfile.lock +++ b/Puppetfile.lock @@ -1,10 +1,8 @@ FORGE remote: http://forge.puppetlabs.com specs: - nanliu/staging (0.4.0) puppetlabs/inifile (1.0.3) DEPENDENCIES - nanliu/staging (>= 0.4.0) puppetlabs/inifile (>= 1.0.0) diff --git a/manifests/config.pp b/manifests/config.pp index ccc9147..c573df1 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -1,16 +1,22 @@ # == Class: influxdb::config +# +# only values which are effectivly changed are here +# # More information on these settings available at: http://influxdb.org/docs/configuration.html class influxdb::config { - ini_setting { 'hostname': - section => '', - setting => 'hostname', - value => "\"${influxdb::hostname}\"", + # defaults for all settings + Ini_setting { + ensure => present, + path => $influxdb::config_path, + notify => Service['influxdb'], + require => Package['influxdb'], } - ini_setting { 'bind_address': + # specific changes + ini_setting { 'reporting_disabled': section => '', - setting => 'bind-address', - value => "\"${influxdb::bind_address}\"", + setting => 'reporting_disabled', + value => "\"${influxdb::logging_level}\"", } # [logging] @@ -26,64 +32,6 @@ value => "\"${influxdb::logging_file}\"", } - # [admin] - ini_setting { 'admin_port': - section => 'admin', - setting => 'port', - value => $influxdb::admin_port, - } - - ini_setting { 'admin_assets': - section => 'admin', - setting => 'assets', - value => "\"${influxdb::admin_assets}\"", - } - - # [api] - ini_setting { 'api_port': - section => 'api', - setting => 'port', - value => $influxdb::api_port, - } - - ini_setting { 'api_read_timeout': - section => 'api', - setting => 'read-timeout', - value => "\"${influxdb::api_read_timeout}\"", - } - - # [raft] - ini_setting { 'raft_port': - section => 'raft', - setting => 'port', - value => $influxdb::raft_port, - } - - ini_setting { 'raft_dir': - section => 'raft', - setting => 'dir', - value => "\"${influxdb::raft_dir}\"", - } - - ini_setting { 'raft_election_timeout': - section => 'raft', - setting => 'election-timeout', - value => "\"${influxdb::raft_election_timeout}\"", - } - - # [storage] - ini_setting { 'storage_dir': - section => 'storage', - setting => 'dir', - value => "\"${influxdb::storage_dir}\"", - } - - ini_setting { 'storage_write_buffer_size': - section => 'storage', - setting => 'write-buffer-size', - value => $influxdb::storage_write_buffer_size, - } - # [cluster] ini_setting { 'cluster_seed_servers': section => 'cluster', @@ -91,123 +39,4 @@ value => $influxdb::cluster_seed_servers, } - ini_setting { 'cluster_protobuf_port': - section => 'cluster', - setting => 'protobuf_port', - value => $influxdb::cluster_protobuf_port, - } - - ini_setting { 'cluster_protobuf_timeout': - section => 'cluster', - setting => 'protobuf_timeout', - value => "\"${influxdb::cluster_protobuf_timeout}\"", - } - - ini_setting { 'cluster_protobuf_heartbeat': - section => 'cluster', - setting => 'protobuf_heartbeat', - value => "\"${influxdb::cluster_protobuf_heartbeat}\"", - } - - ini_setting { 'cluster_protobuf_min_backoff': - section => 'cluster', - setting => 'protobuf_min_backoff', - value => "\"${influxdb::cluster_protobuf_min_backoff}\"", - } - - ini_setting { 'cluster_protobuf_max_backoff': - section => 'cluster', - setting => 'protobuf_max_backoff', - value => "\"${influxdb::cluster_protobuf_max_backoff}\"", - } - - ini_setting { 'cluster_write_buffer_size': - section => 'cluster', - setting => 'write-buffer-size', - value => $influxdb::cluster_write_buffer_size, - } - - ini_setting { 'cluster_max_response_buffer_size': - section => 'cluster', - setting => 'max-response-buffer-size', - value => $influxdb::cluster_max_response_buffer_size, - } - - ini_setting { 'cluster_concurrent_shard_query_limit': - section => 'cluster', - setting => 'concurrent-shard-query-limit', - value => $influxdb::cluster_concurrent_shard_query_limit, - } - - # [leveldb] - ini_setting { 'leveldb_max_open_files': - section => 'leveldb', - setting => 'max-open-files', - value => $influxdb::leveldb_max_open_files, - } - - ini_setting { 'leveldb_lru_cache_size': - section => 'leveldb', - setting => 'lru-cache-size', - value => "\"${influxdb::leveldb_lru_cache_size}\"", - } - - ini_setting { 'leveldb_max_open_shards': - section => 'leveldb', - setting => 'max-open-shards', - value => $influxdb::leveldb_max_open_shards, - } - - ini_setting { 'leveldb_point_batch_size': - section => 'leveldb', - setting => 'point-batch-size', - value => $influxdb::leveldb_point_batch_size, - } - - ini_setting { 'leveldb_point_write_size': - section => 'leveldb', - setting => 'point-write-size', - value => $influxdb::leveldb_point_write_size, - } - - # [sharding] - - # [wal] - ini_setting { 'wal_dir': - section => 'wal', - setting => 'dir', - value => "\"${influxdb::wal_dir}\"", - } - - ini_setting { 'wal_flush_after': - section => 'wal', - setting => 'flush-after', - value => $influxdb::wal_flush_after, - } - - ini_setting { 'wal_bookmark_after': - section => 'wal', - setting => 'bookmark-after', - value => $influxdb::wal_bookmark_after, - } - - ini_setting { 'wal_index_after': - section => 'wal', - setting => 'index-after', - value => $influxdb::wal_index_after, - } - - ini_setting { 'wal_requests_per_logfile': - section => 'wal', - setting => 'requests-per-logfile', - value => $influxdb::wal_requests_per_logfile, - } - - # defaults for all settings - Ini_setting { - ensure => present, - path => $influxdb::config_path, - notify => Service['influxdb'], - require => Package['influxdb'], - } } diff --git a/manifests/init.pp b/manifests/init.pp index 929c9b4..3db47c5 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,45 +1,16 @@ # == Class: influxdb class influxdb ( - $ensure = $influxdb::params::ensure, - $version = $influxdb::params::version, - $install_from_repository = $influxdb::params::install_from_repository, - $config_path = $influxdb::params::config_path, - $hostname = $influxdb::params::hostname, - $bind_address = $influxdb::params::bind_address, - $logging_level = $influxdb::params::logging_level, - $logging_file = $influxdb::params::logging_file, - $admin_port = $influxdb::params::admin_port, - $admin_assets = $influxdb::params::admin_assets, - $api_port = $influxdb::params::api_port, - $api_read_timeout = $influxdb::params::api_read_timeout, - $raft_port = $influxdb::params::raft_port, - $raft_dir = $influxdb::params::raft_dir, - $raft_election_timeout = $influxdb::params::raft_election_timeout, - $storage_dir = $influxdb::params::storage_dir, - $storage_write_buffer_size = $influxdb::params::storage_write_buffer_size, - $cluster_seed_servers = $influxdb::params::cluster_seed_servers, - $cluster_protobuf_port = $influxdb::params::cluster_protobuf_port, - $cluster_protobuf_timeout = $influxdb::params::cluster_protobuf_timeout, - $cluster_protobuf_heartbeat = $influxdb::params::cluster_protobuf_heartbeat, - $cluster_protobuf_min_backoff = $influxdb::params::cluster_protobuf_min_backoff, - $cluster_protobuf_max_backoff = $influxdb::params::cluster_protobuf_max_backoff, - $cluster_write_buffer_size = $influxdb::params::cluster_write_buffer_size, - $cluster_max_response_buffer_size = $influxdb::params::cluster_max_response_buffer_size, - $cluster_concurrent_shard_query_limit = $influxdb::params::cluster_concurrent_shard_query_limit, - $leveldb_max_open_files = $influxdb::params::leveldb_max_open_files, - $leveldb_lru_cache_size = $influxdb::params::leveldb_lru_cache_size, - $leveldb_max_open_shards = $influxdb::params::leveldb_max_open_shards, - $leveldb_point_batch_size = $influxdb::params::leveldb_point_batch_size, - $leveldb_write_batch_size = $influxdb::params::leveldb_write_batch_size, - $wal_dir = $influxdb::params::wal_dir, - $wal_flush_after = $influxdb::params::wal_flush_after, - $wal_bookmark_after = $influxdb::params::wal_bookmark_after, - $wal_index_after = $influxdb::params::wal_index_after, - $wal_requests_per_logfile = $influxdb::params::wal_requests_per_logfile, + $ensure = $influxdb::params::ensure, + $version = $influxdb::params::version, + $install_from_repository = $influxdb::params::$install_from_repository, + $config_path = $influxdb::params::config_path, + $reporting_disabled = $influxdb::params::reporting_disabled, + $logging_level = $influxdb::params::logging_level, + $logging_file = $influxdb::params::logging_file, + $cluster_seed_servers = $influxdb::params::cluster_seed_servers, ) inherits influxdb::params { - class { 'influxdb::config': } - class { 'influxdb::install': } + class { 'influxdb::install': } -> + class { 'influxdb::config': } ~> class { 'influxdb::service': } - } diff --git a/manifests/install.pp b/manifests/install.pp index 8136598..a1e4692 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -1,41 +1,61 @@ # == Class: influxdb::install # DO NO CALL DIRECTLY class influxdb::install { - package { 'influxdb': - ensure => $influxdb::ensure, + $package_ensure = $influxdb::ensure + case $package_ensure { + true: { + $my_package_ensure = 'present' + } + false: { + $my_package_ensure = 'absent' + } + 'absent': { + $my_package_ensure = 'absent' + } + 'purged': { + $my_package_ensure = 'purged' + } + default: { + $my_package_ensure = $package_ensure + } } - if !$influxdb::install_from_repository { + + if ((!$influxdb::install_from_repository) and ($my_package_ensure == 'present')) { # package source and provider case $::osfamily { 'Debian': { - $package_provider = 'dpkg' - $package_source = $::architecture ? { - /64/ => "http://s3.amazonaws.com/influxdb/influxdb_${influxdb::version}_amd64.deb", - default => "http://s3.amazonaws.com/influxdb/influxdb_${influxdb::version}_i386.deb", + $package_source_name = $::architecture ? { + /64/ => "influxdb_${influxdb::version}_amd64.deb", + default => "influxdb_${influxdb::version}_i386.deb", + } + $package_source = "http://s3.amazonaws.com/influxdb/$package_source_name" + exec { "influxdb.deb": + command => "wget --quiet --output-document=- $package_source | dpkg --install -", + path => ['/bin', '/usr/bin'], + unless => 'rpm -qa | grep influxdb', } } 'RedHat', 'Amazon': { - $package_provider = 'rpm' - $package_source = $::architecture ? { + $package_source_name = $::architecture ? { /64/ => "http://s3.amazonaws.com/influxdb/influxdb-${influxdb::version}-1.x86_64.rpm", default => "http://s3.amazonaws.com/influxdb/influxdb-${influxdb::version}-1.i686.rpm", } + $package_source = "http://s3.amazonaws.com/influxdb/$package_source_name" + exec { "influxdb.rpm": + command => "rpm -ivh $package_source", + path => ['/bin', '/usr/bin'], + unless => 'rpm -qa | grep influxdb', + } } default: { fail('Only supports Debian or RedHat $::osfamily') } } + } - # get the package - staging::file { 'influxdb-package': - source => $package_source, - } - - # install the package - Package['influxdb']{ - provider => $package_provider, - source => '/opt/staging/influxdb/influxdb-package', - require => Staging::File['influxdb-package'], - } + # install / purge the package + package { 'influxdb': + ensure => $my_package_ensure, } + } diff --git a/manifests/params.pp b/manifests/params.pp index 003d5df..c88cde4 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -3,59 +3,16 @@ class influxdb::params { $ensure = 'installed' $version = 'latest' - $install_from_repository = false + $install_from_repository = true $config_path = '/opt/influxdb/shared/config.toml' - $hostname = $::hostname - $bind_address = '0.0.0.0' + # general section oof config.toml + $reporting_disabled = false # [logging] $logging_level = 'info' $logging_file = '/opt/influxdb/shared/influxdb.log' - - # [admin] - $admin_port = '8083' - $admin_assets = '/opt/influxdb/current/admin' - - # [api] - $api_port = '8086' - $api_read_timeout = '5s' - - # [input_plugins] - - # [raft] - $raft_port = '8090' - $raft_dir = '/opt/influxdb/shared/data/raft' - $raft_election_timeout = '1s' - - # [storage] - $storage_dir = '/opt/influxdb/shared/data/db' - $storage_write_buffer_size = '10000' - + # [cluster] $cluster_seed_servers = '[]' - $cluster_protobuf_port = '8099' - $cluster_protobuf_timeout = '2s' - $cluster_protobuf_heartbeat = '200ms' - $cluster_protobuf_min_backoff = '1s' - $cluster_protobuf_max_backoff = '10s' - $cluster_write_buffer_size = '10000' - $cluster_max_response_buffer_size = '100' - $cluster_concurrent_shard_query_limit = '10' - - # [leveldb] - $leveldb_max_open_files = '40' - $leveldb_lru_cache_size = '200m' - $leveldb_max_open_shards = '0' - $leveldb_point_batch_size = '100' - $leveldb_point_write_size = '5000000' - - # [sharding] - - # [wal] - $wal_dir = '/opt/influxdb/shared/data/wal' - $wal_flush_after = '0' - $wal_bookmark_after = '0' - $wal_index_after = '1000' - $wal_requests_per_logfile = '10000' } diff --git a/templates/config.toml b/templates/config.toml new file mode 100644 index 0000000..eefd622 --- /dev/null +++ b/templates/config.toml @@ -0,0 +1,199 @@ +# Welcome to the InfluxDB configuration file. + +# If hostname (on the OS) doesn't return a name that can be resolved by the other +# systems in the cluster, you'll have to set the hostname to an IP or something +# that can be resolved here. +# hostname = "" + +bind-address = "0.0.0.0" + +# Once every 24 hours InfluxDB will report anonymous data to m.influxdb.com +# The data includes raft name (random 8 bytes), os, arch and version +# 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 + +[logging] +# logging level can be one of "fine", "debug", "info", "warn" or "error" +level = "info" +file = "/opt/influxdb/shared/log.txt" # stdout to log to standard out, or syslog facility + +# Configure the admin server +[admin] +port = 8083 # binding is disabled if the port isn't set + +# Configure the http api +[api] +port = 8086 # binding is disabled if the port isn't set +# ssl-port = 8084 # Ssl support is enabled if you set a port and cert +# ssl-cert = /path/to/cert.pem + +# connections will timeout after this amount of time. Ensures that clients that misbehave +# and keep alive connections they don't use won't end up connection a million times. +# However, if a request is taking longer than this to complete, could be a problem. +read-timeout = "5s" + +[input_plugins] + + # Configure the graphite api + [input_plugins.graphite] + enabled = false + # address = "0.0.0.0" # If not set, is actually set to bind-address. + # port = 2003 + # database = "" # store graphite data in this database + # udp_enabled = true # enable udp interface on the same port as the tcp interface + + # Configure the collectd api + [input_plugins.collectd] + enabled = false + # address = "0.0.0.0" # If not set, is actually set to bind-address. + # port = 25826 + # database = "" + # types.db can be found in a collectd installation or on github: + # https://github.com/collectd/collectd/blob/master/src/types.db + # typesdb = "/usr/share/collectd/types.db" # The path to the collectd types.db file + + # Configure the udp api + [input_plugins.udp] + enabled = false + # port = 4444 + # database = "" + + # Configure multiple udp apis each can write to separate db. Just + # repeat the following section to enable multiple udp apis on + # different ports. + [[input_plugins.udp_servers]] # array of tables + enabled = false + # port = 5551 + # database = "db1" + +# Raft configuration +[raft] +# The raft port should be open between all servers in a cluster. +# However, this port shouldn't be accessible from the internet. + +port = 8090 + +# Where the raft logs are stored. The user running InfluxDB will need read/write access. +dir = "/opt/influxdb/shared/data/raft" + +debug = false + +# election-timeout = "1s" + +[storage] + +dir = "/opt/influxdb/shared/data/db" +# How many requests to potentially buffer in memory. If the buffer gets filled then writes +# will still be logged and once the local storage has caught up (or compacted) the writes +# will be replayed from the WAL +write-buffer-size = 10000 + +# the engine to use for new shards, old shards will continue to use the same engine +default-engine = "rocksdb" + +# The default setting on this is 0, which means unlimited. Set this to something if you want to +# limit the max number of open files. max-open-files is per shard so this * that will be max. +max-open-shards = 0 + +# The default setting is 100. This option tells how many points will be fetched from LevelDb before +# they get flushed into backend. +point-batch-size = 100 + +# The number of points to batch in memory before writing them to leveldb. Lowering this number will +# reduce the memory usage, but will result in slower writes. +write-batch-size = 5000000 + +# The server will check this often for shards that have expired that should be cleared. +retention-sweep-period = "10m" + +[storage.engines.leveldb] + +# Maximum mmap open files, this will affect the virtual memory used by +# the process +max-open-files = 1000 + +# LRU cache size, LRU is used by leveldb to store contents of the +# uncompressed sstables. You can use `m` or `g` prefix for megabytes +# and gigabytes, respectively. +lru-cache-size = "200m" + +[storage.engines.rocksdb] + +# Maximum mmap open files, this will affect the virtual memory used by +# the process +max-open-files = 1000 + +# LRU cache size, LRU is used by rocksdb to store contents of the +# uncompressed sstables. You can use `m` or `g` prefix for megabytes +# and gigabytes, respectively. +lru-cache-size = "200m" + +[storage.engines.hyperleveldb] + +# Maximum mmap open files, this will affect the virtual memory used by +# the process +max-open-files = 1000 + +# LRU cache size, LRU is used by rocksdb to store contents of the +# uncompressed sstables. You can use `m` or `g` prefix for megabytes +# and gigabytes, respectively. +lru-cache-size = "200m" + +[storage.engines.lmdb] + +map-size = "100g" + +[cluster] +# A comma separated list of servers to seed +# this server. this is only relevant when the +# server is joining a new cluster. Otherwise +# the server will use the list of known servers +# prior to shutting down. Any server can be pointed to +# as a seed. It will find the Raft leader automatically. + +# Here's an example. Note that the port on the host is the same as the raft port. +# seed-servers = ["hosta:8090","hostb:8090"] + +# Replication happens over a TCP connection with a Protobuf protocol. +# This port should be reachable between all servers in a cluster. +# However, this port shouldn't be accessible from the internet. + +protobuf_port = 8099 +protobuf_timeout = "2s" # the write timeout on the protobuf conn any duration parseable by time.ParseDuration +protobuf_heartbeat = "200ms" # the heartbeat interval between the servers. must be parseable by time.ParseDuration +protobuf_min_backoff = "1s" # the minimum backoff after a failed heartbeat attempt +protobuf_max_backoff = "10s" # the maxmimum backoff after a failed heartbeat attempt + +# How many write requests to potentially buffer in memory per server. If the buffer gets filled then writes +# will still be logged and once the server has caught up (or come back online) the writes +# will be replayed from the WAL +write-buffer-size = 1000 + +# the maximum number of responses to buffer from remote nodes, if the +# expected number of responses exceed this number then querying will +# happen sequentially and the buffer size will be limited to this +# number +max-response-buffer-size = 100 + +# When queries get distributed out to shards, they go in parallel. This means that results can get buffered +# in memory since results will come in any order, but have to be processed in the correct time order. +# Setting this higher will give better performance, but you'll need more memory. Setting this to 1 will ensure +# that you don't need to buffer in memory, but you won't get the best performance. +concurrent-shard-query-limit = 10 + +[wal] + +dir = "/opt/influxdb/shared/data/wal" +flush-after = 1000 # the number of writes after which wal will be flushed, 0 for flushing on every write +bookmark-after = 1000 # the number of writes after which a bookmark will be created + +# the number of writes after which an index entry is created pointing +# to the offset of the first request, default to 1k +index-after = 1000 + +# the number of requests per one log file, if new requests came in a +# new log file will be created +requests-per-logfile = 10000 From f1b0543547ef4eba3eab440bcbb66de3563b1cd8 Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Mon, 29 Dec 2014 22:20:40 +0100 Subject: [PATCH 06/67] remove test for staging --- spec/classes/install_spec.rb | 45 ------------------------------------ 1 file changed, 45 deletions(-) diff --git a/spec/classes/install_spec.rb b/spec/classes/install_spec.rb index 3a520c4..51a794f 100644 --- a/spec/classes/install_spec.rb +++ b/spec/classes/install_spec.rb @@ -1,49 +1,6 @@ require 'spec_helper' describe 'influxdb::install' do - context 'with default params' do - let(:pre_condition) { - 'include influxdb' - } - context 'on debian' do - let(:facts) { - { - :osfamily => 'Debian', - :architecture => 'x86_64', - } - } - - it { should contain_staging__file('influxdb-package').with( - :source => 'http://s3.amazonaws.com/influxdb/influxdb_latest_amd64.deb', - )} - - it { should contain_package('influxdb').with( - :ensure => 'installed', - :provider => 'dpkg', - :source => '/opt/staging/influxdb/influxdb-package', - :require => 'Staging::File[influxdb-package]', - )} - end - context 'on redhat' do - let(:facts) { - { - :osfamily => 'RedHat', - :architecture => 'x86_64', - } - } - - it { should contain_staging__file('influxdb-package').with( - :source => 'http://s3.amazonaws.com/influxdb/influxdb-latest-1.x86_64.rpm', - )} - - it { should contain_package('influxdb').with( - :ensure => 'installed', - :provider => 'rpm', - :source => '/opt/staging/influxdb/influxdb-package', - :require => 'Staging::File[influxdb-package]', - )} - end - end context 'installing from a repository' do let(:pre_condition) { 'class{"influxdb": @@ -58,7 +15,6 @@ } } - it { should_not contain_staging__file('influxdb-package') } it { should contain_package('influxdb').with( :ensure => 'installed', )} @@ -71,7 +27,6 @@ } } - it { should_not contain_staging__file('influxdb-package') } it { should contain_package('influxdb').with( :ensure => 'installed', )} From c1e17be5688b20c3d96a278e1bf24a6b967ee245 Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Mon, 29 Dec 2014 22:26:16 +0100 Subject: [PATCH 07/67] fix paramter copy-paste-error --- manifests/init.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/init.pp b/manifests/init.pp index 3db47c5..a69032b 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -2,7 +2,7 @@ class influxdb ( $ensure = $influxdb::params::ensure, $version = $influxdb::params::version, - $install_from_repository = $influxdb::params::$install_from_repository, + $install_from_repository = $influxdb::params::install_from_repository, $config_path = $influxdb::params::config_path, $reporting_disabled = $influxdb::params::reporting_disabled, $logging_level = $influxdb::params::logging_level, From edfc63324cffee94dd8cb3cd4033049d46a18832 Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Wed, 31 Dec 2014 07:38:20 +0100 Subject: [PATCH 08/67] update to new puppet forgeapi system --- Puppetfile | 2 +- Puppetfile.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Puppetfile b/Puppetfile index 98da5ff..948c1b7 100644 --- a/Puppetfile +++ b/Puppetfile @@ -1,3 +1,3 @@ -forge 'http://forge.puppetlabs.com' +forge 'https://forgeapi.puppetlabs.com' mod 'puppetlabs/inifile', '>= 1.0.0' diff --git a/Puppetfile.lock b/Puppetfile.lock index 1f64d80..bd6b671 100644 --- a/Puppetfile.lock +++ b/Puppetfile.lock @@ -1,8 +1,8 @@ FORGE - remote: http://forge.puppetlabs.com + remote: https://forgeapi.puppetlabs.com specs: - puppetlabs/inifile (1.0.3) + puppetlabs-inifile (1.2.0) DEPENDENCIES - puppetlabs/inifile (>= 1.0.0) + puppetlabs-inifile (>= 1.0.0) From a7e9cce154f6448560e528e4eebbf0d7111691c1 Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Wed, 31 Dec 2014 08:29:30 +0100 Subject: [PATCH 09/67] enhance vagrant setup and documentation --- README.md | 18 ++++++++++++++++-- Vagrantfile | 26 ++++++++++++++------------ 2 files changed, 30 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 53fd6a2..9037a30 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,22 @@ Most of the configuration is parameterized, so you can freely adjust settings. ## Testing +Install and setup vagrant (link)[https://docs.vagrantup.com/v2/installation/index.html] + +Add virtual machines +``` +vagrant box add puppetlabs/centos-6.5-64-puppet --insecure +vagrant box add puppetlabs/centos-7.0-64-puppet --insecure +vagrant box add puppetlabs/ubuntu-14.04-64-puppet --insecure +vagrant box add puppetlabs/debian-7.6-64-puppet --insecure +``` + +Add vagrant puppet support +``` +vagrant plugin install vagrant-librarian-puppet +``` + +Run Tests ``` -bundle install -bundle exec librarian-puppet install vagrant up ``` diff --git a/Vagrantfile b/Vagrantfile index facfd58..6518728 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,24 +1,29 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + # Vagrantfile API/syntax version. Don't touch unless you know what you're doing! VAGRANTFILE_API_VERSION = "2" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.hostname = 'puppet-influxdb' + config.vm.box_download_insecure = true + config.vm.synced_folder "modules", "/tmp/puppet-modules", type: "rsync", rsync__exclude: ".git/" config.vm.synced_folder ".", "/tmp/puppet-modules/influxdb", type: "rsync", rsync__exclude: ".git/" - config.vm.define "centos6", primary: true do |centos| - centos.vm.box = "puppetlabs/centos-6.5-64-puppet" - centos.vm.provision :puppet do |puppet| + config.vm.define "centos6", primary: true do |centos6| + centos6.vm.box = "puppetlabs/centos-6.5-64-puppet" + centos6.vm.provision :puppet do |puppet| puppet.manifests_path = "tests" puppet.manifest_file = "vagrant.pp" puppet.options = ["--modulepath", "/tmp/puppet-modules"] end end - config.vm.define "centos7", autostart: false do |centos| - centos.vm.box = "puppetlabs/centos-7.0-64-puppet" - centos.vm.provision :puppet do |puppet| + config.vm.define "centos7", autostart: false do |centos7| + centos7.vm.box = "puppetlabs/centos-7.0-64-puppet" + centos7.vm.provision :puppet do |puppet| puppet.manifests_path = "tests" puppet.manifest_file = "vagrant.pp" puppet.options = ["--modulepath", "/tmp/puppet-modules"] @@ -34,9 +39,9 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| end end - config.vm.define "debian", autostart: false do |ubuntu| - ubuntu.vm.box = "puppetlabs/debian-7.6-64-puppet" - ubuntu.vm.provision :puppet do |puppet| + config.vm.define "debian", autostart: false do |debian| + debian.vm.box = "puppetlabs/debian-7.6-64-puppet" + debian.vm.provision :puppet do |puppet| puppet.manifests_path = "tests" puppet.manifest_file = "vagrant.pp" puppet.options = ["--modulepath", "/tmp/puppet-modules"] @@ -44,6 +49,3 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| end end - -# -*- mode: ruby -*- -# vi: set ft=ruby : From 8639a1ba809d30dba3f1e5bd57f1ef5a64dd1018 Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Wed, 31 Dec 2014 08:33:02 +0100 Subject: [PATCH 10/67] change look and feel in docu --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9037a30..64ac625 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Most of the configuration is parameterized, so you can freely adjust settings. Install and setup vagrant (link)[https://docs.vagrantup.com/v2/installation/index.html] Add virtual machines -``` +```ShellSession vagrant box add puppetlabs/centos-6.5-64-puppet --insecure vagrant box add puppetlabs/centos-7.0-64-puppet --insecure vagrant box add puppetlabs/ubuntu-14.04-64-puppet --insecure @@ -31,11 +31,11 @@ vagrant box add puppetlabs/debian-7.6-64-puppet --insecure ``` Add vagrant puppet support -``` +```ShellSession vagrant plugin install vagrant-librarian-puppet ``` Run Tests -``` +```ShellSession vagrant up ``` From 32477572b98ca193b9211ca15378712d9a7985b3 Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Wed, 31 Dec 2014 11:26:55 +0100 Subject: [PATCH 11/67] change vagrant setup: - ubuntu is my main plattform - install package from not website with new handler --- Vagrantfile | 24 ++++++++++++------------ tests/vagrant.pp | 5 ++++- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 6518728..06588d1 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -12,36 +12,36 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.synced_folder "modules", "/tmp/puppet-modules", type: "rsync", rsync__exclude: ".git/" config.vm.synced_folder ".", "/tmp/puppet-modules/influxdb", type: "rsync", rsync__exclude: ".git/" - config.vm.define "centos6", primary: true do |centos6| - centos6.vm.box = "puppetlabs/centos-6.5-64-puppet" - centos6.vm.provision :puppet do |puppet| + config.vm.define "ubuntu", primary: true do |ubuntu| + ubuntu.vm.box = "puppetlabs/ubuntu-14.04-64-puppet" + ubuntu.vm.provision :puppet do |puppet| puppet.manifests_path = "tests" puppet.manifest_file = "vagrant.pp" puppet.options = ["--modulepath", "/tmp/puppet-modules"] end end - config.vm.define "centos7", autostart: false do |centos7| - centos7.vm.box = "puppetlabs/centos-7.0-64-puppet" - centos7.vm.provision :puppet do |puppet| + config.vm.define "debian", autostart: false do |debian| + debian.vm.box = "puppetlabs/debian-7.6-64-puppet" + debian.vm.provision :puppet do |puppet| puppet.manifests_path = "tests" puppet.manifest_file = "vagrant.pp" puppet.options = ["--modulepath", "/tmp/puppet-modules"] end end - config.vm.define "ubuntu", autostart: false do |ubuntu| - ubuntu.vm.box = "puppetlabs/ubuntu-14.04-64-puppet" - ubuntu.vm.provision :puppet do |puppet| + config.vm.define "centos6", autostart: false do |centos6| + centos6.vm.box = "puppetlabs/centos-6.5-64-puppet" + centos6.vm.provision :puppet do |puppet| puppet.manifests_path = "tests" puppet.manifest_file = "vagrant.pp" puppet.options = ["--modulepath", "/tmp/puppet-modules"] end end - config.vm.define "debian", autostart: false do |debian| - debian.vm.box = "puppetlabs/debian-7.6-64-puppet" - debian.vm.provision :puppet do |puppet| + config.vm.define "centos7", autostart: false do |centos7| + centos7.vm.box = "puppetlabs/centos-7.0-64-puppet" + centos7.vm.provision :puppet do |puppet| puppet.manifests_path = "tests" puppet.manifest_file = "vagrant.pp" puppet.options = ["--modulepath", "/tmp/puppet-modules"] diff --git a/tests/vagrant.pp b/tests/vagrant.pp index 782add4..f9c56ef 100644 --- a/tests/vagrant.pp +++ b/tests/vagrant.pp @@ -1 +1,4 @@ -class { 'influxdb': } +class { + 'influxdb': + install_from_repository => false; +} From 0a0e527f585a9a349f133f776ba83518a9d975b1 Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Wed, 31 Dec 2014 11:27:53 +0100 Subject: [PATCH 12/67] fix installation for installation with wget and dpkg --- manifests/install.pp | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/manifests/install.pp b/manifests/install.pp index a1e4692..c106710 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -20,7 +20,7 @@ } } - if ((!$influxdb::install_from_repository) and ($my_package_ensure == 'present')) { + if ((!$influxdb::install_from_repository) and ($my_package_ensure =~ /present|installed/ )) { # package source and provider case $::osfamily { 'Debian': { @@ -29,10 +29,21 @@ default => "influxdb_${influxdb::version}_i386.deb", } $package_source = "http://s3.amazonaws.com/influxdb/$package_source_name" - exec { "influxdb.deb": - command => "wget --quiet --output-document=- $package_source | dpkg --install -", - path => ['/bin', '/usr/bin'], - unless => 'rpm -qa | grep influxdb', + exec { + "influxdb_wget": + command => "wget ${package_source} -O /tmp/${package_source_name}", + path => ['/bin', '/usr/bin'], + unless => 'dpkg --list | grep influxdb'; + + "influxdb_dpkg": + command => "sudo dpkg -i /tmp/${package_source_name}", + path => ['/bin', '/usr/bin'], + require => [ Exec["influxdb_wget"] ]; + + "influxdb_rm": + command => "rm /tmp/${package_source_name}", + path => ['/bin', '/usr/bin'], + require => [ Exec["influxdb_dpkg"] ]; } } 'RedHat', 'Amazon': { @@ -42,7 +53,7 @@ } $package_source = "http://s3.amazonaws.com/influxdb/$package_source_name" exec { "influxdb.rpm": - command => "rpm -ivh $package_source", + command => "sudo rpm -ivh $package_source", path => ['/bin', '/usr/bin'], unless => 'rpm -qa | grep influxdb', } @@ -55,7 +66,6 @@ # install / purge the package package { 'influxdb': - ensure => $my_package_ensure, - } - + ensure => $my_package_ensure, + } } From a9521a3b7f30cfb57e03917ff4c1d3e764ff2bf4 Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Wed, 7 Jan 2015 15:57:00 +0100 Subject: [PATCH 13/67] vagrant testing documentation after workmate test --- README.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 64ac625..8ef52e0 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Most of the configuration is parameterized, so you can freely adjust settings. Install and setup vagrant (link)[https://docs.vagrantup.com/v2/installation/index.html] -Add virtual machines +Add virtual machines (with vagrant 1.7.4) ```ShellSession vagrant box add puppetlabs/centos-6.5-64-puppet --insecure vagrant box add puppetlabs/centos-7.0-64-puppet --insecure @@ -30,6 +30,14 @@ vagrant box add puppetlabs/ubuntu-14.04-64-puppet --insecure vagrant box add puppetlabs/debian-7.6-64-puppet --insecure ``` +Add virtual machines (with vagrant 1.4.3) +```ShellSession +vagrant box add puppetlabs/centos-6.5-64-puppet vagrant box add "puppetlabs/centos-6.5-64-puppet" https://vagrantcloud.com/puppetlabs/boxes/centos-6.5-64-puppet/versions/1.0.0/providers/virtualbox.box +vagrant box add puppetlabs/centos-7.0-64-puppet vagrant box add "puppetlabs/centos-7.0-64-puppet" https://vagrantcloud.com/puppetlabs/boxes/centos-7.0-64-puppet/versions/1.0.0/providers/virtualbox.box +vagrant box add puppetlabs/ubuntu-14.04-64-puppet https://vagrantcloud.com/puppetlabs/boxes/ubuntu-14.04-64-puppet/versions/1.0.0/providers/virtualbox.box +vagrant box add puppetlabs/debian-7.6-64-puppet https://vagrantcloud.com/puppetlabs/boxes/debian-7.6-64-puppet/versions/1.0.0/providers/virtualbox.box +``` + Add vagrant puppet support ```ShellSession vagrant plugin install vagrant-librarian-puppet From 14d32a09ea12cf3529da62030e76951e3a3b362d Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Wed, 7 Jan 2015 15:57:42 +0100 Subject: [PATCH 14/67] should be not necessary - dependency is given in init.pp --- manifests/config.pp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/manifests/config.pp b/manifests/config.pp index c573df1..a45e8f4 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -1,15 +1,13 @@ # == Class: influxdb::config -# -# only values which are effectivly changed are here -# +# only values which are effectivly changed will be managed +# config API will be changed from 0.8 to 0.9 # More information on these settings available at: http://influxdb.org/docs/configuration.html +# DO NO CALL DIRECTLY class influxdb::config { # defaults for all settings Ini_setting { ensure => present, path => $influxdb::config_path, - notify => Service['influxdb'], - require => Package['influxdb'], } # specific changes From 69e43114dc1d111afa78093b189a210df2e5ee33 Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Wed, 7 Jan 2015 15:58:10 +0100 Subject: [PATCH 15/67] add finish class installation / configuration event for puppet --- manifests/init.pp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/manifests/init.pp b/manifests/init.pp index a69032b..e9808c8 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -12,5 +12,6 @@ class { 'influxdb::install': } -> class { 'influxdb::config': } ~> - class { 'influxdb::service': } + class { 'influxdb::service': } -> + Class['influxdb'] } From 0dfe5ee2b8ef4bc337c3aa8b6940ad41ddc8fc3e Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Wed, 7 Jan 2015 15:58:46 +0100 Subject: [PATCH 16/67] order is given in init.pp --- manifests/service.pp | 1 - 1 file changed, 1 deletion(-) diff --git a/manifests/service.pp b/manifests/service.pp index 80b45ec..7280740 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -5,6 +5,5 @@ ensure => running, enable => true, hasrestart => true, - require => Package['influxdb'], } } From 49dce192114aba793baab27b16547b01a35dc0ca Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Wed, 7 Jan 2015 15:59:02 +0100 Subject: [PATCH 17/67] style fixes --- manifests/params.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/params.pp b/manifests/params.pp index c88cde4..db1e63a 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -12,7 +12,7 @@ # [logging] $logging_level = 'info' $logging_file = '/opt/influxdb/shared/influxdb.log' - + # [cluster] $cluster_seed_servers = '[]' } From ed85d46e596e530f8a1faaab13ce4f7612e4cfda Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Wed, 7 Jan 2015 16:03:13 +0100 Subject: [PATCH 18/67] change year --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 9b595ae..552df58 100644 --- a/LICENSE +++ b/LICENSE @@ -1,7 +1,7 @@ The MIT License (MIT) Copyright (c) 2014 Justin Downing -Copyright (c) 2014 Roman Plessl +Copyright (c) 2014-2015 Roman Plessl Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the From 5bdb4ffd26afd50e27dabcf770ca6740b8e64d1d Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Wed, 7 Jan 2015 16:03:33 +0100 Subject: [PATCH 19/67] remove staging module --- metadata.json | 1 - 1 file changed, 1 deletion(-) diff --git a/metadata.json b/metadata.json index 3a3535d..510f152 100644 --- a/metadata.json +++ b/metadata.json @@ -8,7 +8,6 @@ "description": "Setup and manage influxdb", "project_page": "https://github.com/rplessl/puppet-influxdb", "dependencies": [ - { "name": "nanliu/staging", "version_requirement": ">= 0.4.0" }, { "name": "puppetlabs/inifile", "version_requirement": ">= 1.0.0" } ], "operatingsystem_support": [ From 6e14553e6dad75825379af3ea19a645125b2a7ff Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Wed, 7 Jan 2015 16:03:47 +0100 Subject: [PATCH 20/67] improve documentation --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8ef52e0..bceec35 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Most of the configuration is parameterized, so you can freely adjust settings. Install and setup vagrant (link)[https://docs.vagrantup.com/v2/installation/index.html] -Add virtual machines (with vagrant 1.7.4) +Add virtual machines (with vagrant 1.7.4) or ... ```ShellSession vagrant box add puppetlabs/centos-6.5-64-puppet --insecure vagrant box add puppetlabs/centos-7.0-64-puppet --insecure @@ -30,7 +30,7 @@ vagrant box add puppetlabs/ubuntu-14.04-64-puppet --insecure vagrant box add puppetlabs/debian-7.6-64-puppet --insecure ``` -Add virtual machines (with vagrant 1.4.3) +... add virtual machines (with vagrant 1.4.3) ```ShellSession vagrant box add puppetlabs/centos-6.5-64-puppet vagrant box add "puppetlabs/centos-6.5-64-puppet" https://vagrantcloud.com/puppetlabs/boxes/centos-6.5-64-puppet/versions/1.0.0/providers/virtualbox.box vagrant box add puppetlabs/centos-7.0-64-puppet vagrant box add "puppetlabs/centos-7.0-64-puppet" https://vagrantcloud.com/puppetlabs/boxes/centos-7.0-64-puppet/versions/1.0.0/providers/virtualbox.box From 1a69910cc501bcc6282229ef25c9ef92f6e6a25c Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Wed, 7 Jan 2015 16:04:07 +0100 Subject: [PATCH 21/67] change install mechanism --- manifests/install.pp | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/manifests/install.pp b/manifests/install.pp index c106710..e433442 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -28,44 +28,46 @@ /64/ => "influxdb_${influxdb::version}_amd64.deb", default => "influxdb_${influxdb::version}_i386.deb", } - $package_source = "http://s3.amazonaws.com/influxdb/$package_source_name" + $package_source = "http://s3.amazonaws.com/influxdb/${package_source_name}" exec { - "influxdb_wget": + 'influxdb_wget': command => "wget ${package_source} -O /tmp/${package_source_name}", path => ['/bin', '/usr/bin'], - unless => 'dpkg --list | grep influxdb'; + unless => 'dpkg --list influxdb', - "influxdb_dpkg": - command => "sudo dpkg -i /tmp/${package_source_name}", + 'influxdb_dpkg': + command => "dpkg -i /tmp/${package_source_name}", path => ['/bin', '/usr/bin'], - require => [ Exec["influxdb_wget"] ]; + require => [ Exec['influxdb_wget'] ]; - "influxdb_rm": + 'influxdb_rm': command => "rm /tmp/${package_source_name}", path => ['/bin', '/usr/bin'], - require => [ Exec["influxdb_dpkg"] ]; + require => [ Exec['influxdb_dpkg'] ]; + } } 'RedHat', 'Amazon': { $package_source_name = $::architecture ? { - /64/ => "http://s3.amazonaws.com/influxdb/influxdb-${influxdb::version}-1.x86_64.rpm", - default => "http://s3.amazonaws.com/influxdb/influxdb-${influxdb::version}-1.i686.rpm", + /64/ => "influxdb-${influxdb::version}-1.x86_64.rpm", + default => "influxdb-${influxdb::version}-1.i686.rpm", } - $package_source = "http://s3.amazonaws.com/influxdb/$package_source_name" - exec { "influxdb.rpm": - command => "sudo rpm -ivh $package_source", + $package_source = "http://s3.amazonaws.com/influxdb/${package_source_name}" + exec { 'influxdb.rpm': + command => "rpm -ivh ${package_source}", path => ['/bin', '/usr/bin'], - unless => 'rpm -qa | grep influxdb', + unless => 'rpm -qa influxdb', } } default: { - fail('Only supports Debian or RedHat $::osfamily') + fail('Only supports Debian / Ubuntu or RedHat $::osfamily') } } } - - # install / purge the package - package { 'influxdb': - ensure => $my_package_ensure, - } + else { + # install / purge the package + package { 'influxdb': + ensure => $my_package_ensure, + } + } } From e6762a06451513a2d78c7f06500b89e6adabce31 Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Wed, 7 Jan 2015 16:12:23 +0100 Subject: [PATCH 22/67] changed vagrant / puppet testing setup --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index bceec35..a012425 100644 --- a/README.md +++ b/README.md @@ -39,11 +39,10 @@ vagrant box add puppetlabs/debian-7.6-64-puppet https://vagrantcloud.com/puppe ``` Add vagrant puppet support -```ShellSession -vagrant plugin install vagrant-librarian-puppet -``` Run Tests ```ShellSession +bundle install +bundle exec librarian-puppet install vagrant up ``` From c388810b6fd8e11a6e66620c4a65d2479dce7cb8 Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Wed, 7 Jan 2015 16:26:14 +0100 Subject: [PATCH 23/67] :dog: --- manifests/install.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/install.pp b/manifests/install.pp index e433442..9bc1193 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -33,7 +33,7 @@ 'influxdb_wget': command => "wget ${package_source} -O /tmp/${package_source_name}", path => ['/bin', '/usr/bin'], - unless => 'dpkg --list influxdb', + unless => 'dpkg --list influxdb'; 'influxdb_dpkg': command => "dpkg -i /tmp/${package_source_name}", From e3d4e6662913a616d58e870b0cb5278319f77769 Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Wed, 7 Jan 2015 16:33:33 +0100 Subject: [PATCH 24/67] added testing environment --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a012425..a9e04ea 100644 --- a/README.md +++ b/README.md @@ -32,8 +32,8 @@ vagrant box add puppetlabs/debian-7.6-64-puppet --insecure ... add virtual machines (with vagrant 1.4.3) ```ShellSession -vagrant box add puppetlabs/centos-6.5-64-puppet vagrant box add "puppetlabs/centos-6.5-64-puppet" https://vagrantcloud.com/puppetlabs/boxes/centos-6.5-64-puppet/versions/1.0.0/providers/virtualbox.box -vagrant box add puppetlabs/centos-7.0-64-puppet vagrant box add "puppetlabs/centos-7.0-64-puppet" https://vagrantcloud.com/puppetlabs/boxes/centos-7.0-64-puppet/versions/1.0.0/providers/virtualbox.box +vagrant box add "puppetlabs/centos-6.5-64-puppet" https://vagrantcloud.com/puppetlabs/boxes/centos-6.5-64-puppet/versions/1.0.0/providers/virtualbox.box +vagrant box add "puppetlabs/centos-7.0-64-puppet" https://vagrantcloud.com/puppetlabs/boxes/centos-7.0-64-puppet/versions/1.0.0/providers/virtualbox.box vagrant box add puppetlabs/ubuntu-14.04-64-puppet https://vagrantcloud.com/puppetlabs/boxes/ubuntu-14.04-64-puppet/versions/1.0.0/providers/virtualbox.box vagrant box add puppetlabs/debian-7.6-64-puppet https://vagrantcloud.com/puppetlabs/boxes/debian-7.6-64-puppet/versions/1.0.0/providers/virtualbox.box ``` From adb75cae83d8d75b388efbda06d3d812d70de2f1 Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Thu, 8 Jan 2015 07:45:25 +0100 Subject: [PATCH 25/67] only describe vagrant 1.7+ setup --- README.md | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/README.md b/README.md index a9e04ea..85e45b8 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Most of the configuration is parameterized, so you can freely adjust settings. Install and setup vagrant (link)[https://docs.vagrantup.com/v2/installation/index.html] -Add virtual machines (with vagrant 1.7.4) or ... +Add virtual machines ```ShellSession vagrant box add puppetlabs/centos-6.5-64-puppet --insecure vagrant box add puppetlabs/centos-7.0-64-puppet --insecure @@ -30,14 +30,6 @@ vagrant box add puppetlabs/ubuntu-14.04-64-puppet --insecure vagrant box add puppetlabs/debian-7.6-64-puppet --insecure ``` -... add virtual machines (with vagrant 1.4.3) -```ShellSession -vagrant box add "puppetlabs/centos-6.5-64-puppet" https://vagrantcloud.com/puppetlabs/boxes/centos-6.5-64-puppet/versions/1.0.0/providers/virtualbox.box -vagrant box add "puppetlabs/centos-7.0-64-puppet" https://vagrantcloud.com/puppetlabs/boxes/centos-7.0-64-puppet/versions/1.0.0/providers/virtualbox.box -vagrant box add puppetlabs/ubuntu-14.04-64-puppet https://vagrantcloud.com/puppetlabs/boxes/ubuntu-14.04-64-puppet/versions/1.0.0/providers/virtualbox.box -vagrant box add puppetlabs/debian-7.6-64-puppet https://vagrantcloud.com/puppetlabs/boxes/debian-7.6-64-puppet/versions/1.0.0/providers/virtualbox.box -``` - Add vagrant puppet support Run Tests From cf7026eb5615118b6b0b8f2f9bdfa234e576bb3e Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Thu, 8 Jan 2015 07:52:51 +0100 Subject: [PATCH 26/67] improve documentation about parameters and default values --- README.md | 29 ++++++++++++++++++++++------- manifests/params.pp | 2 +- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 85e45b8..760c868 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# influxdb +# puppet-influxdb [![Build Status](https://travis-ci.org/rplessl/puppet-influxdb.png)](https://travis-ci.org/rplessl/puppet-influxdb) @@ -16,13 +16,30 @@ This module bases on the module of [puppet-influx module of justin downing](http `class { 'influxdb': }` -Most of the configuration is parameterized, so you can freely adjust settings. +These configuration parameter can be set: +``` + $ensure = 'installed' + $version = 'latest' + $install_from_repository = true + $config_path = '/opt/influxdb/shared/config.toml' + + # general section of config.toml + $reporting_disabled = false + + # [logging] + $logging_level = 'info' + $logging_file = '/opt/influxdb/shared/influxdb.log' + + # [cluster] + $cluster_seed_servers = '[]' +``` + ## Testing -Install and setup vagrant (link)[https://docs.vagrantup.com/v2/installation/index.html] +Install and setup vagrant [https://docs.vagrantup.com/v2/installation/index.html](as here described). -Add virtual machines +Fetch virtual machines: ```ShellSession vagrant box add puppetlabs/centos-6.5-64-puppet --insecure vagrant box add puppetlabs/centos-7.0-64-puppet --insecure @@ -30,9 +47,7 @@ vagrant box add puppetlabs/ubuntu-14.04-64-puppet --insecure vagrant box add puppetlabs/debian-7.6-64-puppet --insecure ``` -Add vagrant puppet support - -Run Tests +Add vagrant puppet support and run tests: ```ShellSession bundle install bundle exec librarian-puppet install diff --git a/manifests/params.pp b/manifests/params.pp index db1e63a..8a037ba 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -6,7 +6,7 @@ $install_from_repository = true $config_path = '/opt/influxdb/shared/config.toml' - # general section oof config.toml + # general section of config.toml $reporting_disabled = false # [logging] From 6876d2fcc67e38c0100f203f46000a0924b97a9d Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Thu, 8 Jan 2015 10:50:05 +0100 Subject: [PATCH 27/67] updated Vagrant test setup and added documentation about testing in the README --- README.md | 5 ++++- Vagrantfile | 9 +++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 760c868..0b2ba61 100644 --- a/README.md +++ b/README.md @@ -41,9 +41,12 @@ Install and setup vagrant [https://docs.vagrantup.com/v2/installation/index.html Fetch virtual machines: ```ShellSession +vagrant box add puppetlabs/ubuntu-14.04-64-puppet --insecure vagrant box add puppetlabs/centos-6.5-64-puppet --insecure vagrant box add puppetlabs/centos-7.0-64-puppet --insecure -vagrant box add puppetlabs/ubuntu-14.04-64-puppet --insecure +``` +Debian 7 vagrant image has a virtualbox mounting issue: (to be fixed) +```ShellSession vagrant box add puppetlabs/debian-7.6-64-puppet --insecure ``` diff --git a/Vagrantfile b/Vagrantfile index 06588d1..129f3db 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -21,6 +21,15 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| end end + config.vm.define "debian6", autostart: false do |debian6| + debian6.vm.box = "puppetlabs/debian-6.0.9-64-puppet" + debian6.vm.provision :puppet do |puppet| + puppet.manifests_path = "tests" + puppet.manifest_file = "vagrant.pp" + puppet.options = ["--modulepath", "/tmp/puppet-modules"] + end + end + config.vm.define "debian", autostart: false do |debian| debian.vm.box = "puppetlabs/debian-7.6-64-puppet" debian.vm.provision :puppet do |puppet| From c5f9cef907b249649a7e6a899f495ce2273f22a7 Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Thu, 8 Jan 2015 10:50:59 +0100 Subject: [PATCH 28/67] improve test cases / coverage --- spec/classes/config_spec.rb | 25 +++++++++++++++++++++++++ spec/classes/install_spec.rb | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 spec/classes/config_spec.rb diff --git a/spec/classes/config_spec.rb b/spec/classes/config_spec.rb new file mode 100644 index 0000000..e7349c6 --- /dev/null +++ b/spec/classes/config_spec.rb @@ -0,0 +1,25 @@ +require 'spec_helper' + +describe 'influxdb::config' do + + context 'with default preset variables' do + let(:pre_condition) { + "class{'influxdb' : + install_from_repository => true, + config_path => '/opt/influxdb/shared/config.toml' + log_file => '/opt/influxdb/shared/influxdb.log' + }" + } + + it { + should contain_file('/opt/influxdb/shared/config.toml').with({ + :mode => '0644', + :owner => 'influxdb', + :group => 'influxdb' + }) + + should contain_file('/opt/influxdb/shared/config.toml').with_content(/^bind-address/) + should contain_file('/opt/influxdb/shared/config.toml').with_content(/^file\s=\s\/opt\/influxdb\/shared\/influxdb.log/) + } + end +end diff --git a/spec/classes/install_spec.rb b/spec/classes/install_spec.rb index 51a794f..4e95fab 100644 --- a/spec/classes/install_spec.rb +++ b/spec/classes/install_spec.rb @@ -1,6 +1,7 @@ require 'spec_helper' describe 'influxdb::install' do + # default params case context 'installing from a repository' do let(:pre_condition) { 'class{"influxdb": @@ -32,4 +33,36 @@ )} end end + context 'installing from weburl' do + let(:pre_condition) { + 'class{"influxdb": + install_from_repository => false, + }' + } + context 'on debian' do + let(:facts) { + { + :osfamily => 'Debian', + :architecture => 'x86_64', + } + } + + it { + should contain_file('/opt/influxdb/versions/influxdb_from_web') + } + } + context 'on redhat' do + let(:facts) { + { + :osfamily => 'RedHat', + :architecture => 'x86_64', + } + } + + it { + should contain_file('/opt/influxdb/versions/influxdb_from_web') + } + end + end + end From 42f371e40a0b8d1bbc507d30cf4ec5078286e3ba Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Thu, 8 Jan 2015 10:51:38 +0100 Subject: [PATCH 29/67] remove old operating systems (OS not tested and nearly EOL) --- metadata.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/metadata.json b/metadata.json index 510f152..2e007ab 100644 --- a/metadata.json +++ b/metadata.json @@ -2,7 +2,7 @@ "name": "rplessl-influxdb", "version": "0.4.0", "source": "https://github.com/rplessl/puppet-influxdb", - "author": "Roman Plessl", + "author": "Justin Downing and Roman Plessl", "license": "MIT License", "summary": "Setup and manage influxdb", "description": "Setup and manage influxdb", @@ -13,19 +13,19 @@ "operatingsystem_support": [ { "operatingsystem": "RedHat", - "operatingsystemrelease": [ "5", "6", "7" ] + "operatingsystemrelease": [ "6", "7" ] }, { "operatingsystem": "CentOS", - "operatingsystemrelease": [ "5", "6", "7" ] + "operatingsystemrelease": [ "6", "7" ] }, { "operatingsystem": "OracleLinux", - "operatingsystemrelease": [ "5", "6", "7" ] + "operatingsystemrelease": [ "6", "7" ] }, { "operatingsystem": "Scientific", - "operatingsystemrelease": [ "5", "6", "7" ] + "operatingsystemrelease": [ "6", "7" ] }, { "operatingsystem": "Debian", @@ -33,7 +33,7 @@ }, { "operatingsystem": "Ubuntu", - "operatingsystemrelease": [ "10.04", "12.04", "14.04" ] + "operatingsystemrelease": [ "12.04", "14.04" ] } ], "requirements": [ From 45969ef24b6c2896dac2e754e824b19ff0f1e586 Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Thu, 8 Jan 2015 10:52:37 +0100 Subject: [PATCH 30/67] remove template file ... change of single ini contents make more sense --- templates/config.toml | 199 ------------------------------------------ 1 file changed, 199 deletions(-) delete mode 100644 templates/config.toml diff --git a/templates/config.toml b/templates/config.toml deleted file mode 100644 index eefd622..0000000 --- a/templates/config.toml +++ /dev/null @@ -1,199 +0,0 @@ -# Welcome to the InfluxDB configuration file. - -# If hostname (on the OS) doesn't return a name that can be resolved by the other -# systems in the cluster, you'll have to set the hostname to an IP or something -# that can be resolved here. -# hostname = "" - -bind-address = "0.0.0.0" - -# Once every 24 hours InfluxDB will report anonymous data to m.influxdb.com -# The data includes raft name (random 8 bytes), os, arch and version -# 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 - -[logging] -# logging level can be one of "fine", "debug", "info", "warn" or "error" -level = "info" -file = "/opt/influxdb/shared/log.txt" # stdout to log to standard out, or syslog facility - -# Configure the admin server -[admin] -port = 8083 # binding is disabled if the port isn't set - -# Configure the http api -[api] -port = 8086 # binding is disabled if the port isn't set -# ssl-port = 8084 # Ssl support is enabled if you set a port and cert -# ssl-cert = /path/to/cert.pem - -# connections will timeout after this amount of time. Ensures that clients that misbehave -# and keep alive connections they don't use won't end up connection a million times. -# However, if a request is taking longer than this to complete, could be a problem. -read-timeout = "5s" - -[input_plugins] - - # Configure the graphite api - [input_plugins.graphite] - enabled = false - # address = "0.0.0.0" # If not set, is actually set to bind-address. - # port = 2003 - # database = "" # store graphite data in this database - # udp_enabled = true # enable udp interface on the same port as the tcp interface - - # Configure the collectd api - [input_plugins.collectd] - enabled = false - # address = "0.0.0.0" # If not set, is actually set to bind-address. - # port = 25826 - # database = "" - # types.db can be found in a collectd installation or on github: - # https://github.com/collectd/collectd/blob/master/src/types.db - # typesdb = "/usr/share/collectd/types.db" # The path to the collectd types.db file - - # Configure the udp api - [input_plugins.udp] - enabled = false - # port = 4444 - # database = "" - - # Configure multiple udp apis each can write to separate db. Just - # repeat the following section to enable multiple udp apis on - # different ports. - [[input_plugins.udp_servers]] # array of tables - enabled = false - # port = 5551 - # database = "db1" - -# Raft configuration -[raft] -# The raft port should be open between all servers in a cluster. -# However, this port shouldn't be accessible from the internet. - -port = 8090 - -# Where the raft logs are stored. The user running InfluxDB will need read/write access. -dir = "/opt/influxdb/shared/data/raft" - -debug = false - -# election-timeout = "1s" - -[storage] - -dir = "/opt/influxdb/shared/data/db" -# How many requests to potentially buffer in memory. If the buffer gets filled then writes -# will still be logged and once the local storage has caught up (or compacted) the writes -# will be replayed from the WAL -write-buffer-size = 10000 - -# the engine to use for new shards, old shards will continue to use the same engine -default-engine = "rocksdb" - -# The default setting on this is 0, which means unlimited. Set this to something if you want to -# limit the max number of open files. max-open-files is per shard so this * that will be max. -max-open-shards = 0 - -# The default setting is 100. This option tells how many points will be fetched from LevelDb before -# they get flushed into backend. -point-batch-size = 100 - -# The number of points to batch in memory before writing them to leveldb. Lowering this number will -# reduce the memory usage, but will result in slower writes. -write-batch-size = 5000000 - -# The server will check this often for shards that have expired that should be cleared. -retention-sweep-period = "10m" - -[storage.engines.leveldb] - -# Maximum mmap open files, this will affect the virtual memory used by -# the process -max-open-files = 1000 - -# LRU cache size, LRU is used by leveldb to store contents of the -# uncompressed sstables. You can use `m` or `g` prefix for megabytes -# and gigabytes, respectively. -lru-cache-size = "200m" - -[storage.engines.rocksdb] - -# Maximum mmap open files, this will affect the virtual memory used by -# the process -max-open-files = 1000 - -# LRU cache size, LRU is used by rocksdb to store contents of the -# uncompressed sstables. You can use `m` or `g` prefix for megabytes -# and gigabytes, respectively. -lru-cache-size = "200m" - -[storage.engines.hyperleveldb] - -# Maximum mmap open files, this will affect the virtual memory used by -# the process -max-open-files = 1000 - -# LRU cache size, LRU is used by rocksdb to store contents of the -# uncompressed sstables. You can use `m` or `g` prefix for megabytes -# and gigabytes, respectively. -lru-cache-size = "200m" - -[storage.engines.lmdb] - -map-size = "100g" - -[cluster] -# A comma separated list of servers to seed -# this server. this is only relevant when the -# server is joining a new cluster. Otherwise -# the server will use the list of known servers -# prior to shutting down. Any server can be pointed to -# as a seed. It will find the Raft leader automatically. - -# Here's an example. Note that the port on the host is the same as the raft port. -# seed-servers = ["hosta:8090","hostb:8090"] - -# Replication happens over a TCP connection with a Protobuf protocol. -# This port should be reachable between all servers in a cluster. -# However, this port shouldn't be accessible from the internet. - -protobuf_port = 8099 -protobuf_timeout = "2s" # the write timeout on the protobuf conn any duration parseable by time.ParseDuration -protobuf_heartbeat = "200ms" # the heartbeat interval between the servers. must be parseable by time.ParseDuration -protobuf_min_backoff = "1s" # the minimum backoff after a failed heartbeat attempt -protobuf_max_backoff = "10s" # the maxmimum backoff after a failed heartbeat attempt - -# How many write requests to potentially buffer in memory per server. If the buffer gets filled then writes -# will still be logged and once the server has caught up (or come back online) the writes -# will be replayed from the WAL -write-buffer-size = 1000 - -# the maximum number of responses to buffer from remote nodes, if the -# expected number of responses exceed this number then querying will -# happen sequentially and the buffer size will be limited to this -# number -max-response-buffer-size = 100 - -# When queries get distributed out to shards, they go in parallel. This means that results can get buffered -# in memory since results will come in any order, but have to be processed in the correct time order. -# Setting this higher will give better performance, but you'll need more memory. Setting this to 1 will ensure -# that you don't need to buffer in memory, but you won't get the best performance. -concurrent-shard-query-limit = 10 - -[wal] - -dir = "/opt/influxdb/shared/data/wal" -flush-after = 1000 # the number of writes after which wal will be flushed, 0 for flushing on every write -bookmark-after = 1000 # the number of writes after which a bookmark will be created - -# the number of writes after which an index entry is created pointing -# to the offset of the first request, default to 1k -index-after = 1000 - -# the number of requests per one log file, if new requests came in a -# new log file will be created -requests-per-logfile = 10000 From f646e08125370ab0f290c7a64903e1dbb1065097 Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Thu, 8 Jan 2015 10:53:09 +0100 Subject: [PATCH 31/67] added tracking with timestamp for installation from web, fix dpkg install for postinst script --- manifests/install.pp | 20 +++++++++++++++----- manifests/service.pp | 2 +- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/manifests/install.pp b/manifests/install.pp index 9bc1193..9b84f0b 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -37,7 +37,7 @@ 'influxdb_dpkg': command => "dpkg -i /tmp/${package_source_name}", - path => ['/bin', '/usr/bin'], + path => ['/bin', '/sbin', '/usr/bin'], require => [ Exec['influxdb_wget'] ]; 'influxdb_rm': @@ -45,6 +45,10 @@ path => ['/bin', '/usr/bin'], require => [ Exec['influxdb_dpkg'] ]; + 'influxdb_from_web': + command => "echo Installed ${package_source_name} on `date --rfc-2822` > /opt/influxdb/versions/influxdb_from_web", + path => ['/bin', '/usr/bin'], + require => [ Exec['influxdb_dpkg'] ]; } } 'RedHat', 'Amazon': { @@ -53,10 +57,16 @@ default => "influxdb-${influxdb::version}-1.i686.rpm", } $package_source = "http://s3.amazonaws.com/influxdb/${package_source_name}" - exec { 'influxdb.rpm': - command => "rpm -ivh ${package_source}", - path => ['/bin', '/usr/bin'], - unless => 'rpm -qa influxdb', + exec { + 'influxdb_rpm': + command => "rpm -ivh ${package_source}", + path => ['/bin', '/usr/bin'], + unless => 'rpm -qa | grep influxdb'; + + 'influxdb_from_web': + command => "echo Installed ${package_source_name} on `date --rfc-2822` > /opt/influxdb/versions/influxdb_from_web", + path => ['/bin', '/usr/bin'], + require => [ Exec['influxdb_rpm'] ]; } } default: { diff --git a/manifests/service.pp b/manifests/service.pp index 7280740..340b0e5 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -4,6 +4,6 @@ service { 'influxdb': ensure => running, enable => true, - hasrestart => true, + hasrestart => true; } } From 37b0d3582f079833d141e9a41d4d63500a666b6d Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Thu, 8 Jan 2015 10:57:29 +0100 Subject: [PATCH 32/67] :dog: --- spec/classes/install_spec.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spec/classes/install_spec.rb b/spec/classes/install_spec.rb index 4e95fab..3a2c853 100644 --- a/spec/classes/install_spec.rb +++ b/spec/classes/install_spec.rb @@ -50,7 +50,7 @@ it { should contain_file('/opt/influxdb/versions/influxdb_from_web') } - } + end context 'on redhat' do let(:facts) { { @@ -64,5 +64,4 @@ } end end - end From 68288047dfdf4690c65961066d6d359f81e33817 Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Thu, 8 Jan 2015 11:05:08 +0100 Subject: [PATCH 33/67] fix missing, ... :construction_worker: --- spec/classes/config_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/classes/config_spec.rb b/spec/classes/config_spec.rb index e7349c6..c1f6ca0 100644 --- a/spec/classes/config_spec.rb +++ b/spec/classes/config_spec.rb @@ -6,7 +6,7 @@ let(:pre_condition) { "class{'influxdb' : install_from_repository => true, - config_path => '/opt/influxdb/shared/config.toml' + config_path => '/opt/influxdb/shared/config.toml', log_file => '/opt/influxdb/shared/influxdb.log' }" } From 668f9bf6921aa2a3942b61c3dfb55e8f019e0185 Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Thu, 8 Jan 2015 13:08:59 +0100 Subject: [PATCH 34/67] this has to be logging_file --- spec/classes/config_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/classes/config_spec.rb b/spec/classes/config_spec.rb index c1f6ca0..fbcf7e7 100644 --- a/spec/classes/config_spec.rb +++ b/spec/classes/config_spec.rb @@ -7,7 +7,7 @@ "class{'influxdb' : install_from_repository => true, config_path => '/opt/influxdb/shared/config.toml', - log_file => '/opt/influxdb/shared/influxdb.log' + logging_file => '/opt/influxdb/shared/influxdb.log' }" } From af688cdd80657fd187d7934ad9471c6def0b2e61 Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Thu, 8 Jan 2015 13:12:01 +0100 Subject: [PATCH 35/67] fix test --- spec/classes/install_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/classes/install_spec.rb b/spec/classes/install_spec.rb index 3a2c853..588a87f 100644 --- a/spec/classes/install_spec.rb +++ b/spec/classes/install_spec.rb @@ -5,7 +5,7 @@ context 'installing from a repository' do let(:pre_condition) { 'class{"influxdb": - install_from_repository => true, + install_from_repository => true, }' } context 'on debian' do @@ -36,7 +36,7 @@ context 'installing from weburl' do let(:pre_condition) { 'class{"influxdb": - install_from_repository => false, + install_from_repository => false, }' } context 'on debian' do From 150907d800721714ce938f0796d117b0d0c23715 Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Thu, 8 Jan 2015 13:32:03 +0100 Subject: [PATCH 36/67] added test for service --- spec/classes/config_spec.rb | 25 ------------------------- spec/classes/service_spec.rb | 11 +++++++++++ 2 files changed, 11 insertions(+), 25 deletions(-) delete mode 100644 spec/classes/config_spec.rb create mode 100644 spec/classes/service_spec.rb diff --git a/spec/classes/config_spec.rb b/spec/classes/config_spec.rb deleted file mode 100644 index fbcf7e7..0000000 --- a/spec/classes/config_spec.rb +++ /dev/null @@ -1,25 +0,0 @@ -require 'spec_helper' - -describe 'influxdb::config' do - - context 'with default preset variables' do - let(:pre_condition) { - "class{'influxdb' : - install_from_repository => true, - config_path => '/opt/influxdb/shared/config.toml', - logging_file => '/opt/influxdb/shared/influxdb.log' - }" - } - - it { - should contain_file('/opt/influxdb/shared/config.toml').with({ - :mode => '0644', - :owner => 'influxdb', - :group => 'influxdb' - }) - - should contain_file('/opt/influxdb/shared/config.toml').with_content(/^bind-address/) - should contain_file('/opt/influxdb/shared/config.toml').with_content(/^file\s=\s\/opt\/influxdb\/shared\/influxdb.log/) - } - end -end diff --git a/spec/classes/service_spec.rb b/spec/classes/service_spec.rb new file mode 100644 index 0000000..c2b3375 --- /dev/null +++ b/spec/classes/service_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe 'influxdb::service' do + it { + should contain_service('influxdb').with( + 'ensure' => 'running', + 'enable' => 'true', + 'hasrestart' => 'true', + ) + } +end From 62eb56b74028831022a2082066bdcd4e4ab176d0 Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Thu, 8 Jan 2015 13:41:05 +0100 Subject: [PATCH 37/67] try to fix handler web vs. repo install --- spec/classes/install_spec.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/spec/classes/install_spec.rb b/spec/classes/install_spec.rb index 588a87f..adc1978 100644 --- a/spec/classes/install_spec.rb +++ b/spec/classes/install_spec.rb @@ -4,9 +4,7 @@ # default params case context 'installing from a repository' do let(:pre_condition) { - 'class{"influxdb": - install_from_repository => true, - }' + 'include influxdb' } context 'on debian' do let(:facts) { From 0655eff7c1b4f5a695e5c8c9108f64c386e66f89 Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Thu, 8 Jan 2015 14:39:59 +0100 Subject: [PATCH 38/67] improve test --- Rakefile | 2 +- spec/classes/influxdb_config_spec.rb | 27 +++++++++++++++++++ spec/classes/influxdb_init_spec.rb | 8 ++++++ ...stall_spec.rb => influxdb_install_spec.rb} | 21 ++++++++++----- spec/classes/influxdb_service_spec.rb | 10 +++++++ spec/classes/influxdb_spec.rb | 12 --------- spec/classes/service_spec.rb | 11 -------- spec/spec_helper.rb | 6 +++++ 8 files changed, 66 insertions(+), 31 deletions(-) create mode 100644 spec/classes/influxdb_config_spec.rb create mode 100644 spec/classes/influxdb_init_spec.rb rename spec/classes/{install_spec.rb => influxdb_install_spec.rb} (77%) create mode 100644 spec/classes/influxdb_service_spec.rb delete mode 100644 spec/classes/influxdb_spec.rb delete mode 100644 spec/classes/service_spec.rb diff --git a/Rakefile b/Rakefile index 0f572fd..8647caa 100644 --- a/Rakefile +++ b/Rakefile @@ -1,9 +1,9 @@ require 'bundler' Bundler.require(:rake) +require 'rubygems' require 'puppetlabs_spec_helper/rake_tasks' require 'puppet-lint/tasks/puppet-lint' -require 'puppet_blacksmith/rake_tasks' Rake::Task[:lint].clear PuppetLint::RakeTask.new :lint do |config| diff --git a/spec/classes/influxdb_config_spec.rb b/spec/classes/influxdb_config_spec.rb new file mode 100644 index 0000000..13fc254 --- /dev/null +++ b/spec/classes/influxdb_config_spec.rb @@ -0,0 +1,27 @@ +require 'spec_helper' + +describe 'influxdb::config' :type => :class do + + it { should create_class('influxdb::config') } + + context 'with default preset variables' do + let(:pre_condition) { + 'class{"influxdb" : + install_from_repository => true, + config_path => "/opt/influxdb/shared/config.toml", + logging_file => "/opt/influxdb/shared/influxdb.log" + }' + } + + it { + should contain_file('/opt/influxdb/shared/config.toml').with({ + :mode => '0644', + :owner => 'influxdb', + :group => 'influxdb' + } ) + + should contain_file('/opt/influxdb/shared/config.toml').with_content(/^bind-address/) + should contain_file('/opt/influxdb/shared/config.toml').with_content(/^file\s=\s\/opt\/influxdb\/shared\/influxdb.log/) + } + end +end diff --git a/spec/classes/influxdb_init_spec.rb b/spec/classes/influxdb_init_spec.rb new file mode 100644 index 0000000..9639eca --- /dev/null +++ b/spec/classes/influxdb_init_spec.rb @@ -0,0 +1,8 @@ +require 'spec_helper' + +describe 'influxdb', :type => 'class' do + + it { should contain_class('influxdb::params') } + it { should create_class('influxdb') } + +end diff --git a/spec/classes/install_spec.rb b/spec/classes/influxdb_install_spec.rb similarity index 77% rename from spec/classes/install_spec.rb rename to spec/classes/influxdb_install_spec.rb index adc1978..118ad37 100644 --- a/spec/classes/install_spec.rb +++ b/spec/classes/influxdb_install_spec.rb @@ -1,10 +1,16 @@ require 'spec_helper' -describe 'influxdb::install' do - # default params case +describe 'influxdb::install', :type => :class do + + it { should create_class('influxdb::install') } + it { should contain_package('influxdb') } + context 'installing from a repository' do let(:pre_condition) { - 'include influxdb' + 'class{"influxdb": + ensure => "installed", + install_from_repository => true, + }' } context 'on debian' do let(:facts) { @@ -13,7 +19,6 @@ :architecture => 'x86_64', } } - it { should contain_package('influxdb').with( :ensure => 'installed', )} @@ -25,15 +30,16 @@ :architecture => 'x86_64', } } - it { should contain_package('influxdb').with( :ensure => 'installed', )} end end + context 'installing from weburl' do let(:pre_condition) { 'class{"influxdb": + ensure => "installed", install_from_repository => false, }' } @@ -44,7 +50,6 @@ :architecture => 'x86_64', } } - it { should contain_file('/opt/influxdb/versions/influxdb_from_web') } @@ -56,10 +61,12 @@ :architecture => 'x86_64', } } - it { should contain_file('/opt/influxdb/versions/influxdb_from_web') } end end + + it { should contain_file('/opt/influxdb').with('ensure' => 'directory') } + end diff --git a/spec/classes/influxdb_service_spec.rb b/spec/classes/influxdb_service_spec.rb new file mode 100644 index 0000000..68f0d93 --- /dev/null +++ b/spec/classes/influxdb_service_spec.rb @@ -0,0 +1,10 @@ +require 'spec_helper' + +describe 'influxdb::service', :type => :class do + + it { should create_class('influxdb::service') } + it { should contain_service('influxdb').with( + 'ensure' => 'running', + 'enable' => true + ) } +end diff --git a/spec/classes/influxdb_spec.rb b/spec/classes/influxdb_spec.rb deleted file mode 100644 index 87d293f..0000000 --- a/spec/classes/influxdb_spec.rb +++ /dev/null @@ -1,12 +0,0 @@ -require 'spec_helper' - -describe 'influxdb', :type => 'class' do - let(:facts) { { :osfamily => 'Debian' } } - - it { should contain_class("influxdb::params") } - - it { should contain_influxdb__config } - it { should contain_influxdb__install } - it { should contain_influxdb__service } - -end diff --git a/spec/classes/service_spec.rb b/spec/classes/service_spec.rb deleted file mode 100644 index c2b3375..0000000 --- a/spec/classes/service_spec.rb +++ /dev/null @@ -1,11 +0,0 @@ -require 'spec_helper' - -describe 'influxdb::service' do - it { - should contain_service('influxdb').with( - 'ensure' => 'running', - 'enable' => 'true', - 'hasrestart' => 'true', - ) - } -end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index d3923f8..5d8ae92 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,5 +1,11 @@ +require 'rubygems' +require 'puppetlabs_spec_helper/module_spec_helper' + require 'rspec-puppet' +# This will make stdlib functions available when test examples will run +$:.unshift File.join(File.dirname(__FILE__), 'fixtures', 'modules', 'stdlib', 'lib') + fixture_path = File.expand_path(File.join(__FILE__, '..', 'fixtures')) RSpec.configure do |c| From affe9a6afe0815c7483ad34ade05bb7e82b52416 Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Thu, 8 Jan 2015 14:43:42 +0100 Subject: [PATCH 39/67] fix typo --- spec/classes/influxdb_config_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/classes/influxdb_config_spec.rb b/spec/classes/influxdb_config_spec.rb index 13fc254..f070831 100644 --- a/spec/classes/influxdb_config_spec.rb +++ b/spec/classes/influxdb_config_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe 'influxdb::config' :type => :class do +describe 'influxdb::config', :type => :class do it { should create_class('influxdb::config') } From 718e903e5286a5683b00e06f4ca8578ae00e0b45 Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Thu, 8 Jan 2015 14:58:01 +0100 Subject: [PATCH 40/67] added debian case --- spec/classes/influxdb_config_spec.rb | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/spec/classes/influxdb_config_spec.rb b/spec/classes/influxdb_config_spec.rb index f070831..853d21e 100644 --- a/spec/classes/influxdb_config_spec.rb +++ b/spec/classes/influxdb_config_spec.rb @@ -13,15 +13,19 @@ }' } - it { - should contain_file('/opt/influxdb/shared/config.toml').with({ - :mode => '0644', - :owner => 'influxdb', - :group => 'influxdb' - } ) + context "on Debian based machines" do + let (:facts) { { :osfamily => 'Debian' } } - should contain_file('/opt/influxdb/shared/config.toml').with_content(/^bind-address/) - should contain_file('/opt/influxdb/shared/config.toml').with_content(/^file\s=\s\/opt\/influxdb\/shared\/influxdb.log/) - } + it { + should contain_file('/opt/influxdb/shared/config.toml').with({ + :mode => '0644', + :owner => 'influxdb', + :group => 'influxdb' + } ) + + should contain_file('/opt/influxdb/shared/config.toml').with_content(/^bind-address/) + should contain_file('/opt/influxdb/shared/config.toml').with_content(/^file\s=\s\/opt\/influxdb\/shared\/influxdb.log/) + } + end end end From 46f535ca00e7bd2eea1587ea0f6aff678a0debff Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Thu, 8 Jan 2015 15:06:04 +0100 Subject: [PATCH 41/67] test for config --- spec/classes/influxdb_config_spec.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/spec/classes/influxdb_config_spec.rb b/spec/classes/influxdb_config_spec.rb index 853d21e..62c15dc 100644 --- a/spec/classes/influxdb_config_spec.rb +++ b/spec/classes/influxdb_config_spec.rb @@ -14,7 +14,18 @@ } context "on Debian based machines" do - let (:facts) { { :osfamily => 'Debian' } } + let(:osfamily) { 'Debian' } + let(:operatingsystemmajrelease) { nil } + let(:lsbdistid) { 'Ubuntu' } + let(:lsbdistrelease) { '14.04' } + let(:facts) do + { + :osfamily => osfamily, + :operatingsystemmajrelease => operatingsystemmajrelease, + :lsbdistid => lsbdistid, + :lsbdistrelease => lsbdistrelease, + } + end it { should contain_file('/opt/influxdb/shared/config.toml').with({ From 41839d08961760a0a67bcd5a3c79da54041de3ed Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Thu, 8 Jan 2015 15:09:38 +0100 Subject: [PATCH 42/67] back to working baseline and retesting spec --- spec/classes/influxdb_config_spec.rb | 25 -------------------- spec/classes/influxdb_install_spec.rb | 34 --------------------------- 2 files changed, 59 deletions(-) diff --git a/spec/classes/influxdb_config_spec.rb b/spec/classes/influxdb_config_spec.rb index 62c15dc..1717758 100644 --- a/spec/classes/influxdb_config_spec.rb +++ b/spec/classes/influxdb_config_spec.rb @@ -13,30 +13,5 @@ }' } - context "on Debian based machines" do - let(:osfamily) { 'Debian' } - let(:operatingsystemmajrelease) { nil } - let(:lsbdistid) { 'Ubuntu' } - let(:lsbdistrelease) { '14.04' } - let(:facts) do - { - :osfamily => osfamily, - :operatingsystemmajrelease => operatingsystemmajrelease, - :lsbdistid => lsbdistid, - :lsbdistrelease => lsbdistrelease, - } - end - - it { - should contain_file('/opt/influxdb/shared/config.toml').with({ - :mode => '0644', - :owner => 'influxdb', - :group => 'influxdb' - } ) - - should contain_file('/opt/influxdb/shared/config.toml').with_content(/^bind-address/) - should contain_file('/opt/influxdb/shared/config.toml').with_content(/^file\s=\s\/opt\/influxdb\/shared\/influxdb.log/) - } - end end end diff --git a/spec/classes/influxdb_install_spec.rb b/spec/classes/influxdb_install_spec.rb index 118ad37..6c4479c 100644 --- a/spec/classes/influxdb_install_spec.rb +++ b/spec/classes/influxdb_install_spec.rb @@ -35,38 +35,4 @@ )} end end - - context 'installing from weburl' do - let(:pre_condition) { - 'class{"influxdb": - ensure => "installed", - install_from_repository => false, - }' - } - context 'on debian' do - let(:facts) { - { - :osfamily => 'Debian', - :architecture => 'x86_64', - } - } - it { - should contain_file('/opt/influxdb/versions/influxdb_from_web') - } - end - context 'on redhat' do - let(:facts) { - { - :osfamily => 'RedHat', - :architecture => 'x86_64', - } - } - it { - should contain_file('/opt/influxdb/versions/influxdb_from_web') - } - end - end - - it { should contain_file('/opt/influxdb').with('ensure' => 'directory') } - end From 790e4f60bb9f95bdd994d55f6aa5b392d57e1023 Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Thu, 8 Jan 2015 15:23:08 +0100 Subject: [PATCH 43/67] added Ruby 1.9.3 --- .travis.yml | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5eab22d..2641e41 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,19 +4,26 @@ branches: - master language: ruby rvm: + - 1.9.3 - 2.0.0 bundler_args: --without development -script: bundle exec rake spec SPEC_OPTS='--format documentation' +script: "bundle exec rake spec SPEC_OPTS='--format documentation'" env: - matrix: - - PUPPET_VERSION="2.7.25" - - PUPPET_VERSION="3.1.1" - - PUPPET_VERSION="3.2.4" - - PUPPET_VERSION="3.3.2" - - PUPPET_VERSION="3.4.2" - - PUPPET_VERSION="3.5.1" - - PUPPET_VERSION="3.6.2" - - PUPPET_VERSION="3.7.3" + - PUPPET_VERSION="~> 2.7.0" + - PUPPET_VERSION="~> 3.4.0" + - PUPPET_VERSION="~> 3.5.0" + - PUPPET_VERSION="~> 3.6.0" + - PUPPET_VERSION="~> 3.7.0" +matrix: + exclude: + - rvm: 1.9.3 + env: PUPPET_VERSION="~> 2.7.0" + - rvm: 2.0.0 + env: PUPPET_VERSION="~> 2.7.0" + - rvm: 2.0.0 + env: PUPPET_VERSION="~> 3.0.0" + - rvm: 2.0.0 + env: PUPPET_VERSION="~> 3.1.0" notifications: email: - roman@plessl.info From a65a7f2d8993eea10ef3ea9dd0e6078dcaecdb83 Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Mon, 12 Jan 2015 14:26:32 +0100 Subject: [PATCH 44/67] fix reporting_disabled and seed server config --- manifests/config.pp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/manifests/config.pp b/manifests/config.pp index a45e8f4..5602b99 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -11,10 +11,10 @@ } # specific changes - ini_setting { 'reporting_disabled': + ini_setting { 'reporting-disabled': section => '', - setting => 'reporting_disabled', - value => "\"${influxdb::logging_level}\"", + setting => 'reporting-disabled', + value => "\"${influxdb::reporting_disabled}\"", } # [logging] @@ -34,7 +34,7 @@ ini_setting { 'cluster_seed_servers': section => 'cluster', setting => 'seed-servers', - value => $influxdb::cluster_seed_servers, + value => "\"$influxdb::cluster_seed_servers\"", } } From 944d60534a1ecf351082d55ab1ca59b4bc0739a9 Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Wed, 11 Feb 2015 08:37:42 +0100 Subject: [PATCH 45/67] fix status check and restart especially when we use influxdb-collectd-proxy the status check from the init file will fail ... --- manifests/service.pp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/manifests/service.pp b/manifests/service.pp index 340b0e5..d9789b3 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -4,6 +4,7 @@ service { 'influxdb': ensure => running, enable => true, - hasrestart => true; + hasrestart => true, + status => '/usr/bin/pgrep -u influxdb -f "/usr/bin/influxdb "' } } From 89efd401026597168527ff9acdbf8a61e2160082 Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Wed, 15 Jul 2015 11:18:40 +0200 Subject: [PATCH 46/67] first step to make puppet-influxdb ready for influx 0.9.x --- .travis.yml | 6 +++++- README.md | 28 +++++++++++----------------- Vagrantfile | 6 +++--- manifests/config.pp | 38 ++++++++++++++++++++------------------ manifests/init.pp | 8 ++++---- manifests/install.pp | 6 +++--- manifests/params.pp | 12 ++++++------ manifests/service.pp | 2 +- metadata.json | 14 ++++++++++---- tests/vagrant.pp | 2 +- 10 files changed, 64 insertions(+), 58 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2641e41..40102cb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,3 @@ ---- branches: only: - master @@ -6,6 +5,7 @@ language: ruby rvm: - 1.9.3 - 2.0.0 + - 2.1.0 bundler_args: --without development script: "bundle exec rake spec SPEC_OPTS='--format documentation'" env: @@ -24,6 +24,10 @@ matrix: env: PUPPET_VERSION="~> 3.0.0" - rvm: 2.0.0 env: PUPPET_VERSION="~> 3.1.0" + - rvm: 2.1.0 + env: PUPPET_VERSION="~> 3.3.0" + - rvm: 2.1.0 + env: PUPPET_VERSION="~> 3.4.0" notifications: email: - roman@plessl.info diff --git a/README.md b/README.md index 0b2ba61..32b7dd7 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,6 @@ puppet module to install and configure [influxdb](https://influxdb.org). -This module bases on the module of [puppet-influx module of justin downing](https://github.com/justindowning/puppet-influxdb). - ## Installation `puppet module install --modulepath /path/to/puppet/modules rplessl-influxdb` @@ -18,36 +16,32 @@ This module bases on the module of [puppet-influx module of justin downing](http These configuration parameter can be set: ``` - $ensure = 'installed' + $ensure = 'installed' $version = 'latest' $install_from_repository = true - $config_path = '/opt/influxdb/shared/config.toml' + $config_file = '/etc/opt/influxdb/influxdb.conf' - # general section of config.toml + # general section of influxb.conf $reporting_disabled = false - # [logging] - $logging_level = 'info' - $logging_file = '/opt/influxdb/shared/influxdb.log' + # [meta] + $hostname = '192.168.0.1' + $peers = ['192.168.0.2', '192.168.0.3'] - # [cluster] - $cluster_seed_servers = '[]' + # [retention] + $replication = 3 ``` - ## Testing -Install and setup vagrant [https://docs.vagrantup.com/v2/installation/index.html](as here described). +Install and setup vagrant [https://docs.vagrantup.com/v2/installation/index.html](as described here). Fetch virtual machines: ```ShellSession vagrant box add puppetlabs/ubuntu-14.04-64-puppet --insecure -vagrant box add puppetlabs/centos-6.5-64-puppet --insecure +vagrant box add puppetlabs/centos-6.6-64-puppet --insecure vagrant box add puppetlabs/centos-7.0-64-puppet --insecure -``` -Debian 7 vagrant image has a virtualbox mounting issue: (to be fixed) -```ShellSession -vagrant box add puppetlabs/debian-7.6-64-puppet --insecure +vagrant box add puppetlabs/debian-7.8-64-puppet --insecure ``` Add vagrant puppet support and run tests: diff --git a/Vagrantfile b/Vagrantfile index 129f3db..4cffa00 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -22,7 +22,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| end config.vm.define "debian6", autostart: false do |debian6| - debian6.vm.box = "puppetlabs/debian-6.0.9-64-puppet" + debian6.vm.box = "puppetlabs/debian-6.0.10-64-puppet" debian6.vm.provision :puppet do |puppet| puppet.manifests_path = "tests" puppet.manifest_file = "vagrant.pp" @@ -31,7 +31,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| end config.vm.define "debian", autostart: false do |debian| - debian.vm.box = "puppetlabs/debian-7.6-64-puppet" + debian.vm.box = "puppetlabs/debian-7.8-64-puppet" debian.vm.provision :puppet do |puppet| puppet.manifests_path = "tests" puppet.manifest_file = "vagrant.pp" @@ -40,7 +40,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| end config.vm.define "centos6", autostart: false do |centos6| - centos6.vm.box = "puppetlabs/centos-6.5-64-puppet" + centos6.vm.box = "puppetlabs/centos-6.6-64-puppet" centos6.vm.provision :puppet do |puppet| puppet.manifests_path = "tests" puppet.manifest_file = "vagrant.pp" diff --git a/manifests/config.pp b/manifests/config.pp index 5602b99..5dbe6de 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -1,13 +1,15 @@ # == Class: influxdb::config +# # only values which are effectivly changed will be managed -# config API will be changed from 0.8 to 0.9 -# More information on these settings available at: http://influxdb.org/docs/configuration.html +# More information on these settings available at: +# https://influxdb.com/docs/v0.9/administration/config.html +# # DO NO CALL DIRECTLY -class influxdb::config { +class influxdb::config # defaults for all settings Ini_setting { ensure => present, - path => $influxdb::config_path, + path => $influxdb::config_file, } # specific changes @@ -17,24 +19,24 @@ value => "\"${influxdb::reporting_disabled}\"", } - # [logging] - ini_setting { 'logging_level': - section => 'logging', - setting => 'level', - value => "\"${influxdb::logging_level}\"", + # [meta] + ini_setting { 'meta_hostname': + section => 'meta', + setting => 'hostname', + value => "\"${influxdb::hostname}\"", } - ini_setting { 'logging_file': - section => 'logging', - setting => 'file', - value => "\"${influxdb::logging_file}\"", + ini_setting { 'meta_peers': + section => 'meta', + setting => 'peers', + value => "\"${influxdb::peers}\"", } - # [cluster] - ini_setting { 'cluster_seed_servers': - section => 'cluster', - setting => 'seed-servers', - value => "\"$influxdb::cluster_seed_servers\"", + # [retention] + ini_setting { 'retention_replication': + section => 'retention', + setting => 'replication', + value => "\"$influxdb::replication\"", } } diff --git a/manifests/init.pp b/manifests/init.pp index e9808c8..ea1ae3e 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -3,11 +3,11 @@ $ensure = $influxdb::params::ensure, $version = $influxdb::params::version, $install_from_repository = $influxdb::params::install_from_repository, - $config_path = $influxdb::params::config_path, + $config_file = $influxdb::params::config_file, $reporting_disabled = $influxdb::params::reporting_disabled, - $logging_level = $influxdb::params::logging_level, - $logging_file = $influxdb::params::logging_file, - $cluster_seed_servers = $influxdb::params::cluster_seed_servers, + $hostname = $influxdb::params::hostname, + $peers = $influxdb::params::peers, + $replication = $influxdb::params::replication, ) inherits influxdb::params { class { 'influxdb::install': } -> diff --git a/manifests/install.pp b/manifests/install.pp index 9b84f0b..da7d461 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -25,10 +25,10 @@ case $::osfamily { 'Debian': { $package_source_name = $::architecture ? { - /64/ => "influxdb_${influxdb::version}_amd64.deb", + default => "influxdb_${influxdb::version}_amd64.deb", default => "influxdb_${influxdb::version}_i386.deb", } - $package_source = "http://s3.amazonaws.com/influxdb/${package_source_name}" + $package_source = "http://influxdb.s3.amazonaws.com/${package_source_name}" exec { 'influxdb_wget': command => "wget ${package_source} -O /tmp/${package_source_name}", @@ -56,7 +56,7 @@ /64/ => "influxdb-${influxdb::version}-1.x86_64.rpm", default => "influxdb-${influxdb::version}-1.i686.rpm", } - $package_source = "http://s3.amazonaws.com/influxdb/${package_source_name}" + $package_source = "http://influxdb.s3.amazonaws.com/${package_source_name}" exec { 'influxdb_rpm': command => "rpm -ivh ${package_source}", diff --git a/manifests/params.pp b/manifests/params.pp index 8a037ba..4df8669 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -4,15 +4,15 @@ $ensure = 'installed' $version = 'latest' $install_from_repository = true - $config_path = '/opt/influxdb/shared/config.toml' + $config_file = '/etc/opt/influxdb/influxdb.conf' # general section of config.toml $reporting_disabled = false - # [logging] - $logging_level = 'info' - $logging_file = '/opt/influxdb/shared/influxdb.log' + # [meta] + $hostname = '192.168.0.1' + $peers = ['192.168.0.2', '192.168.0.3'] - # [cluster] - $cluster_seed_servers = '[]' + # [retention] + $replication = 3 } diff --git a/manifests/service.pp b/manifests/service.pp index d9789b3..7c989f2 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -5,6 +5,6 @@ ensure => running, enable => true, hasrestart => true, - status => '/usr/bin/pgrep -u influxdb -f "/usr/bin/influxdb "' + status => '/usr/bin/pgrep -u influxdb -f "/opt/influxdb/influxd "' } } diff --git a/metadata.json b/metadata.json index 2e007ab..169db6a 100644 --- a/metadata.json +++ b/metadata.json @@ -1,12 +1,18 @@ { "name": "rplessl-influxdb", - "version": "0.4.0", + "version": "0.9.1", "source": "https://github.com/rplessl/puppet-influxdb", "author": "Justin Downing and Roman Plessl", "license": "MIT License", - "summary": "Setup and manage influxdb", - "description": "Setup and manage influxdb", + "summary": "Setup and manage influxdb 0.9.x", + "description": "Setup and manage influxdb 0.9.x", + "source": "git://github.com/rplessl/puppet-influxdb.git", "project_page": "https://github.com/rplessl/puppet-influxdb", + "issues_url": "https://github.com/rplessl/puppet-influxdb/issues", + "tags": [ + "influxdb", + "monitoring" + ], "dependencies": [ { "name": "puppetlabs/inifile", "version_requirement": ">= 1.0.0" } ], @@ -29,7 +35,7 @@ }, { "operatingsystem": "Debian", - "operatingsystemrelease": [ "6", "7" ] + "operatingsystemrelease": [ "6", "7", "8" ] }, { "operatingsystem": "Ubuntu", diff --git a/tests/vagrant.pp b/tests/vagrant.pp index f9c56ef..b9f3044 100644 --- a/tests/vagrant.pp +++ b/tests/vagrant.pp @@ -1,4 +1,4 @@ class { 'influxdb': - install_from_repository => false; + install_from_repository => false; } From 2aecabccfbf4a3609160fe7da9fadbf26aceb90d Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Wed, 15 Jul 2015 11:20:02 +0200 Subject: [PATCH 47/67] added also CI for 0.9.1 branch --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 40102cb..ae7c81d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,7 @@ branches: only: - master + - 0.9.1 language: ruby rvm: - 1.9.3 From 0607a78fe28a27c0b18f9ff19e82a98d8a4d6cad Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Wed, 15 Jul 2015 11:27:08 +0200 Subject: [PATCH 48/67] fix spec tests --- spec/classes/influxdb_config_spec.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spec/classes/influxdb_config_spec.rb b/spec/classes/influxdb_config_spec.rb index 1717758..b9abf46 100644 --- a/spec/classes/influxdb_config_spec.rb +++ b/spec/classes/influxdb_config_spec.rb @@ -8,8 +8,7 @@ let(:pre_condition) { 'class{"influxdb" : install_from_repository => true, - config_path => "/opt/influxdb/shared/config.toml", - logging_file => "/opt/influxdb/shared/influxdb.log" + config_file => "/etc/opt/influxdb/influxdb.conf" }' } From 5dc1bdc91f233ed6d474a48a0f9fbdc76c74cf51 Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Wed, 15 Jul 2015 11:32:57 +0200 Subject: [PATCH 49/67] fix typo config settings --- manifests/config.pp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/manifests/config.pp b/manifests/config.pp index 5dbe6de..5d68661 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -5,7 +5,8 @@ # https://influxdb.com/docs/v0.9/administration/config.html # # DO NO CALL DIRECTLY -class influxdb::config +class influxdb::config { + # defaults for all settings Ini_setting { ensure => present, From fbc8a641dd8a09fb54652fe66d220d34595826a5 Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Wed, 15 Jul 2015 11:39:27 +0200 Subject: [PATCH 50/67] fix architecture test ... there exist no i386 packages at the moment --- manifests/install.pp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manifests/install.pp b/manifests/install.pp index da7d461..b55f818 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -26,7 +26,7 @@ 'Debian': { $package_source_name = $::architecture ? { default => "influxdb_${influxdb::version}_amd64.deb", - default => "influxdb_${influxdb::version}_i386.deb", + /386/ => "influxdb_${influxdb::version}_i386.deb", } $package_source = "http://influxdb.s3.amazonaws.com/${package_source_name}" exec { @@ -53,8 +53,8 @@ } 'RedHat', 'Amazon': { $package_source_name = $::architecture ? { - /64/ => "influxdb-${influxdb::version}-1.x86_64.rpm", - default => "influxdb-${influxdb::version}-1.i686.rpm", + default => "influxdb-${influxdb::version}-1.x86_64.rpm", + /386/ => "influxdb-${influxdb::version}-1.i686.rpm", } $package_source = "http://influxdb.s3.amazonaws.com/${package_source_name}" exec { From 26e7ce10a9199403994ba4bf6a21ac2a4000e2aa Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Wed, 15 Jul 2015 11:42:47 +0200 Subject: [PATCH 51/67] default as last option in architecture switch --- manifests/install.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/install.pp b/manifests/install.pp index b55f818..4682e42 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -25,8 +25,8 @@ case $::osfamily { 'Debian': { $package_source_name = $::architecture ? { - default => "influxdb_${influxdb::version}_amd64.deb", /386/ => "influxdb_${influxdb::version}_i386.deb", + default => "influxdb_${influxdb::version}_amd64.deb", } $package_source = "http://influxdb.s3.amazonaws.com/${package_source_name}" exec { @@ -53,8 +53,8 @@ } 'RedHat', 'Amazon': { $package_source_name = $::architecture ? { - default => "influxdb-${influxdb::version}-1.x86_64.rpm", /386/ => "influxdb-${influxdb::version}-1.i686.rpm", + default => "influxdb-${influxdb::version}-1.x86_64.rpm", } $package_source = "http://influxdb.s3.amazonaws.com/${package_source_name}" exec { From a928a83b0be14d8ff960ba2f5276f38ec968d413 Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Wed, 15 Jul 2015 11:47:33 +0200 Subject: [PATCH 52/67] use new travis infrastructure --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index ae7c81d..2411a72 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,8 @@ rvm: - 1.9.3 - 2.0.0 - 2.1.0 +cache: bundler +sudo: false bundler_args: --without development script: "bundle exec rake spec SPEC_OPTS='--format documentation'" env: From f242fb72587c5370a2c25069a2660ef534f10834 Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Wed, 15 Jul 2015 12:24:42 +0200 Subject: [PATCH 53/67] removed docker image and preinstall influxdb --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2411a72..ad5f178 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,8 +8,10 @@ rvm: - 2.0.0 - 2.1.0 cache: bundler -sudo: false bundler_args: --without development +before_script: + - wget http://influxdb.s3.amazonaws.com/influxdb_0.9.1_amd64.deb -O /tmp/influxdb_0.9.1_amd64.deb + - dpkg -i /tmp/influxdb_0.9.1_amd64.deb script: "bundle exec rake spec SPEC_OPTS='--format documentation'" env: - PUPPET_VERSION="~> 2.7.0" From 473a27d55d2f952cc4f5905ba2a7023a5026e735 Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Wed, 15 Jul 2015 12:28:20 +0200 Subject: [PATCH 54/67] =?UTF-8?q?added=20sudo=C3=ADng=20of=20influxdb=20pa?= =?UTF-8?q?ckage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ad5f178..490f832 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ cache: bundler bundler_args: --without development before_script: - wget http://influxdb.s3.amazonaws.com/influxdb_0.9.1_amd64.deb -O /tmp/influxdb_0.9.1_amd64.deb - - dpkg -i /tmp/influxdb_0.9.1_amd64.deb + - sudo dpkg -i /tmp/influxdb_0.9.1_amd64.deb script: "bundle exec rake spec SPEC_OPTS='--format documentation'" env: - PUPPET_VERSION="~> 2.7.0" From c78f3288a13e6dd77182292e676ac2653817076c Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Wed, 15 Jul 2015 12:35:32 +0200 Subject: [PATCH 55/67] revert to docker travis-ci testing string matching is different with puppet 4.2.0 --- .travis.yml | 4 +--- manifests/install.pp | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 490f832..2411a72 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,10 +8,8 @@ rvm: - 2.0.0 - 2.1.0 cache: bundler +sudo: false bundler_args: --without development -before_script: - - wget http://influxdb.s3.amazonaws.com/influxdb_0.9.1_amd64.deb -O /tmp/influxdb_0.9.1_amd64.deb - - sudo dpkg -i /tmp/influxdb_0.9.1_amd64.deb script: "bundle exec rake spec SPEC_OPTS='--format documentation'" env: - PUPPET_VERSION="~> 2.7.0" diff --git a/manifests/install.pp b/manifests/install.pp index 4682e42..1162926 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -20,7 +20,7 @@ } } - if ((!$influxdb::install_from_repository) and ($my_package_ensure =~ /present|installed/ )) { + if ((!$influxdb::install_from_repository) and ("$my_package_ensure" =~ /present|installed/ )) { # package source and provider case $::osfamily { 'Debian': { From d58aac6dba74d54e1b94bc28359a83db74ac1094 Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Wed, 15 Jul 2015 12:55:59 +0200 Subject: [PATCH 56/67] added repo handling for travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2411a72..995b3bb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ branches: only: - master - - 0.9.1 + - repo-handling language: ruby rvm: - 1.9.3 From 98006345230fc73e305d2b740ed77f38578e3fff Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Wed, 15 Jul 2015 12:58:18 +0200 Subject: [PATCH 57/67] added note on minimal influxdb version (influx 0.9.1) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 32b7dd7..f0f5436 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ ## Description -puppet module to install and configure [influxdb](https://influxdb.org). +puppet module to install and configure [influxdb](https://influxdb.org) (version 0.9.x and newer). ## Installation From d93fe9bbeb33e7fe1921dc9d7b44cbe3912a1b78 Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Wed, 15 Jul 2015 13:05:03 +0200 Subject: [PATCH 58/67] increase version to 0.9.1 --- manifests/params.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/params.pp b/manifests/params.pp index 4df8669..a1efc2f 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -2,7 +2,7 @@ # DO NOT CALL DIRECTLY class influxdb::params { $ensure = 'installed' - $version = 'latest' + $version = '0.9.1' $install_from_repository = true $config_file = '/etc/opt/influxdb/influxdb.conf' From 2ec9476c048fe481e0b4e8bfc9c731eb852835f7 Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Wed, 15 Jul 2015 14:15:20 +0200 Subject: [PATCH 59/67] added 'none' parameter for non cluster mode, fix installation and testing with vagrant --- README.md | 6 +++--- manifests/config.pp | 24 ++++++++++++++---------- manifests/install.pp | 2 +- manifests/params.pp | 6 +++--- 4 files changed, 21 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index f0f5436..eb12cc8 100644 --- a/README.md +++ b/README.md @@ -25,11 +25,11 @@ These configuration parameter can be set: $reporting_disabled = false # [meta] - $hostname = '192.168.0.1' - $peers = ['192.168.0.2', '192.168.0.3'] + $hostname = 'localhost' or 192.168.0.1' + $peers = 'none' or ['192.168.0.2', '192.168.0.3'] # [retention] - $replication = 3 + $replication = 'none' or 3 ``` ## Testing diff --git a/manifests/config.pp b/manifests/config.pp index 5d68661..3198e97 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -17,7 +17,7 @@ ini_setting { 'reporting-disabled': section => '', setting => 'reporting-disabled', - value => "\"${influxdb::reporting_disabled}\"", + value => $influxdb::reporting_disabled, } # [meta] @@ -27,17 +27,21 @@ value => "\"${influxdb::hostname}\"", } - ini_setting { 'meta_peers': - section => 'meta', - setting => 'peers', - value => "\"${influxdb::peers}\"", + if $influxdb::peers != 'none' { + ini_setting { 'meta_peers': + section => 'meta', + setting => 'peers', + value => '\"${influxdb::peers}\"', + } } - # [retention] - ini_setting { 'retention_replication': - section => 'retention', - setting => 'replication', - value => "\"$influxdb::replication\"", + if $influxdb::replication != 'none' { + # [retention] + ini_setting { 'retention_replication': + section => 'retention', + setting => 'replication', + value => $influxdb::replication, + } } } diff --git a/manifests/install.pp b/manifests/install.pp index 1162926..814163c 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -36,7 +36,7 @@ unless => 'dpkg --list influxdb'; 'influxdb_dpkg': - command => "dpkg -i /tmp/${package_source_name}", + command => "sudo dpkg -i /tmp/${package_source_name}", path => ['/bin', '/sbin', '/usr/bin'], require => [ Exec['influxdb_wget'] ]; diff --git a/manifests/params.pp b/manifests/params.pp index a1efc2f..ac20231 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -10,9 +10,9 @@ $reporting_disabled = false # [meta] - $hostname = '192.168.0.1' - $peers = ['192.168.0.2', '192.168.0.3'] + $hostname = 'localhost' + $peers = 'none' # [retention] - $replication = 3 + $replication = 'none' } From 60e64368cfe80c85474492ea72585ac351abdb7a Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Wed, 15 Jul 2015 23:09:15 +0200 Subject: [PATCH 60/67] fix version tag --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 169db6a..aa47e0c 100644 --- a/metadata.json +++ b/metadata.json @@ -1,5 +1,5 @@ { - "name": "rplessl-influxdb", + "name": "puppet-influxdb", "version": "0.9.1", "source": "https://github.com/rplessl/puppet-influxdb", "author": "Justin Downing and Roman Plessl", From 67d865d8854c877c081c99f449a12d4cfc9dc44d Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Wed, 15 Jul 2015 23:15:58 +0200 Subject: [PATCH 61/67] increase version --- metadata.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/metadata.json b/metadata.json index aa47e0c..c46f707 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { - "name": "puppet-influxdb", - "version": "0.9.1", + "name": "rplessl-influxdb", + "version": "0.9.2", "source": "https://github.com/rplessl/puppet-influxdb", "author": "Justin Downing and Roman Plessl", "license": "MIT License", From dcf0b9ee39448ed8cf1defaf027fe76e548eb6fd Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Mon, 20 Jul 2015 13:40:09 +0200 Subject: [PATCH 62/67] changed a bit API of puppet class after rolling out the setup to production --- README.md | 6 +++--- manifests/config.pp | 10 +++++----- manifests/init.pp | 6 +++--- manifests/params.pp | 18 +++++++++--------- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index eb12cc8..801254c 100644 --- a/README.md +++ b/README.md @@ -25,11 +25,11 @@ These configuration parameter can be set: $reporting_disabled = false # [meta] - $hostname = 'localhost' or 192.168.0.1' - $peers = 'none' or ['192.168.0.2', '192.168.0.3'] + $meta_hostname = "localhost" or "192.168.0.1" + $meta_peers = undef or ["192.168.0.1:8088", "192.168.0.2:8088", "192.168.0.3:8088"] # [retention] - $replication = 'none' or 3 + $retention_replication = undef or 3 ``` ## Testing diff --git a/manifests/config.pp b/manifests/config.pp index 3198e97..993fc16 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -24,23 +24,23 @@ ini_setting { 'meta_hostname': section => 'meta', setting => 'hostname', - value => "\"${influxdb::hostname}\"", + value => "\"${influxdb::meta_hostname}\"", } - if $influxdb::peers != 'none' { + if $influxdb::meta_peers != undef { ini_setting { 'meta_peers': section => 'meta', setting => 'peers', - value => '\"${influxdb::peers}\"', + value => $influxdb::meta_peers, } } - if $influxdb::replication != 'none' { + if $influxdb::retention_replication != undef { # [retention] ini_setting { 'retention_replication': section => 'retention', setting => 'replication', - value => $influxdb::replication, + value => $influxdb::retention_replication, } } diff --git a/manifests/init.pp b/manifests/init.pp index ea1ae3e..5258703 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -5,9 +5,9 @@ $install_from_repository = $influxdb::params::install_from_repository, $config_file = $influxdb::params::config_file, $reporting_disabled = $influxdb::params::reporting_disabled, - $hostname = $influxdb::params::hostname, - $peers = $influxdb::params::peers, - $replication = $influxdb::params::replication, + $meta_hostname = $influxdb::params::meta_hostname, + $meta_peers = $influxdb::params::meta_peers, + $retention_replication = $influxdb::params::retention_replication, ) inherits influxdb::params { class { 'influxdb::install': } -> diff --git a/manifests/params.pp b/manifests/params.pp index ac20231..75c391f 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -1,18 +1,18 @@ # == Class: influxdb::params # DO NOT CALL DIRECTLY class influxdb::params { - $ensure = 'installed' - $version = '0.9.1' - $install_from_repository = true - $config_file = '/etc/opt/influxdb/influxdb.conf' + $ensure = 'installed' + $version = '0.9.1' + $install_from_repository = true + $config_file = '/etc/opt/influxdb/influxdb.conf' - # general section of config.toml - $reporting_disabled = false + # general section of influxdb.conf + $reporting_disabled = false # [meta] - $hostname = 'localhost' - $peers = 'none' + $meta_hostname = 'localhost' + $meta_peers = undef # [retention] - $replication = 'none' + $retention_replication = undef } From b22980f2a5adeb0fe9e7b0bcc1bd733c49a135ad Mon Sep 17 00:00:00 2001 From: "Joyner, Jason" Date: Tue, 21 Jul 2015 09:20:28 -0400 Subject: [PATCH 63/67] added influxdb::download_url so you can pass this in instead of use amazon s3 --- README.md | 18 +++++++ manifests/init.pp | 1 + manifests/install.pp | 14 +++++- manifests/params.pp | 2 + spec/classes/influxdb_install_spec.rb | 71 ++++++++++++++++++++++++++- 5 files changed, 103 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 801254c..96cd22d 100644 --- a/README.md +++ b/README.md @@ -12,8 +12,26 @@ puppet module to install and configure [influxdb](https://influxdb.org) (version ## Usage + +Basic default uses local package + `class { 'influxdb': }` +Install from amazon.s3 is default when not using repository +``` + class { 'influxdb': + install_from_repository => false, + } +``` +Install using your own url/proxy +``` + class { 'influxdb': + install_from_repository => false, + source_url => 'https://download.test.com/proxy/influxdb/influxdb-1.0.0.rpm' + } +``` + + These configuration parameter can be set: ``` $ensure = 'installed' diff --git a/manifests/init.pp b/manifests/init.pp index 5258703..7ad05d1 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -8,6 +8,7 @@ $meta_hostname = $influxdb::params::meta_hostname, $meta_peers = $influxdb::params::meta_peers, $retention_replication = $influxdb::params::retention_replication, + $download_url = $influxdb::params::download_url, ) inherits influxdb::params { class { 'influxdb::install': } -> diff --git a/manifests/install.pp b/manifests/install.pp index 814163c..34c5a66 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -28,7 +28,12 @@ /386/ => "influxdb_${influxdb::version}_i386.deb", default => "influxdb_${influxdb::version}_amd64.deb", } - $package_source = "http://influxdb.s3.amazonaws.com/${package_source_name}" + if $influxdb::download_url != undef { + $package_source = $influxdb::download_url + } + else { + $package_source = "http://influxdb.s3.amazonaws.com/${package_source_name}" + } exec { 'influxdb_wget': command => "wget ${package_source} -O /tmp/${package_source_name}", @@ -56,7 +61,12 @@ /386/ => "influxdb-${influxdb::version}-1.i686.rpm", default => "influxdb-${influxdb::version}-1.x86_64.rpm", } - $package_source = "http://influxdb.s3.amazonaws.com/${package_source_name}" + if $influxdb::download_url != undef { + $package_source = $influxdb::download_url + } + else { + $package_source = "http://influxdb.s3.amazonaws.com/${package_source_name}" + } exec { 'influxdb_rpm': command => "rpm -ivh ${package_source}", diff --git a/manifests/params.pp b/manifests/params.pp index 75c391f..3005867 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -6,6 +6,7 @@ $install_from_repository = true $config_file = '/etc/opt/influxdb/influxdb.conf' + $download_url = undef # general section of influxdb.conf $reporting_disabled = false @@ -15,4 +16,5 @@ # [retention] $retention_replication = undef + } diff --git a/spec/classes/influxdb_install_spec.rb b/spec/classes/influxdb_install_spec.rb index 6c4479c..f489560 100644 --- a/spec/classes/influxdb_install_spec.rb +++ b/spec/classes/influxdb_install_spec.rb @@ -3,7 +3,7 @@ describe 'influxdb::install', :type => :class do it { should create_class('influxdb::install') } - it { should contain_package('influxdb') } + # it { should contain_package('influxdb') } context 'installing from a repository' do let(:pre_condition) { @@ -35,4 +35,73 @@ )} end end + + context 'installing from web' do + context 'with default preset url' do + let(:pre_condition) { + 'class{"influxdb": + ensure => "installed", + install_from_repository => false, + }' + } + context 'on Debian' do + let(:facts) { + { + :osfamily => 'Debian', + :architecture => 'x86_64', + } + } + it { should contain_exec('influxdb_wget') + .with_command(/influxdb.s3.amazonaws/) + } + end + context 'on redhat' do + let(:facts) { + { + :osfamily => 'RedHat', + :architecture => 'x86_64', + } + } + context 'with default preset url' do + it { should contain_exec('influxdb_rpm') + .with_command(/influxdb.s3.amazonaws/) + } + end + end + end + + context 'with download_url set' do + let(:pre_condition) { + 'class{"influxdb": + ensure => "installed", + install_from_repository => false, + download_url => "https://download.test.com/proxy/influxdb/influxdb-1.0.0.rpm" + }' + } + context 'on Debian' do + let(:facts) { + { + :osfamily => 'Debian', + :architecture => 'x86_64', + } + } + it { should contain_exec('influxdb_wget') + .with_command(/download.test.com/) + } + end + context 'on redhat' do + let(:facts) { + { + :osfamily => 'RedHat', + :architecture => 'x86_64', + } + } + context 'with default preset url' do + it { should contain_exec('influxdb_rpm') + .with_command(/download.test.com/) + } + end + end + end + end end From 6ee498ca7d7c7f99709ef800510f0986fa6a2a35 Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Wed, 29 Jul 2015 21:50:03 +0200 Subject: [PATCH 64/67] enhance documentation for download_url (pull request #1) --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 96cd22d..d881d0a 100644 --- a/README.md +++ b/README.md @@ -4,30 +4,29 @@ ## Description -puppet module to install and configure [influxdb](https://influxdb.org) (version 0.9.x and newer). +puppet module to install and configure [influxdb](https://influxdb.org) (version 0.9.x and newer). Tested with InfluxDB 0.9.1 and 0.9.2. ## Installation -`puppet module install --modulepath /path/to/puppet/modules rplessl-influxdb` +`puppet module install --modulepath /path/to/puppet/modules puppet-influxdb` ## Usage - Basic default uses local package `class { 'influxdb': }` -Install from amazon.s3 is default when not using repository +Install the influx packages from InfluxDB upstream Amazon s3 packages. This is the default when not using a self managed repository ``` class { 'influxdb': install_from_repository => false, } ``` -Install using your own url/proxy +Alternativly you can install packages using your own url/proxy ``` class { 'influxdb': install_from_repository => false, - source_url => 'https://download.test.com/proxy/influxdb/influxdb-1.0.0.rpm' + download_url => 'https://download.test.com/proxy/influxdb/influxdb-1.0.0.rpm' } ``` @@ -37,6 +36,7 @@ These configuration parameter can be set: $ensure = 'installed' $version = 'latest' $install_from_repository = true + $download_url = undef or https://download.test.com/influxdb.deb $config_file = '/etc/opt/influxdb/influxdb.conf' # general section of influxb.conf From 8c2bea8d5bd289b13b49b77a17246e4e9cb95467 Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Wed, 29 Jul 2015 21:51:51 +0200 Subject: [PATCH 65/67] move test line for testing installed package --- spec/classes/influxdb_install_spec.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spec/classes/influxdb_install_spec.rb b/spec/classes/influxdb_install_spec.rb index f489560..bc28478 100644 --- a/spec/classes/influxdb_install_spec.rb +++ b/spec/classes/influxdb_install_spec.rb @@ -3,7 +3,6 @@ describe 'influxdb::install', :type => :class do it { should create_class('influxdb::install') } - # it { should contain_package('influxdb') } context 'installing from a repository' do let(:pre_condition) { @@ -68,6 +67,9 @@ } end end + + it { should contain_package('influxdb') } + end context 'with download_url set' do From 83947f952e08c3a2b21976dc18f267af3ee1484d Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Wed, 29 Jul 2015 21:55:40 +0200 Subject: [PATCH 66/67] fix wrong place in test file --- spec/classes/influxdb_install_spec.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/spec/classes/influxdb_install_spec.rb b/spec/classes/influxdb_install_spec.rb index bc28478..016e379 100644 --- a/spec/classes/influxdb_install_spec.rb +++ b/spec/classes/influxdb_install_spec.rb @@ -67,9 +67,6 @@ } end end - - it { should contain_package('influxdb') } - end context 'with download_url set' do @@ -106,4 +103,8 @@ end end end + + + it { should contain_package('influxdb') } + end From 4569c8510b2515ba5366177bf6b93f9e7e37797e Mon Sep 17 00:00:00 2001 From: Roman Plessl Date: Tue, 11 Aug 2015 10:27:58 +0200 Subject: [PATCH 67/67] small identation fixes --- manifests/init.pp | 2 +- manifests/params.pp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 7ad05d1..0ccc67b 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -8,7 +8,7 @@ $meta_hostname = $influxdb::params::meta_hostname, $meta_peers = $influxdb::params::meta_peers, $retention_replication = $influxdb::params::retention_replication, - $download_url = $influxdb::params::download_url, + $download_url = $influxdb::params::download_url, ) inherits influxdb::params { class { 'influxdb::install': } -> diff --git a/manifests/params.pp b/manifests/params.pp index 3005867..8fd8cd0 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -2,11 +2,11 @@ # DO NOT CALL DIRECTLY class influxdb::params { $ensure = 'installed' - $version = '0.9.1' + $version = '0.9.2' $install_from_repository = true $config_file = '/etc/opt/influxdb/influxdb.conf' - $download_url = undef + $download_url = undef # general section of influxdb.conf $reporting_disabled = false