Move block data files to CIFS share
This is the vast majority of disk space used on the host currently.
This commit is contained in:
parent
458558fb26
commit
2b61b1817e
|
@ -1,9 +1,30 @@
|
|||
{
|
||||
"id": "bitcoin",
|
||||
"rpcpassword": {
|
||||
"encrypted_data": "dBXJXEYJIoWzo+TPg8CzaKfTo94SdowFDdQKVL/njQ==\n",
|
||||
"iv": "UNragm2xuewXZu0v\n",
|
||||
"auth_tag": "tfjO8qfvti3k5L3Ms2jPLw==\n",
|
||||
"encrypted_data": "nxeli1CRJM0gdTM2VFjW16Ppf6L6YoE+OtpHfUahnA==\n",
|
||||
"iv": "ZIlp+3rJEtkgphz/\n",
|
||||
"auth_tag": "+HJlC9VRedwCpUN69gwkJQ==\n",
|
||||
"version": 3,
|
||||
"cipher": "aes-256-gcm"
|
||||
},
|
||||
"blocksdir_cifs_share": {
|
||||
"encrypted_data": "csJVGkvRoqbEqBnULyfvbf29vYWGKqJdCyV71x5No2otJdtKCl6JYDTQCkPc\nJ15f8PKLSgdyy22BmJvslg==\n",
|
||||
"iv": "ov6OGMuAl6pVxXnj\n",
|
||||
"auth_tag": "e+/RV87T1Wv/JgU9AQKMnQ==\n",
|
||||
"version": 3,
|
||||
"cipher": "aes-256-gcm"
|
||||
},
|
||||
"blocksdir_cifs_user": {
|
||||
"encrypted_data": "cZhyF8q/cc9mlVBpNK84QnHslndXdR8SNXiImBkD3g==\n",
|
||||
"iv": "E7FdytrPzEp8yjDW\n",
|
||||
"auth_tag": "MluvP85h1dMHLlGE1SVApw==\n",
|
||||
"version": 3,
|
||||
"cipher": "aes-256-gcm"
|
||||
},
|
||||
"blocksdir_cifs_password": {
|
||||
"encrypted_data": "MWuPvyIyBggWT9tM64OBg3QrFqfAIBUQH0HxEx1zujCcykg=\n",
|
||||
"iv": "A7xdthaeDHAMBZrf\n",
|
||||
"auth_tag": "vtbgB9WJ57sV74kTWeuVpg==\n",
|
||||
"version": 3,
|
||||
"cipher": "aes-256-gcm"
|
||||
}
|
||||
|
|
|
@ -48,6 +48,8 @@
|
|||
"postfix::sasl_auth",
|
||||
"hostname::default",
|
||||
"ark::default",
|
||||
"kosmos-bitcoin::user",
|
||||
"kosmos-bitcoin::blocksdir-mount",
|
||||
"kosmos-bitcoin::firewall",
|
||||
"git::default",
|
||||
"git::package",
|
||||
|
|
|
@ -6,6 +6,8 @@ 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']['blocksdir'] = '/mnt/data/blocks'
|
||||
node.default['bitcoin']['blocksdir_mount_type'] = 'cifs'
|
||||
|
||||
node.default['bitcoin']['conf'] = {
|
||||
irc: 1,
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
#
|
||||
# Cookbook:: kosmos-bitcoin
|
||||
# Recipe:: blocksdir-mount
|
||||
#
|
||||
|
||||
apt_package "cifs-utils"
|
||||
|
||||
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"
|
||||
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,7 +3,7 @@
|
|||
# Recipe:: source
|
||||
#
|
||||
|
||||
# TODO move to custom kosmos cookbook before publshing bitcoin cookbook
|
||||
# TODO move to custom kosmos cookbook before publishing bitcoin cookbook
|
||||
systemd_unit "mnt-data-bitcoin.mount" do
|
||||
content({
|
||||
Unit: {
|
||||
|
@ -27,6 +27,12 @@ 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 +78,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 +96,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 +126,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} #{bitcoind_blocksdir_argument} -walletdir=#{bitcoin_walletdir} -pid=#{bitcoin_datadir}/bitcoind.pid",
|
||||
PIDFile: "#{bitcoin_datadir}/bitcoind.pid",
|
||||
Restart: 'always',
|
||||
PrivateTmp: true,
|
||||
|
|
|
@ -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
|
Loading…
Reference in New Issue