parent
4a6a02c137
commit
c8122a44f1
|
@ -32,9 +32,11 @@ execute "snap install bitcoin-core --channel=0.19/stable"
|
||||||
bitcoin_user = node['bitcoin']['username']
|
bitcoin_user = node['bitcoin']['username']
|
||||||
bitcoin_group = node['bitcoin']['usergroup']
|
bitcoin_group = node['bitcoin']['usergroup']
|
||||||
bitcoin_datadir = node['bitcoin']['datadir']
|
bitcoin_datadir = node['bitcoin']['datadir']
|
||||||
|
bitcoin_snapdir = "/home/#{bitcoin_user}/snap/bitcoin-core/common/.bitcoin"
|
||||||
|
|
||||||
user bitcoin_user do
|
user bitcoin_user do
|
||||||
manage_home true
|
manage_home true
|
||||||
|
shell "/bin/bash"
|
||||||
end
|
end
|
||||||
|
|
||||||
directory bitcoin_datadir do
|
directory bitcoin_datadir do
|
||||||
|
@ -53,10 +55,10 @@ template "#{bitcoin_datadir}/bitcoin.conf" do
|
||||||
testnet_conf: node['bitcoin']['testnet_conf'],
|
testnet_conf: node['bitcoin']['testnet_conf'],
|
||||||
regtest_conf: node['bitcoin']['regtest_conf']
|
regtest_conf: node['bitcoin']['regtest_conf']
|
||||||
action :create
|
action :create
|
||||||
# notifies :reload, "service[bitcoin]", :delayed
|
# notifies :reload, "service[bitcoind]", :delayed
|
||||||
end
|
end
|
||||||
|
|
||||||
directory "/home/#{bitcoin_user}/snap/bitcoin-core/common/.bitcoin" do
|
directory bitcoin_snapdir do
|
||||||
owner bitcoin_user
|
owner bitcoin_user
|
||||||
group bitcoin_group
|
group bitcoin_group
|
||||||
mode '0750'
|
mode '0750'
|
||||||
|
@ -64,11 +66,35 @@ directory "/home/#{bitcoin_user}/snap/bitcoin-core/common/.bitcoin" do
|
||||||
action :create
|
action :create
|
||||||
end
|
end
|
||||||
|
|
||||||
mount "/home/#{bitcoin_user}/snap/bitcoin-core/common/.bitcoin" do
|
execute "chown -R #{bitcoin_user}:#{bitcoin_group} /home/#{bitcoin_user}/snap"
|
||||||
device node['bitcoin']['datadir']
|
|
||||||
|
mount bitcoin_snapdir do
|
||||||
|
device bitcoin_datadir
|
||||||
fstype 'none'
|
fstype 'none'
|
||||||
options 'bind'
|
options 'bind'
|
||||||
action [:mount]
|
action [:mount]
|
||||||
end
|
end
|
||||||
|
|
||||||
# TODO create systemd service for bitcoin-core.daemon
|
systemd_unit 'bitcoind.service' do
|
||||||
|
content({
|
||||||
|
Unit: {
|
||||||
|
Description: 'Bitcoin Core daemon',
|
||||||
|
Documentation: ['https://bitcoincore.org'],
|
||||||
|
After: 'network.target'
|
||||||
|
},
|
||||||
|
Service: {
|
||||||
|
User: bitcoin_user,
|
||||||
|
Type: 'exec',
|
||||||
|
ExecStart: '/snap/bin/bitcoin-core.daemon',
|
||||||
|
PIDFile: "#{bitcoin_snapdir}/bitcoind.pid",
|
||||||
|
Restart: 'on-failure',
|
||||||
|
},
|
||||||
|
Install: {
|
||||||
|
WantedBy: 'multi-user.target'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
verify false
|
||||||
|
triggers_reload true
|
||||||
|
action :create
|
||||||
|
end
|
||||||
|
|
|
@ -1,69 +0,0 @@
|
||||||
# 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
|
|
|
@ -6,14 +6,14 @@
|
||||||
##
|
##
|
||||||
|
|
||||||
<% @conf.each do |key, value| %>
|
<% @conf.each do |key, value| %>
|
||||||
<%= "#{key}=#{value}" %>
|
<%= "#{key}=#{value}" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if @mainnet_conf %>
|
<% if @mainnet_conf %>
|
||||||
# Options only for mainnet
|
# Options only for mainnet
|
||||||
[main]
|
[main]
|
||||||
<% @mainnet_conf.each do |key, value| %>
|
<% @mainnet_conf.each do |key, value| %>
|
||||||
<%= "#{key}=#{value}" %>
|
<%= "#{key}=#{value}" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
# Options only for testnet
|
# Options only for testnet
|
||||||
[test]
|
[test]
|
||||||
<% @testnet_conf.each do |key, value| %>
|
<% @testnet_conf.each do |key, value| %>
|
||||||
<%= "#{key}=#{value}" %>
|
<%= "#{key}=#{value}" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
@ -29,6 +29,6 @@
|
||||||
# Options only for regtest
|
# Options only for regtest
|
||||||
[regtest]
|
[regtest]
|
||||||
<% @regtest_conf.each do |key, value| %>
|
<% @regtest_conf.each do |key, value| %>
|
||||||
<%= "#{key}=#{value}" %>
|
<%= "#{key}=#{value}" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
Loading…
Reference in New Issue