Configure and run c-lightning daemon
This commit is contained in:
parent
f88354c67c
commit
5892e3c0ab
@ -28,6 +28,11 @@ node.default['bitcoin']['conf'] = {
|
|||||||
node.default['c-lightning']['repo'] = 'https://github.com/ElementsProject/lightning'
|
node.default['c-lightning']['repo'] = 'https://github.com/ElementsProject/lightning'
|
||||||
node.default['c-lightning']['revision'] = 'v0.9.2'
|
node.default['c-lightning']['revision'] = 'v0.9.2'
|
||||||
node.default['c-lightning']['source_dir'] = '/opt/c-lightning'
|
node.default['c-lightning']['source_dir'] = '/opt/c-lightning'
|
||||||
|
node.default['c-lightning']['lightning_dir'] = "/home/#{node['bitcoin']['username']}/.lightning"
|
||||||
|
node.default['c-lightning']['alias'] = 'ln3.kosmos.org'
|
||||||
|
node.default['c-lightning']['rgb'] = '0D4F99'
|
||||||
|
node.default['c-lightning']['log_level'] = 'info'
|
||||||
|
node.default['c-lightning']['public_ip'] = '148.251.237.73'
|
||||||
|
|
||||||
node.default['lnd']['repo'] = 'https://github.com/lightningnetwork/lnd'
|
node.default['lnd']['repo'] = 'https://github.com/lightningnetwork/lnd'
|
||||||
node.default['lnd']['revision'] = 'v0.11.1-beta'
|
node.default['lnd']['revision'] = 'v0.11.1-beta'
|
||||||
|
@ -29,4 +29,68 @@ bash "compile_c-lightning" do
|
|||||||
make install
|
make install
|
||||||
EOH
|
EOH
|
||||||
action :nothing
|
action :nothing
|
||||||
|
notifies :restart, "systemd_unit[lightningd.service]", :delayed
|
||||||
|
end
|
||||||
|
|
||||||
|
bitcoin_user = node['bitcoin']['username']
|
||||||
|
bitcoin_group = node['bitcoin']['usergroup']
|
||||||
|
lightning_dir = node['c-lightning']['lightning_dir']
|
||||||
|
|
||||||
|
bitcoin_credentials = Chef::EncryptedDataBagItem.load('credentials', 'bitcoin')
|
||||||
|
|
||||||
|
directory lightning_dir do
|
||||||
|
owner bitcoin_user
|
||||||
|
group bitcoin_group
|
||||||
|
mode '0750'
|
||||||
|
action :create
|
||||||
|
end
|
||||||
|
|
||||||
|
template "#{lightning_dir}/config" do
|
||||||
|
source "c-lightning.config.erb"
|
||||||
|
owner bitcoin_user
|
||||||
|
group bitcoin_group
|
||||||
|
mode '0640'
|
||||||
|
variables lighting_dir: lightning_dir,
|
||||||
|
lightning_alias: node['c-lightning']['alias'],
|
||||||
|
lightning_rgb: node['c-lightning']['rgb'],
|
||||||
|
lightning_log_level: node['c-lightning']['log_level'],
|
||||||
|
bitcoin_datadir: node['bitcoin']['datadir'],
|
||||||
|
bitcoin_rpc_user: node['bitcoin']['conf']['rpcuser'],
|
||||||
|
bitcoin_rpc_password: bitcoin_credentials["rpcpassword"],
|
||||||
|
bitcoin_rpc_host: node['bitcoin']['conf']['rpcbind'],
|
||||||
|
public_ip: node['c-lightning']['public_ip']
|
||||||
|
notifies :restart, "systemd_unit[lightningd.service]", :delayed
|
||||||
|
end
|
||||||
|
|
||||||
|
systemd_unit 'lightningd.service' do
|
||||||
|
content({
|
||||||
|
Unit: {
|
||||||
|
Description: 'C-Lightning daemon',
|
||||||
|
Documentation: ['https://github.com/ElementsProject/lightning'],
|
||||||
|
Requires: 'bitcoind.service',
|
||||||
|
After: 'bitcoind.service'
|
||||||
|
},
|
||||||
|
Service: {
|
||||||
|
User: node['bitcoin']['username'],
|
||||||
|
Group: node['bitcoin']['usergroup'],
|
||||||
|
Type: 'simple',
|
||||||
|
ExecStart: "/usr/local/bin/lightningd",
|
||||||
|
Restart: 'always',
|
||||||
|
RestartSec: '30',
|
||||||
|
TimeoutSec: '240',
|
||||||
|
RuntimeDirectory: 'lightningd', # /run/lightningd
|
||||||
|
RuntimeDirectoryMode: '0710',
|
||||||
|
PrivateTmp: true,
|
||||||
|
ProtectSystem: 'full',
|
||||||
|
NoNewPrivileges: true,
|
||||||
|
PrivateDevices: true,
|
||||||
|
MemoryDenyWriteExecute: true
|
||||||
|
},
|
||||||
|
Install: {
|
||||||
|
WantedBy: 'multi-user.target'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
verify false
|
||||||
|
triggers_reload true
|
||||||
|
action [:create, :enable, :start]
|
||||||
end
|
end
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
network=bitcoin
|
||||||
|
bitcoin-datadir=<%= @bitcoin_datadir %>
|
||||||
|
alias=<%= @lightning_alias %>
|
||||||
|
rgb=<%= @lightning_rgb %>
|
||||||
|
bitcoin-rpcuser=<%= @bitcoin_rpc_user %>
|
||||||
|
bitcoin-rpcpassword=<%= @bitcoin_rpc_password %>
|
||||||
|
bitcoin-rpcconnect=<%= @bitcoin_rpc_host %>
|
||||||
|
log-level=<%= @lightning_log_level %>
|
||||||
|
bind-addr=0.0.0.0
|
||||||
|
announce-addr=<%= @public_ip %>
|
||||||
|
disable-dns
|
||||||
|
<%# plugin=/home/satoshi/lightning-plugins/summary/summary.py %>
|
||||||
|
<%# plugin=/home/satoshi/lightning-plugins/rebalance/rebalance.py %>
|
Loading…
x
Reference in New Issue
Block a user