Remove obsolete cookbook
This commit is contained in:
parent
0f12a54eab
commit
7f2805831c
@ -1,4 +0,0 @@
|
||||
# kosmos-parity CHANGELOG
|
||||
|
||||
## 0.1.0
|
||||
- [Greg Karékinian] - Initial release of kosmos-parity
|
@ -1,20 +0,0 @@
|
||||
Copyright (c) 2019 Kosmos Developers
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@ -1,52 +0,0 @@
|
||||
# kosmos-parity Cookbook
|
||||
|
||||
This cookbook installs [Parity](https://parity.io/) nodes
|
||||
|
||||
## Requirements
|
||||
|
||||
### Platforms
|
||||
|
||||
- Ubuntu
|
||||
|
||||
### Chef
|
||||
|
||||
- Chef 12.1 or later
|
||||
|
||||
## Attributes
|
||||
|
||||
### kosmos-parity::default
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>Key</th>
|
||||
<th>Type</th>
|
||||
<th>Description</th>
|
||||
<th>Default</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><tt>['kosmos-parity']['home_path']</tt></td>
|
||||
<td>String</td>
|
||||
<td>The parity user's home path</td>
|
||||
<td><tt>/home/parity</tt></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
## Usage
|
||||
|
||||
### kosmos-parity::default
|
||||
|
||||
### kosmos-parity::node_dev
|
||||
|
||||
Sets up a parity node running on the dev chain on port 8545 (behind nginx, with
|
||||
HTTPS)
|
||||
|
||||
### kosmos-parity::node_testnet
|
||||
|
||||
Sets up a parity node running on the testnet chain on port 8546 (behind nginx,
|
||||
with HTTPS)
|
||||
|
||||
## License and Authors
|
||||
|
||||
Authors:
|
||||
|
||||
* Greg Karékinian
|
@ -1,7 +0,0 @@
|
||||
node.default['kosmos-parity']['home_path'] = "/home/parity"
|
||||
node.default['kosmos-parity']['version'] = "1.6.6"
|
||||
node.default['kosmos-parity']['package_checksum'] = '7fd51ded7a367774e62c965088ffd15ad0fa42251005d448eb700cbf5db8df24'
|
||||
node.default['kosmos-parity']['package_version'] = '1.7.0'
|
||||
node.default['kosmos-parity']['package_timestamp'] = '1493999009'
|
||||
node.default['kosmos-parity']['debian_package_dir'] = Chef::Config[:file_cache_path]
|
||||
node.default['kosmos-parity']['hostname'] = "parity.kosmos.org"
|
@ -1,14 +0,0 @@
|
||||
name 'kosmos-parity'
|
||||
maintainer 'Kosmos'
|
||||
maintainer_email 'mail@kosmos.org'
|
||||
license 'MIT'
|
||||
description 'Installs/Configures kosmos-parity'
|
||||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
||||
version '0.1.0'
|
||||
|
||||
gem 'toml'
|
||||
|
||||
depends 'ark'
|
||||
depends 'kosmos-nginx'
|
||||
depends 'firewall'
|
||||
depends 'backup'
|
@ -1,6 +0,0 @@
|
||||
|
||||
return if node.chef_environment == "development"
|
||||
|
||||
# Backup the local directory
|
||||
node.override["backup"]["archives"]["parity"] = ["#{node['kosmos-parity']['home_path']}/.local/share/io.parity.ethereum/**/keys"]
|
||||
include_recipe "backup"
|
@ -1,86 +0,0 @@
|
||||
#
|
||||
# Cookbook Name:: kosmos-parity
|
||||
# Recipe:: create_package_from_github
|
||||
#
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright:: 2019, Kosmos Developers
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
include_recipe 'kosmos-parity::user'
|
||||
build_essential 'kosmos-parity'
|
||||
package %w(git libssl-dev pkg-config libudev-dev)
|
||||
gem_package 'fpm' do
|
||||
version '1.8.1'
|
||||
end
|
||||
|
||||
rust_version = '1.17.0'
|
||||
architecture = node['kernel']['machine']
|
||||
rust_canonical_basename = "rust-#{rust_version}-#{architecture}-unknown-linux-gnu"
|
||||
rust_path = "/usr/local/rust_#{rust_version}"
|
||||
|
||||
url = "https://static.rust-lang.org/dist/#{rust_canonical_basename}.tar.gz"
|
||||
|
||||
ark "rust_#{rust_version}" do
|
||||
url url
|
||||
path "/usr/local"
|
||||
action :put
|
||||
notifies :run, "execute[install rust]", :immediately
|
||||
end
|
||||
|
||||
execute "install rust" do
|
||||
command "./install.sh"
|
||||
cwd "#{rust_path}"
|
||||
action :nothing
|
||||
end
|
||||
|
||||
parity_revision = "0d8920347a72fc50e82b540855eba94c8bbb2c0f"
|
||||
|
||||
git "/home/parity/parity" do
|
||||
repository "https://github.com/paritytech/parity.git"
|
||||
revision parity_revision
|
||||
user "parity"
|
||||
group "parity"
|
||||
notifies :run, "execute[build parity]", :immediately
|
||||
end
|
||||
|
||||
execute "build parity" do
|
||||
cwd "/home/parity/parity"
|
||||
environment "HOME" => "/home/parity"
|
||||
command "cargo build --release"
|
||||
action :nothing
|
||||
user "parity"
|
||||
group "parity"
|
||||
notifies :run, "execute[copy parity]", :immediately
|
||||
end
|
||||
|
||||
execute "copy parity" do
|
||||
command "cp /home/parity/parity/target/release/parity /usr/bin/"
|
||||
action :run
|
||||
notifies :run, "execute[create package]", :immediately
|
||||
end
|
||||
|
||||
timestamp = Time.now.strftime('%s')
|
||||
parity_version = node['kosmos-parity']['package_version']
|
||||
execute "create package" do
|
||||
cwd node['kosmos-parity']['debian_package_dir']
|
||||
command "fpm -s dir -t deb -n parity -v #{parity_version}-#{timestamp} -p parity_#{parity_version}-#{timestamp}.deb /usr/bin/parity"
|
||||
action :nothing
|
||||
end
|
@ -1,42 +0,0 @@
|
||||
#
|
||||
# Cookbook Name:: kosmos-parity
|
||||
# Recipe:: default
|
||||
#
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright:: 2019, Kosmos Developers
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
include_recipe 'kosmos-parity::user'
|
||||
|
||||
parity_version = node['kosmos-parity']['version']
|
||||
parity_package_path = "#{Chef::Config[:file_cache_path]}/parity_#{parity_version}_amd64.deb"
|
||||
remote_file parity_package_path do
|
||||
source "https://d1h4xl4cr1h0mo.cloudfront.net/v#{parity_version}/x86_64-unknown-linux-gnu/parity_#{parity_version}_amd64.deb"
|
||||
checksum node['kosmos-parity']['checksum']
|
||||
mode 0750
|
||||
notifies :install, "dpkg_package[parity]", :immediately
|
||||
end
|
||||
|
||||
dpkg_package "parity" do
|
||||
source parity_package_path
|
||||
end
|
||||
|
||||
include_recipe "kosmos-parity::backup"
|
@ -1,46 +0,0 @@
|
||||
#
|
||||
# Cookbook Name:: kosmos-parity
|
||||
# Recipe:: default
|
||||
#
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright:: 2019, Kosmos Developers
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
include_recipe 'kosmos-parity::user'
|
||||
|
||||
parity_version = node['kosmos-parity']['package_version']
|
||||
package_timestamp = node['kosmos-parity']['package_timestamp']
|
||||
parity_filename = "parity_#{parity_version}-#{package_timestamp}.deb"
|
||||
|
||||
parity_package_path = "#{Chef::Config[:file_cache_path]}/#{parity_filename}"
|
||||
remote_file parity_package_path do
|
||||
source "https://dl.5apps.com/#{parity_filename}"
|
||||
checksum node['kosmos-parity']['checksum']
|
||||
mode 0750
|
||||
notifies :install, "dpkg_package[parity]", :immediately
|
||||
end
|
||||
|
||||
dpkg_package "parity" do
|
||||
source parity_package_path
|
||||
version "#{parity_version}-#{package_timestamp}"
|
||||
end
|
||||
|
||||
include_recipe "kosmos-parity::backup"
|
@ -1,75 +0,0 @@
|
||||
#
|
||||
# Cookbook Name:: kosmos-parity
|
||||
# Recipe:: node_dev
|
||||
#
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright:: 2019, Kosmos Developers
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
# Sets up a parity node running on the dev chain on port 8545 (behind nginx,
|
||||
# with HTTPS)
|
||||
|
||||
rpc_proxy_port = 8545
|
||||
rpc_port = 18545
|
||||
dapps_port = 8180
|
||||
|
||||
parity_node "dev" do
|
||||
password "parityparity"
|
||||
config parity: {
|
||||
chain: "dev",
|
||||
no_download: true, # Don't download updates
|
||||
},
|
||||
network: {
|
||||
port: 30303,
|
||||
warp: true,
|
||||
allow_ips: "public" # Don't connect to local IPs
|
||||
},
|
||||
rpc: {
|
||||
port: rpc_port,
|
||||
cors: "*",
|
||||
apis: ["web3", "net", "traces", "rpc", "eth"],
|
||||
hosts: ["all"],
|
||||
},
|
||||
dapps: {
|
||||
port: dapps_port,
|
||||
},
|
||||
ui: {
|
||||
disable: true,
|
||||
},
|
||||
websockets: {
|
||||
disable: true,
|
||||
},
|
||||
mining: {
|
||||
reseal_min_period: 0,
|
||||
}
|
||||
rpc_proxy_port rpc_proxy_port
|
||||
end
|
||||
|
||||
# The firewall_rule doesn't appear to work inside a resource, that's why we're
|
||||
# doing it here
|
||||
unless node.chef_environment == "development"
|
||||
include_recipe 'firewall'
|
||||
firewall_rule "parity_dev" do
|
||||
port rpc_proxy_port
|
||||
protocol :tcp
|
||||
command :allow
|
||||
end
|
||||
end
|
@ -1,74 +0,0 @@
|
||||
#
|
||||
# Cookbook Name:: kosmos-parity
|
||||
# Recipe:: node_mainnet
|
||||
#
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright:: 2019, Kosmos Developers
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
# Sets up a parity node running on the mainnet chain on port 8547 (behind
|
||||
# nginx, with HTTPS)
|
||||
|
||||
rpc_proxy_port = 8547
|
||||
rpc_port = 18547
|
||||
dapps_port = 8182
|
||||
|
||||
credentials = Chef::EncryptedDataBagItem.load('credentials', 'parity')
|
||||
|
||||
parity_node "mainnet" do
|
||||
password credentials["mainnet_password"]
|
||||
config parity: {
|
||||
chain: "homestead",
|
||||
no_download: true, # Don't Download Updates
|
||||
},
|
||||
network: {
|
||||
port: 30305,
|
||||
warp: true,
|
||||
allow_ips: "public" # Don't connect to local IPs
|
||||
},
|
||||
rpc: {
|
||||
port: rpc_port,
|
||||
cors: "*",
|
||||
apis: ["web3", "net", "traces", "rpc", "eth"],
|
||||
hosts: ["all"],
|
||||
},
|
||||
dapps: {
|
||||
port: dapps_port,
|
||||
},
|
||||
ui: {
|
||||
disable: true,
|
||||
},
|
||||
websockets: {
|
||||
disable: true,
|
||||
}
|
||||
rpc_proxy_port rpc_proxy_port
|
||||
end
|
||||
|
||||
# The firewall_rule doesn't appear to work inside a resource, that's why we're
|
||||
# doing it here
|
||||
unless node.chef_environment == "development"
|
||||
include_recipe 'firewall'
|
||||
firewall_rule "parity_mainnet" do
|
||||
port rpc_proxy_port
|
||||
protocol :tcp
|
||||
command :allow
|
||||
end
|
||||
end
|
@ -1,75 +0,0 @@
|
||||
#
|
||||
# Cookbook Name:: kosmos-parity
|
||||
# Recipe:: node_testnet
|
||||
#
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright:: 2019, Kosmos Developers
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
# Sets up a parity node running on the testnet chain on port 8546 (behind
|
||||
# nginx, with HTTPS)
|
||||
|
||||
rpc_proxy_port = 8546
|
||||
rpc_port = 18546
|
||||
dapps_port = 8181
|
||||
network_port = 30304
|
||||
|
||||
credentials = Chef::EncryptedDataBagItem.load('credentials', 'parity')
|
||||
|
||||
parity_node "testnet" do
|
||||
password credentials["testnet_password"]
|
||||
config parity: {
|
||||
chain: "ropsten",
|
||||
no_download: true, # Don't download updates
|
||||
},
|
||||
network: {
|
||||
port: network_port,
|
||||
warp: true,
|
||||
allow_ips: "public" # Don't connect to local IPs
|
||||
},
|
||||
rpc: {
|
||||
port: rpc_port,
|
||||
cors: "*",
|
||||
apis: ["web3", "net", "traces", "rpc", "eth"],
|
||||
hosts: ["all"],
|
||||
},
|
||||
dapps: {
|
||||
port: dapps_port,
|
||||
},
|
||||
ui: {
|
||||
disable: true,
|
||||
},
|
||||
websockets: {
|
||||
disable: true,
|
||||
}
|
||||
rpc_proxy_port rpc_proxy_port
|
||||
end
|
||||
|
||||
# The firewall_rule doesn't appear to work inside a resource, that's why we're
|
||||
# doing it here
|
||||
unless node.chef_environment == "development"
|
||||
include_recipe 'firewall'
|
||||
firewall_rule "parity_testnet" do
|
||||
port [ rpc_proxy_port, network_port ]
|
||||
protocol :tcp
|
||||
command :allow
|
||||
end
|
||||
end
|
@ -1,37 +0,0 @@
|
||||
#
|
||||
# Cookbook Name:: kosmos-parity
|
||||
# Recipe:: user
|
||||
#
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright:: 2019, Kosmos Developers
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
group "parity" do
|
||||
gid 72748
|
||||
end
|
||||
|
||||
user "parity" do
|
||||
system true
|
||||
manage_home true
|
||||
comment "parity user"
|
||||
uid 72748
|
||||
gid 72748
|
||||
end
|
@ -1,136 +0,0 @@
|
||||
require 'toml'
|
||||
|
||||
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
|
||||
node_name = name
|
||||
parity_service = "parity_#{node_name}"
|
||||
base_path = "#{node['kosmos-parity']['home_path']}/.local/share/io.parity.ethereum/#{node_name}"
|
||||
config_path = "#{base_path}/config.toml"
|
||||
|
||||
config[:parity][:base_path] = base_path
|
||||
config[:account] = {}
|
||||
config[:account][:password] = ["#{base_path}/password"]
|
||||
|
||||
if config[:parity][:chain] == "dev"
|
||||
config[:parity][:chain] = "#{base_path}/chain-config.json"
|
||||
end
|
||||
|
||||
directory base_path do
|
||||
recursive true
|
||||
owner "parity"
|
||||
group "parity"
|
||||
end
|
||||
|
||||
%w(chains keys).each do |subfolder|
|
||||
directory "#{base_path}/#{subfolder}" do
|
||||
recursive true
|
||||
owner "parity"
|
||||
group "parity"
|
||||
end
|
||||
end
|
||||
|
||||
password_path = "#{base_path}/password"
|
||||
|
||||
file password_path do
|
||||
content password
|
||||
owner "parity"
|
||||
group "parity"
|
||||
mode 0640
|
||||
end
|
||||
|
||||
ruby_block "generate config" do
|
||||
block do
|
||||
parity_args = "--chain #{config[:parity][:chain]} --base-path #{base_path}"
|
||||
|
||||
parity_account_list = Mixlib::ShellOut.new(
|
||||
"parity account list #{parity_args}",
|
||||
user: "parity"
|
||||
)
|
||||
parity_account_list.run_command
|
||||
|
||||
parity_account = parity_account_list.stdout.strip.gsub(/[(\[|\])]/, '')
|
||||
|
||||
if parity_account.empty?
|
||||
parity_account_create = Mixlib::ShellOut.new(
|
||||
"parity account new #{parity_args} --password #{base_path}/password",
|
||||
user: "parity"
|
||||
)
|
||||
parity_account_create.run_command
|
||||
|
||||
parity_account = parity_account_create.stdout.strip
|
||||
end
|
||||
|
||||
config[:account][:unlock] = [parity_account]
|
||||
|
||||
# Using our own chain config (i.e. dev)
|
||||
if config[:parity][:chain].include?(".json")
|
||||
template "#{base_path}/chain-config.json" do
|
||||
source 'chain-config.json.erb'
|
||||
variables parity_account: parity_account
|
||||
owner "parity"
|
||||
group "parity"
|
||||
mode 0640
|
||||
notifies :restart, "service[#{parity_service}]", :delayed
|
||||
end
|
||||
end
|
||||
|
||||
file "config" do
|
||||
path config_path
|
||||
content TOML::Generator.new(config).body
|
||||
owner "parity"
|
||||
group "parity"
|
||||
mode 0640
|
||||
notifies :restart, "service[#{parity_service}]", :delayed
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
execute "systemctl daemon-reload" do
|
||||
command "systemctl daemon-reload"
|
||||
action :nothing
|
||||
end
|
||||
|
||||
template "/lib/systemd/system/#{parity_service}.service" do
|
||||
source "parity.systemd.service.erb"
|
||||
variables config_file: config_path
|
||||
notifies :run, "execute[systemctl daemon-reload]", :delayed
|
||||
notifies :restart, "service[#{parity_service}]", :delayed
|
||||
end
|
||||
|
||||
service parity_service do
|
||||
action [:enable, :start]
|
||||
end
|
||||
|
||||
if rpc_proxy_port
|
||||
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
|
||||
|
||||
nginx_certbot_site hostname do
|
||||
site parity_service
|
||||
end
|
||||
end
|
||||
end
|
@ -1,34 +0,0 @@
|
||||
{
|
||||
"name": "KreditsChain",
|
||||
"engine": {
|
||||
"instantSeal": { "params": {} }
|
||||
},
|
||||
"params": {
|
||||
"accountStartNonce": "0x00",
|
||||
"maximumExtraDataSize": "0x20",
|
||||
"minGasLimit": "0x1388",
|
||||
"networkID" : "0x11"
|
||||
},
|
||||
"genesis": {
|
||||
"seal": {
|
||||
"ethereum": {
|
||||
"nonce": "0x00006d6f7264656e",
|
||||
"mixHash": "0x00000000000000000000000000000000000000647572616c65787365646c6578"
|
||||
}
|
||||
},
|
||||
"difficulty": "0x20000",
|
||||
"author": "0x0000000000000000000000000000000000000000",
|
||||
"timestamp": "0x00",
|
||||
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"extraData": "0x",
|
||||
"gasLimit": "0x5B8D80"
|
||||
},
|
||||
"accounts": {
|
||||
"0000000000000000000000000000000000000001": { "balance": "1", "builtin": { "name": "ecrecover", "pricing": { "linear": { "base": 3000, "word": 0 } } } },
|
||||
"0000000000000000000000000000000000000002": { "balance": "1", "builtin": { "name": "sha256", "pricing": { "linear": { "base": 60, "word": 12 } } } },
|
||||
"0000000000000000000000000000000000000003": { "balance": "1", "builtin": { "name": "ripemd160", "pricing": { "linear": { "base": 600, "word": 120 } } } },
|
||||
"0000000000000000000000000000000000000004": { "balance": "1", "builtin": { "name": "identity", "pricing": { "linear": { "base": 15, "word": 3 } } } },
|
||||
"<%= @parity_account %>":{"balance": "1606938044258990275541962092341162602522" }
|
||||
}
|
||||
}
|
||||
|
@ -1,30 +0,0 @@
|
||||
# Generated by Chef
|
||||
upstream _<%= @parity_service %> {
|
||||
server localhost:<%= @internal_port %>;
|
||||
}
|
||||
|
||||
server {
|
||||
<% if File.exist?(@ssl_cert) && File.exist?(@ssl_key) -%>
|
||||
listen <%= @external_port %> ssl http2;
|
||||
<% else -%>
|
||||
listen <%= @external_port %>;
|
||||
<% end -%>
|
||||
|
||||
server_name <%= @server_name %>;
|
||||
|
||||
access_log <%= node[:nginx][:log_dir] %>/<%= @parity_service %>.access.log json;
|
||||
error_log <%= node[:nginx][:log_dir] %>/<%= @parity_service %>.error.log warn;
|
||||
|
||||
location / {
|
||||
# Increase number of buffers. Default is 8
|
||||
proxy_buffers 1024 8k;
|
||||
|
||||
proxy_pass http://_<%= @parity_service %>;
|
||||
proxy_http_version 1.1;
|
||||
}
|
||||
|
||||
<% if File.exist?(@ssl_cert) && File.exist?(@ssl_key) -%>
|
||||
ssl_certificate <%= @ssl_cert %>;
|
||||
ssl_certificate_key <%= @ssl_key %>;
|
||||
<% end -%>
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
[Unit]
|
||||
Description=Parity Daemon (<%= @environment %>)
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/parity --config <%= @config_file %> --no-discovery $ARGS
|
||||
User=parity
|
||||
Group=parity
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
Loading…
x
Reference in New Issue
Block a user