Allow to create a package and install a package compiled from GitHub
Also add nginx config for reverse proxying and set up Let's Encrypt automatically
This commit is contained in:
@@ -5,10 +5,9 @@ provides :parity_node
|
||||
property :name, String, name_property: true, required: true
|
||||
property :config, Hash, required: true
|
||||
property :password, String, required: true
|
||||
property :rpc_proxy_port, Integer
|
||||
|
||||
action :enable do
|
||||
include_recipe "kosmos-parity::default"
|
||||
|
||||
node_name = name
|
||||
parity_service = "parity_#{node_name}"
|
||||
base_path = "#{node['kosmos-parity']['home_path']}/.local/share/io.parity.ethereum/#{name}"
|
||||
@@ -90,4 +89,31 @@ action :enable do
|
||||
service parity_service do
|
||||
action [:enable, :start]
|
||||
end
|
||||
|
||||
if rpc_proxy_port
|
||||
unless node.chef_environment == "development"
|
||||
include_recipe "kosmos-parity::letsencrypt"
|
||||
end
|
||||
|
||||
include_recipe "kosmos-nginx"
|
||||
|
||||
hostname = node['kosmos-parity']['hostname']
|
||||
|
||||
template "#{node['nginx']['dir']}/sites-available/#{parity_service}" do
|
||||
source 'nginx_conf_parity.erb'
|
||||
owner 'www-data'
|
||||
mode 0640
|
||||
variables internal_port: config[:rpc][:port],
|
||||
external_port: rpc_proxy_port,
|
||||
parity_service: parity_service,
|
||||
server_name: hostname,
|
||||
ssl_cert: "/etc/letsencrypt/live/#{hostname}/fullchain.pem",
|
||||
ssl_key: "/etc/letsencrypt/live/#{hostname}/privkey.pem"
|
||||
notifies :reload, 'service[nginx]', :delayed
|
||||
end
|
||||
|
||||
nginx_site "#{parity_service}" do
|
||||
action :enable
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user