Moving bitcoin-core to VM
This commit is contained in:
parent
414a595719
commit
217ab471ce
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"name": "bitcoin-2",
|
||||
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuNy0NZUQo93anCe3YkGI\nGTzHnH1SUqc7315ShEEgp9GC9ghEaFe9YX6fdYma4KLfehi1LNoYhibpaVvF6qMB\n5p2pCk4eM9EjRYve3byqt0ZJZzLEcR4zfoiqJHLMBfB1tDiGj3BbahY6LJ0WH/q2\nTek61LOp2nB/9HYSIRlYz8EJtt2YyjV57oqQD5rnEDCJyBf34VI81SZFBeSHCeHQ\nUDALdnkro840FHfFKMUTdUmtpq/bhBA13EkFqVObnc0xZQP3eW6pRNeZ5oUpBLK3\nbAXahd8YEW6c6XerK3JqROs/l2ZRXmfmOMB5RjzmTEuCDsZFuCnJDQEY1nWCyUmu\nhQIDAQAB\n-----END PUBLIC KEY-----\n"
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
{
|
||||
"name": "bitcoin-2",
|
||||
"normal": {
|
||||
"knife_zero": {
|
||||
"host": "10.147.20.163"
|
||||
}
|
||||
},
|
||||
"automatic": {
|
||||
"fqdn": "bitcoin-2",
|
||||
"os": "linux",
|
||||
"os_version": "5.4.0-42-generic",
|
||||
"hostname": "bitcoin-2",
|
||||
"ipaddress": "192.168.122.148",
|
||||
"roles": [
|
||||
|
||||
],
|
||||
"recipes": [
|
||||
"kosmos-base",
|
||||
"kosmos-base::default",
|
||||
"kosmos-bitcoin::source",
|
||||
"apt::default",
|
||||
"timezone_iii::default",
|
||||
"timezone_iii::debian",
|
||||
"ntp::default",
|
||||
"ntp::apparmor",
|
||||
"kosmos-base::systemd_emails",
|
||||
"apt::unattended-upgrades",
|
||||
"kosmos-base::firewall",
|
||||
"kosmos-postfix::default",
|
||||
"postfix::default",
|
||||
"postfix::_common",
|
||||
"postfix::_attributes",
|
||||
"postfix::sasl_auth",
|
||||
"hostname::default",
|
||||
"ark::default"
|
||||
],
|
||||
"platform": "ubuntu",
|
||||
"platform_version": "20.04",
|
||||
"cloud": null,
|
||||
"chef_packages": {
|
||||
"ohai": {
|
||||
"version": "15.12.0",
|
||||
"ohai_root": "/opt/chef/embedded/lib/ruby/gems/2.6.0/gems/ohai-15.12.0/lib/ohai"
|
||||
},
|
||||
"chef": {
|
||||
"version": "15.13.8",
|
||||
"chef_root": "/opt/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.13.8/lib"
|
||||
}
|
||||
}
|
||||
},
|
||||
"run_list": [
|
||||
"recipe[kosmos-base]",
|
||||
"recipe[kosmos-bitcoin::source]"
|
||||
]
|
||||
}
|
|
@ -3,8 +3,9 @@ node.default['bitcoin']['checksum'] = '4bbd62fd6acfa5e9864ebf37a24a04bc2dcfe3e3
|
|||
node.default['bitcoin']['username'] = 'satoshi'
|
||||
node.default['bitcoin']['usergroup'] = 'bitcoin'
|
||||
node.default['bitcoin']['network'] = 'mainnet'
|
||||
node.default['bitcoin']['datadir'] = '/home/satoshi/.bitcoin'
|
||||
node.default['bitcoin']['walletdir'] = '/mnt/data/bitcoin'
|
||||
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']['conf'] = {
|
||||
irc: 1,
|
||||
|
|
|
@ -25,6 +25,28 @@
|
|||
# THE SOFTWARE.
|
||||
#
|
||||
|
||||
# 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
|
||||
|
||||
|
||||
include_recipe 'ark'
|
||||
|
||||
build_essential
|
||||
|
@ -46,21 +68,17 @@ execute "Compile bitcoin-core dependencies" do
|
|||
not_if { ::File.directory?("/usr/local/bitcoind/depends/x86_64-pc-linux-gnu") }
|
||||
end
|
||||
|
||||
execute "Configure bitcoin-core" do
|
||||
execute "Configure, compile bitcoin-core" do
|
||||
cwd "/usr/local/bitcoind"
|
||||
# FIXME only executes first array item?
|
||||
command [
|
||||
"./autogen.sh",
|
||||
"./configure --prefix=$PWD/depends/x86_64-pc-linux-gnu"
|
||||
"./configure --prefix=$PWD/depends/x86_64-pc-linux-gnu",
|
||||
"make"
|
||||
]
|
||||
not_if { ::File.exist?("/usr/local/bitcoind/src/bitcoind") }
|
||||
end
|
||||
|
||||
execute "Compile bitcoin-core" do
|
||||
cwd "/usr/local/bitcoind"
|
||||
command "make"
|
||||
not_if { ::File.exist?("/usr/local/bitcoind/src/bitcoind") }
|
||||
end
|
||||
|
||||
link "/usr/local/bin/bitcoind" do
|
||||
to "/usr/local/bitcoind/src/bitcoind"
|
||||
end
|
||||
|
@ -73,12 +91,14 @@ bitcoin_user = node['bitcoin']['username']
|
|||
bitcoin_group = node['bitcoin']['usergroup']
|
||||
bitcoin_datadir = node['bitcoin']['datadir']
|
||||
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
|
||||
|
@ -97,7 +117,7 @@ bitcoin_config = node['bitcoin']['conf'].merge({
|
|||
rpcpassword: credentials["rpcpassword"]
|
||||
})
|
||||
|
||||
template "#{bitcoin_datadir}/bitcoin.conf" do
|
||||
template bitcoin_conf_path do
|
||||
owner bitcoin_user
|
||||
group bitcoin_group
|
||||
mode '0640'
|
||||
|
@ -119,7 +139,7 @@ systemd_unit 'bitcoind.service' do
|
|||
Service: {
|
||||
User: bitcoin_user,
|
||||
Type: 'simple',
|
||||
ExecStart: "bitcoind -datadir=#{bitcoin_datadir} -walletdir=#{bitcoin_walletdir} -pid=#{bitcoin_datadir}/bitcoind.pid",
|
||||
ExecStart: "bitcoind -conf=#{bitcoin_conf_path} -datadir=#{bitcoin_datadir} -walletdir=#{bitcoin_walletdir} -pid=#{bitcoin_datadir}/bitcoind.pid",
|
||||
PIDFile: "#{bitcoin_datadir}/bitcoind.pid",
|
||||
Restart: 'always',
|
||||
PrivateTmp: true,
|
||||
|
@ -135,14 +155,9 @@ systemd_unit 'bitcoind.service' do
|
|||
})
|
||||
verify false
|
||||
triggers_reload true
|
||||
action [:create, :start]
|
||||
action [:create, :enable, :start]
|
||||
end
|
||||
|
||||
# Creates/starts a Path unit which starts the bitcoind service when the
|
||||
# encrypted data directory is mounted
|
||||
# TODO move to custom kosmos cookbook before publishing bitcoin cookbook
|
||||
encfs_path_activation_unit 'bitcoind.service'
|
||||
|
||||
# TODO move to custom kosmos cookbook before publishing bitcoin cookbook
|
||||
firewall_rule 'bitcoind' do
|
||||
port [8333] # TODO adjust for testnet
|
||||
|
|
Loading…
Reference in New Issue