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:
Râu Cao
2022-10-26 15:46:29 +02:00
parent 458558fb26
commit 756382ec9f
6 changed files with 104 additions and 14 deletions

View File

@@ -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,