Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

Select Status


squaresurf_influxdb (7) Versions 0.1.4

Installs/Configures squaresurf_influxdb

cookbook 'squaresurf_influxdb', '= 0.1.4', :supermarket
cookbook 'squaresurf_influxdb', '= 0.1.4'
knife supermarket install squaresurf_influxdb
knife supermarket download squaresurf_influxdb
Quality 100%

SquareSurf InfluxDB Cookbook

Chef cookbook for installing and configuring
InfluxDB. This cookbook took inspiration from the
influxdb cookbook. The
main difference is that this cookbook tries to take the approach that
InfluxDB should be always running once it is installed.
Whereas my understanding of the influxdb
is that it tries
to seperate configuration from starting the service into two processes.


  • Chef version 0.11 or higher
  • Ruby 1.9 (preferably from the Chef full-stack installer)

Tested Platforms

  • Ubuntu 14.04

Note: I'm open to more platforms, this is just what I started with in order to
fill my current need.



Use the squaresurf_influxdb_user resource to create/update/delete an
InfluxDB database user.


  • :create (Default)
  • :delete


  • username - Name for the user. (Defaults to the name of the block)
  • password - Password for the user.
  • database - The database the user will have access to.
  • admin - A bool whether or not the user is a database admin. (default: false)
  • read_from - A regex to match the series the user can read from. (default: '.*')
  • write_to - A regex to match the series the user can write to. (default: '.*')


Create a user
squaresurf_influxdb_user 'john' do
  action :create
  password 'super secret'
  database 'metrics'
  admin true
  read_from '/^public$/'
  write_to '/^john_workspace$/'
Delete a user
squaresurf_infludb_user 'old_user' do
  action :delete
  database 'sensitive data'


Use the squaresurf_influxdb_cluster_admin resource to create/update/delete
an InfluxDB cluster admin.


  • :create (Default)
  • :delete


  • username - Name for the cluster admin. (Defaults to the name of the block)
  • password - Password for the cluster admin.


Create a cluster admin
squaresurf_influxdb_cluster_admin 'jane' do
  action :create
  password 'super secret again'
Delete a cluster admin
squaresurf_infludb_cluster_admin 'old_cluster_admin' do
  action :delete


Use the squaresurf_influxdb_database resource to create/update/delete an
InfluxDB database.


  • :create (Default)
  • :delete


  • database - Database name. (Defaults to the name of the block)


Create a database
squaresurf_influxdb_database 'metrics'
Delete a database
squaresurf_infludb_database 'old_project_name' do
  action :delete



This recipe includes the squaresurf_influxdb::install recipe then the
squaresurf_influxdb::configure recipe.


This recipe will download the appropriate package according to the version
attribute and install it.


This recipe will:
* Setup the influxdb service to be enabled and start.
* Write out to toml the config and benchmark_config from the node attributes.
* Update the main cluster admin password if it has changed.
* Create an alternate cluster admin user if the main admin username is
different than root
* Delete the root user if the main cluster admin username is different than root


This is used by our chef spec and kitchen test suites.


This is used by our chef spec test suite.


General Attributes

Attributes that will affect general cookbook usage.

default.squaresurf_influxdb.fail_on_error = true

If set to false then failures will not fail the chef run and will log errors

Install attributes

Attributes that affect the installation of InfluxDB.

default.squaresurf_influxdb.version = :latest

This will decide which version of InfluxDB to download and install. It can
either be the version string or the ruby symbol :latest in order to install
the latest available.

default.squaresurf_influxdb.update_version = false

This will decide whether or not to install a new version of influxdb if it is
already installed and the version attribute above differs from that of the
installed version.

InfluxDB Client Attributes

Attributes that affect the ability for this cookbook to connect to InfluxDB in
order to configure users, cluster admins, and databases.

default.squaresurf_influxdb.client_retries = 10

This is how many times we should try to connect to InfluxDB before giving up.
Set this to nil or '-1' to retry indefinitely.

default.squaresurf_influxdb.client_hosts = ['localhost']

This is the host we should connect to InfluxDB with.

default.squaresurf_influxdb.client_use_ssl = false

Whether or not we should connect via ssl with our client when configuring
users, cluster admins, and databases.

default.squaresurf_influxdb.admin_username = 'root'

The cluster admin username to use when connecting to InfluxDB.

default.squaresurf_influxdb.admin_password = 'root'

The cluster admin password to use when connecting to InfluxDB.

default.squaresurf_influxdb.admin_old_username = 'root'

The previous cluster admin username for use if you ever change the username to
another value. This is so that we can create a new cluster admin and delete
this old cluster admin.

default.squaresurf_influxdb.admin_old_password = 'root'

The previous cluster admin password for use if you ever change the password to
another value. This is so that we can set the new password.

InfluxDB TOML Config Attributes


This should be a ruby hash that will be converted to toml for the InfluxDB
config.toml. The default was generated from the default config.toml that comes
with InfluxDB.


This should be a ruby hash that will be converted to toml for the InfluxDB
benchmark_config.toml. The default was generated from the default
benchmark_config.toml that comes with InfluxDB.


The one main attribute that you should always change is the
node.squaresurf_influxdb.admin_password. That way you won't have a default
cluster admin password that anyone can connect to your server with.


Either include the recipe in your run_list or include_recipe from within
one of your recipes. For example you could do the following to setup influxdb
and create a database named metrics and a user named sensu.

# Make sure to set the admin password to some secret value. It would probably
# be even better to use an encrypted data bag here as shown in the next example.
node.set.squaresurf_influxdb.admin_password = 'super secret'

include_recipe 'squaresurf_influxdb::default'

squaresurf_influxdb_database 'metrics'

squaresurf_influxdb_user 'sensu' do
    password 'some secret value'
    database 'metrics'

squaresurf_influxdb::install and squaresurf_influxdb::configure

Instead of using the default recipe you can seperate your logic into an install
then a configure in case you need to setup some items vefore the service is
started. For example you could set up ssl configuration for the http api like so:

cert_file = '/opt/influxdb/ssl_cert.pem'
node.set.squaresurf_influxdb.config.api['ssl-cert'] = cert_file
node.set.squaresurf_influxdb.config.api['ssl-port'] = 8084

cert = Chef::EncryptedDataBagItem.load('ssl', 'influxdb')

admin = Chef::EncryptedDataBagItem.load('influxdb', 'admin')
node.default.squaresurf_influxdb.admin_password = admin['password']
node.default.squaresurf_influxdb.admin_old_password = admin['old_password']

# install first so that the /opt/influxdb dir and influxdb user will be created
include_recipe 'squaresurf_influxdb::install'

file cert_file do
  content cert['cert'] + "\n" + cert['key']
  user 'influxdb'
  group 'influxdb'
  mode '0700'

include_recipe 'squaresurf_influxdb::configure'


  1. Fork the repository on Github
  2. Create a named feature branch (like add_component_x)
  3. Write your change
  4. Write tests for your change
  5. Run the tests, ensuring they all pass
  6. Submit a Pull Request using Github


There is a Rakefile with tasks to make testing easy. You will probably need to
bundle install before running any of them.

  • rake test:all # Run all tests
  • rake test:chefspec # Run chefspec
  • rake test:foodcritic # Run foodcritic linter against cookbook
  • rake test:kitchen_test # This is here as a convenience so that the test suite will check kitchen as well as the other tests
  • rake test:rubocop # Run rubocop against cookbook ruby files

config and benchmark_config attribute generation

There is a convenience script toml_to_attr.rb to help generate the config and
benchmark_config ruby hashes from a default toml file included with influxdb.

If you haven't run bundle install for the test suite above you'll probably
need to do so in order to run toml_to_attr.rb.

License and Authors


The License is the MIT License and can be found in the LICENSE file.


Dependent cookbooks

This cookbook has no specified dependencies.

Contingent cookbooks

There are no cookbooks that are contingent upon this one.

squaresurf_influxdb CHANGELOG

This file is used to list changes made in each version of the squaresurf_influxdb cookbook.


  • [squaresurf] Updates the configure recipe to be more efficient and ensures that the config files have the correct user and group.
  • [squaresurf] Simplifies the SquaresurfInfluxDB::ClusterAdmin.client.


  • [squaresurf] Removes unnecessary files.
  • [squaresurf] Adds documentation about the client_retries attribute.
  • [squaresurf] Fixes issue where we incorrectly get a cluster admin client.
  • [squaresurf] Ensure that we don't incorrectly delete the root cluster admin.
  • [squaresurf] Up the number of default client retries to 20.


  • [squaresurf] Adds supported platform to the metadata.


  • [squaresurf] Fix typos in


  • [squaresurf] Initial version for the squaresurf_influxdb cookbook.

Foodcritic Metric

0.1.4 passed this metric