Bitcoin (Core) cookbook #121

Merged
greg merged 20 commits from feature/bitcoin_cookbook into master 2020-08-20 17:17:31 +00:00
5 changed files with 151 additions and 7 deletions
Showing only changes of commit 09527e693b - Show all commits

3
Vagrantfile vendored
View File

@ -95,7 +95,8 @@ Vagrant.configure(2) do |config|
chef.environment = 'development'
chef.add_recipe 'kosmos-base'
chef.add_recipe 'kosmos_encfs'
# chef.add_recipe 'kosmos-postgresql::default'
# chef.add_recipe 'kosmos-bitcoin::snapd'
Outdated
Review

I don't think that should have been checked in

I don't think that should have been checked in

Why not? It's commented, so you can uncomment it to easily run the recipe locally. Same as all the other commented recipes.

Why not? It's commented, so you can uncomment it to easily run the recipe locally. Same as all the other commented recipes.
# chef.add_recipe 'kosmos-mediawiki'
# chef.add_recipe 'kosmos-wordpress'
# chef.add_recipe 'kosmos-ejabberd'
# chef.add_recipe 'kosmos-hubot::botka_freenode'

View File

@ -1,2 +1,24 @@
node.default['bitcoin']['username'] = 'satoshi'
node.default['bitcoin']['datadir'] = '/mnt/data/bitcoin'
node.default['bitcoin']['username'] = 'bitcoind'
node.default['bitcoin']['usergroup'] = 'bitcoind'
node.default['bitcoin']['datadir'] = '/mnt/data/bitcoin'
node.default['bitcoin']['conf'] = {
testnet: 0,
irc: 1,
dnsseed: 1,
upnp: 1,
checkblocks: 10,
checklevel: 1,
txindex: 1,
whitelist: "127.0.0.1",
listen: 1,
server: 1,
rpcport: 8332,
rpcssl: 0,
rpcuser: 'bitcoind',
rpcbind: "127.0.0.1:8336",
port: 8335,
gen: 0,
zmqpubrawblock: "tcp://127.0.0.1:8337",
zmqpubrawtx: "tcp://127.0.0.1:8338"
}

View File

@ -1,6 +1,6 @@
#
# Cookbook:: kosmos-bitcoin
# Recipe:: default
# Recipe:: snapd
#
# The MIT License (MIT)
#
@ -29,10 +29,28 @@ package 'snapd'
snap_package 'bitcoin-core'
bitcoin_user = node['bitcoin']['username']
bitcoin_user = node['bitcoin']['username']
bitcoin_group = node['bitcoin']['usergroup']
bitcoin_datadir = node['bitcoin']['datadir']
# TODO create bitcoin datadir
# TODO create bitcoin.conf in datadir
directory bitcoin_datadir do
owner bitcoin_user
group bitcoin_group
mode '0755'
recursive true
action :create
end
template "#{bitcoin_datadir}/bitcoin.conf" do
owner bitcoin_user
group bitcoin_group
variables conf: node['bitcoin']['conf'],
mainnet_conf: node['bitcoin']['mainnet_conf'],
testnet_conf: node['bitcoin']['testnet_conf'],
regtest_conf: node['bitcoin']['regtest_conf']
action :create
# notifies :reload, "service[bitcoin]", :delayed
end
mount "/home/#{bitcoin_user}/snap/bitcoin-core/common/.bitcoin" do
device node['bitcoin']['data_dir']

View File

@ -0,0 +1,69 @@
# Network-related settings:
testnet=0
irc=1
dnsseed=1
upnp=1
checkblocks=10
checklevel=1
txindex=1
whitelist=127.0.0.1
# Maximum number of inbound+outbound connections.
#maxconnections=
listen=1
# JSON-RPC options (for controlling a running Bitcoin/bitcoind process)
# server=1 tells Bitcoin to accept JSON-RPC commands.
server=1
# You must set rpcuser and rpcpassword to secure the JSON-RPC api
rpcuser=kosmos
rpcpassword=yunobuttcoin
# By default, only RPC connections from localhost are allowed. Specify
# as many rpcallowip= settings as you like to allow connections from
# other hosts (and you may use * as a wildcard character):
#rpcallowip=192.168.1.*
rpcallowip=127.0.0.1
# Listen for RPC connections on this TCP port:
rpcbind=127.0.0.1:8336
# Listen for P2P connections on this TCP port:
port=8335
# Use Secure Sockets Layer (also known as TLS or HTTPS) to communicate
# with Bitcoin -server or bitcoind
rpcssl=0
# OpenSSL settings used when rpcssl=1
#rpcsslciphers=TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH
# Miscellaneous options
# Set gen=1 to attempt to generate bitcoins
gen=0
# Use SSE instructions to try to generate bitcoins faster.
#4way=1
# Pre-generate this many public/private key pairs, so wallet backups will be valid for
# both prior transactions and several dozen future transactions.
#keypool=100
# Pay an optional transaction fee every time you send bitcoins. Transactions with fees
# are more likely than free transactions to be included in generated blocks, so may
# be validated sooner.
#paytxfee=0.00
# Allow direct connections for the 'pay via IP address' feature.
#allowreceivebyip=1
zmqpubrawblock=tcp://127.0.0.1:8337
zmqpubrawtx=tcp://127.0.0.1:8338

View File

@ -0,0 +1,34 @@
##
## bitcoin.conf configuration file. Lines beginning with # are comments.
##
## Generated by Chef. Do not edit directly, or your changes will be overwritten
## during the next Chef run!
##
<% @conf.each do |key, value| %>
<%= "#{key}=#{value}" %>
<% end %>
<% if @mainnet_conf %>
# Options only for mainnet
[main]
<% @mainnet_conf.each do |key, value| %>
<%= "#{key}=#{value}" %>
<% end %>
<% end %>
<% if @testnet_conf %>
# Options only for testnet
[test]
<% @testnet_conf.each do |key, value| %>
<%= "#{key}=#{value}" %>
<% end %>
<% end %>
<% if @regtest_conf %>
# Options only for regtest
[regtest]
<% @regtest_conf.each do |key, value| %>
<%= "#{key}=#{value}" %>
<% end %>
<% end %>