/chef-bitcoind

Chef cookbook for setting up bitcoind

Primary LanguageRuby

chef-bitcoind

This cookbook installs and configures bitcoind and all dependencies.

Platform:

  • Ubuntu (Currently this is only tested on Ubuntu 14.04 but has been written such that it should support others)

Cookbooks:

None! :)

Attributes

Attribute Description Default
node['bitcoind']['install_method'] Installation method. Can be source or package. source
node['bitcoind']['user'] The user that bitcoind will be run as bitcoind
node['bitcoind']['group'] The group that the bitcoind user will belong to bitcoind
node['bitcoind']['home'] Home directory for bitcoind user /opt/bitcoin
node['bitcoind']['checkblocks'] How many blocks to check at startup 288
node['bitcoind']['source']['source_dir'] Directory that the source code is intalled and compiled /opt/bitcoind/bitcoind
node['bitcoind']['source']['git_repo'] The repository to retrieve the bitcoind source code from https://github.com/bitcoin/bitcoin.git
node['bitcoind']['source']['git_revision'] The version tag or revision to pull from the git repo v0.9.3
node['bitcoind']['source']['bin_location'] Where to install the bitcoind binary /usr/local/bin
node['bitcoind']['source']['bin_name'] Name of the bitcoind binary bitcoind
node['bitcoind']['db']['source_url'] Source URL for berkeley-db http://download.oracle.com/berkeley-db/
node['bitcoind']['db']['filename'] File name of berkeley-db package without extension db-4.8.30.NC
node['bitcoind']['db']['extension'] Extension of berkeley-db filename .tar.gz
node['bitcoind']['db']['bdb_prefix'] Directory to compile bdb /opt/bitcoind/db4
node['bitcoind']['config']['data_dir'] Directory where we create bitcoind folder which contains config and data /opt/bitcoind
node['bitcoind']['config']['testnet'] Use testnet instead of production bitcoin network 0
node['bitcoind']['config']['irc'] Source peers from IRC 1
node['bitcoind']['config']['dnsseed'] Source peers from DNS 1
node['bitcoind']['config']['upnp'] Enable UPNP 1
node['bitcoind']['config']['proxy'] Use a proxy nil
node['bitcoind']['config']['server'] Enable server flag 1
node['bitcoind']['config']['rpcssl'] Enable SSL over RPC 0
node['bitcoind']['config']['rpcuser'] Username for RPC auth Random
node['bitcoind']['config']['rpcpassword'] Password for RPC auth Random
node['bitcoind']['config']['port'] Bitcoind port (nil leaves port set as the default) nil
node['bitcoind']['config']['rpcport'] RPC port (nil leaves rpcport set as the default) nil
node['bitcoind']['config']['rpcallowip'] IP's to allow connections from over RPC ['127.0.0.1']
node['bitcoind']['config']['rpcconnect'] Hosts to connect to over RPC []
node['bitcoind']['config']['gen'] Enable mining 0
node['bitcoind']['config']['alertnotify'] Execute command when a relevant alert is received nil
node['bitcoind']['config']['checkblocks'] Blocks to check on startup nil
node['bitcoind']['config']['rpcsslcertificatechainfile'] Your RPC SSL certificate chain file nil
node['bitcoind']['config']['rpcsslprivatekeyfile'] Your RPC SSL private key file nil
node['bitcoind']['config']['txindex'] Enable reindex on startup 0
node['bitcoind']['config']['listen'] Listen for connections over RPC 0
node['bitcoind']['config']['options'] Extra options for daemon configuration ""

Recipes

bitcoind::default

Installs and configures bitcoind from source or package depending on value set in node['bitcoind']['install_method']

Usage

Add recipe[chef-bitcoind] to your node's runlist or role, or include it in another cookbook.

To configure install method, simply set node['bitcoind']['install_method'] in your role or wrapper cookbook.

Multiple Instances Per Host

This cookbook can install configure and maintain multiple instances of bitcoind running on the same host. Using node attributes define one instance per namespace as in the following example.

Example

This example sets up two bitcoind instances.

One is under the namespace bitcoind and the other is testnet. Make sure to choose different ports for each instance to avoid colision. They will be installed into /opt.

node.set['bitcoind']['instances']['bitcoind']['name'] = 'bitcoind'
node.set['bitcoind']['instances']['bitcoind']['data_dir'] = '/opt/bitcoind'
node.set['bitcoind']['instances']['bitcoind']['port'] = '21000'
node.set['bitcoind']['instances']['bitcoind']['rpcport'] = '21001'
node.set['bitcoind']['instances']['bitcoind']['version'] = '90300'

node.set['bitcoind']['instances']['testnet']['name'] = 'testnet'
node.set['bitcoind']['instances']['testnet']['data_dir'] = '/opt/testnet'
node.set['bitcoind']['instances']['testnet']['port'] = '22000'
node.set['bitcoind']['instances']['testnet']['rpcport'] = '22001'
node.set['bitcoind']['instances']['testnet']['version'] = '90300'

Testing

Requirements

You must have VirtualBox(https://www.virtualbox.org/) and Vagrant(http://www.vagrantup.com/) installed.

Install gem dependencies with bundler:

$ gem install bundler
$ bundle install

Running the tests

$ bundle exec kitchen test

Contributing

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

License and Author

Author: Philip Hutchins (flipture@gmail.com)
License: Apache License, Version 2.0

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.