Merge branch 'master' into bugfix/ipfs_connectivity
This commit is contained in:
@@ -5,7 +5,9 @@ node.default['bitcoin']['usergroup'] = 'bitcoin'
|
||||
node.default['bitcoin']['network'] = 'mainnet'
|
||||
node.default['bitcoin']['conf_path'] = '/home/satoshi/.bitcoin/bitcoin.conf'
|
||||
node.default['bitcoin']['walletdir'] = '/home/satoshi/.bitcoin'
|
||||
node.default['bitcoin']['datadir'] = '/mnt/data/bitcoin'
|
||||
node.default['bitcoin']['datadir'] = '/home/satoshi/.bitcoin'
|
||||
node.default['bitcoin']['blocksdir'] = '/mnt/data/blocks'
|
||||
node.default['bitcoin']['blocksdir_mount_type'] = 'cifs'
|
||||
|
||||
node.default['bitcoin']['conf'] = {
|
||||
irc: 1,
|
||||
|
||||
46
site-cookbooks/kosmos-bitcoin/recipes/blocksdir-mount.rb
Normal file
46
site-cookbooks/kosmos-bitcoin/recipes/blocksdir-mount.rb
Normal file
@@ -0,0 +1,46 @@
|
||||
#
|
||||
# Cookbook:: kosmos-bitcoin
|
||||
# Recipe:: blocksdir-mount
|
||||
#
|
||||
|
||||
include_recipe 'kosmos-bitcoin::user'
|
||||
|
||||
bitcoin_user = node['bitcoin']['username']
|
||||
bitcoin_group = node['bitcoin']['usergroup']
|
||||
bitcoin_blocksdir = node['bitcoin']['blocksdir']
|
||||
credentials = Chef::EncryptedDataBagItem.load('credentials', 'bitcoin')
|
||||
|
||||
directory bitcoin_blocksdir do
|
||||
owner bitcoin_user
|
||||
group bitcoin_group
|
||||
mode '0750'
|
||||
recursive true
|
||||
action :create
|
||||
end
|
||||
|
||||
case node["bitcoin"]["blocksdir_mount_type"]
|
||||
when "cifs"
|
||||
apt_package "cifs-utils"
|
||||
|
||||
systemd_unit "mnt-data-blocks.mount" do
|
||||
content({
|
||||
Unit: {
|
||||
Description: 'Bitcoin Core blocks directory',
|
||||
Requires: 'network-online.target',
|
||||
After: 'network-online.service'
|
||||
},
|
||||
Mount: {
|
||||
What: credentials["blocksdir_cifs_share"],
|
||||
Where: bitcoin_blocksdir,
|
||||
Type: 'cifs',
|
||||
Options: "user=#{credentials["blocksdir_cifs_user"]},password=#{credentials["blocksdir_cifs_password"]},uid=#{bitcoin_user},gid=#{bitcoin_group},rw,vers=1.0"
|
||||
},
|
||||
Install: {
|
||||
WantedBy: 'multi-user.target'
|
||||
}
|
||||
})
|
||||
verify false
|
||||
triggers_reload true
|
||||
action [:create, :enable, :start]
|
||||
end
|
||||
end
|
||||
@@ -3,30 +3,15 @@
|
||||
# Recipe:: source
|
||||
#
|
||||
|
||||
# TODO move to custom kosmos cookbook before publshing bitcoin cookbook
|
||||
systemd_unit "mnt-data-bitcoin.mount" do
|
||||
content({
|
||||
Unit: {
|
||||
Description: 'Bitcoin Core data directory',
|
||||
},
|
||||
Mount: {
|
||||
What: '/var/lib/vmshare-bitcoin',
|
||||
Where: '/mnt/data/bitcoin',
|
||||
Type: '9p',
|
||||
Options: 'trans=virtio,version=9p2000.L'
|
||||
},
|
||||
Install: {
|
||||
WantedBy: 'multi-user.target'
|
||||
}
|
||||
})
|
||||
verify false
|
||||
triggers_reload true
|
||||
action [:create, :enable, :start]
|
||||
end
|
||||
|
||||
build_essential
|
||||
include_recipe 'ark'
|
||||
|
||||
include_recipe 'kosmos-bitcoin::user'
|
||||
|
||||
if node["bitcoin"]["blocksdir_mount_type"]
|
||||
include_recipe "kosmos-bitcoin::blocksdir-mount"
|
||||
end
|
||||
|
||||
%w{ libtool autotools-dev make automake cmake curl g++-multilib libtool
|
||||
binutils-gold bsdmainutils pkg-config python3 patch }.each do |pkg|
|
||||
apt_package pkg
|
||||
@@ -72,15 +57,6 @@ bitcoin_walletdir = node['bitcoin']['walletdir']
|
||||
bitcoin_conf_path = node['bitcoin']['conf_path']
|
||||
credentials = Chef::EncryptedDataBagItem.load('credentials', 'bitcoin')
|
||||
|
||||
group bitcoin_group
|
||||
|
||||
user bitcoin_user do
|
||||
manage_home true
|
||||
uid 1006
|
||||
gid bitcoin_group
|
||||
shell "/bin/bash"
|
||||
end
|
||||
|
||||
if node['bitcoin']['tor_enabled']
|
||||
group 'debian-tor' do
|
||||
action :modify
|
||||
@@ -99,6 +75,10 @@ end
|
||||
end
|
||||
end
|
||||
|
||||
if bitcoin_blocksdir = node["bitcoin"]["blocksdir"]
|
||||
bitcoind_blocksdir_argument = "-blocksdir=#{bitcoin_blocksdir}"
|
||||
end
|
||||
|
||||
bitcoin_config = node['bitcoin']['conf'].merge({
|
||||
rpcpassword: credentials["rpcpassword"]
|
||||
})
|
||||
@@ -125,7 +105,7 @@ systemd_unit 'bitcoind.service' do
|
||||
Service: {
|
||||
User: bitcoin_user,
|
||||
Type: 'simple',
|
||||
ExecStart: "bitcoind -conf=#{bitcoin_conf_path} -datadir=#{bitcoin_datadir} -walletdir=#{bitcoin_walletdir} -pid=#{bitcoin_datadir}/bitcoind.pid",
|
||||
ExecStart: "bitcoind -conf=#{bitcoin_conf_path} -datadir=#{bitcoin_datadir} -walletdir=#{bitcoin_walletdir} #{bitcoind_blocksdir_argument} -pid=#{bitcoin_datadir}/bitcoind.pid",
|
||||
PIDFile: "#{bitcoin_datadir}/bitcoind.pid",
|
||||
Restart: 'always',
|
||||
PrivateTmp: true,
|
||||
|
||||
18
site-cookbooks/kosmos-bitcoin/recipes/user.rb
Normal file
18
site-cookbooks/kosmos-bitcoin/recipes/user.rb
Normal file
@@ -0,0 +1,18 @@
|
||||
#
|
||||
# Cookbook:: kosmos-bitcoin
|
||||
# Recipe:: user
|
||||
#
|
||||
|
||||
include_recipe 'kosmos-bitcoin::user'
|
||||
|
||||
bitcoin_user = node['bitcoin']['username']
|
||||
bitcoin_group = node['bitcoin']['usergroup']
|
||||
|
||||
group bitcoin_group
|
||||
|
||||
user bitcoin_user do
|
||||
manage_home true
|
||||
uid 1006
|
||||
gid bitcoin_group
|
||||
shell "/bin/bash"
|
||||
end
|
||||
Reference in New Issue
Block a user