Merge branch 'master' into feature/488-redis_server
This commit is contained in:
@@ -5,12 +5,14 @@ node.default['akkounts']['domain'] = 'accounts.kosmos.org'
|
||||
|
||||
node.default['akkounts_api']['domain'] = 'api.kosmos.org'
|
||||
|
||||
node.default['akkounts']['lndhub']['api_url'] = nil
|
||||
node.default['akkounts']['lndhub']['public_url'] = nil
|
||||
node.default['akkounts']['lndhub']['public_key'] = nil
|
||||
node.default['akkounts']['lndhub']['postgres_db'] = 'lndhub'
|
||||
|
||||
node.default['akkounts']['smtp']['from_address'] = 'Kosmos Accounts <accounts@kosmos.org>'
|
||||
node.default['akkounts']['smtp']['domain'] = 'kosmos.org'
|
||||
node.default['akkounts']['smtp']['auth_method'] = 'plain'
|
||||
node.default['akkounts']['smtp']['enable_starttls'] = 'auto'
|
||||
|
||||
node.default['akkounts']['discourse']['public_url'] = nil
|
||||
|
||||
node.default['akkounts']['lndhub']['api_url'] = nil
|
||||
node.default['akkounts']['lndhub']['public_url'] = nil
|
||||
node.default['akkounts']['lndhub']['public_key'] = nil
|
||||
node.default['akkounts']['lndhub']['postgres_db'] = 'lndhub'
|
||||
|
||||
@@ -60,9 +60,14 @@ env[:sentry_dsn] = credentials["sentry_dsn"]
|
||||
if webhooks_allowed_ips.length > 0
|
||||
env[:webhooks_allowed_ips] = webhooks_allowed_ips
|
||||
end
|
||||
|
||||
if btcpay_host
|
||||
env[:btcpay_api_url] = "http://#{btcpay_host}:23001/api/v1"
|
||||
end
|
||||
|
||||
env[:discourse_public_url] = node['akkounts']['discourse']['public_url']
|
||||
env[:discourse_connect_secret] = credentials['discourse_connect_secret']
|
||||
|
||||
if lndhub_host
|
||||
node.override["akkounts"]["lndhub"]["api_url"] = "http://#{lndhub_host}:3026"
|
||||
env[:lndhub_legacy_api_url] = node["akkounts"]["lndhub"]["api_url"]
|
||||
|
||||
@@ -27,6 +27,7 @@ server {
|
||||
proxy_buffers 1024 8k;
|
||||
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
|
||||
proxy_pass http://_discourse;
|
||||
proxy_http_version 1.1;
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
node.default['rskj']['version'] = '4.2.0~focal'
|
||||
node.default['rskj']['version'] = '4.4.0~focal'
|
||||
node.default['rskj']['network'] = 'testnet'
|
||||
|
||||
node.default['rskj']['nginx']['domain'] = nil
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
#
|
||||
# Cookbook Name:: kosmos_rsk
|
||||
# Recipe:: nginx
|
||||
#
|
||||
|
||||
include_recipe "kosmos-nginx"
|
||||
|
||||
app_name = "rskj"
|
||||
domain = node[app_name]["nginx"]["domain"]
|
||||
|
||||
nginx_certbot_site domain
|
||||
|
||||
template "#{node['nginx']['dir']}/sites-available/#{domain}" do
|
||||
source "nginx_conf_#{app_name}.erb"
|
||||
owner 'www-data'
|
||||
mode 0640
|
||||
variables app_name: app_name,
|
||||
domain: domain,
|
||||
port: "4444",
|
||||
ssl_cert: "/etc/letsencrypt/live/#{domain}/fullchain.pem",
|
||||
ssl_key: "/etc/letsencrypt/live/#{domain}/privkey.pem"
|
||||
notifies :reload, 'service[nginx]', :delayed
|
||||
end
|
||||
|
||||
nginx_site domain do
|
||||
action :enable
|
||||
end
|
||||
8
site-cookbooks/kosmos_rsk/recipes/nginx_mainnet.rb
Normal file
8
site-cookbooks/kosmos_rsk/recipes/nginx_mainnet.rb
Normal file
@@ -0,0 +1,8 @@
|
||||
#
|
||||
# Cookbook Name:: kosmos_rsk
|
||||
# Recipe:: nginx_mainnet
|
||||
#
|
||||
|
||||
rskj_nginx_site "mainnet" do
|
||||
domain "rsk.kosmos.org"
|
||||
end
|
||||
8
site-cookbooks/kosmos_rsk/recipes/nginx_testnet.rb
Normal file
8
site-cookbooks/kosmos_rsk/recipes/nginx_testnet.rb
Normal file
@@ -0,0 +1,8 @@
|
||||
#
|
||||
# Cookbook Name:: kosmos_rsk
|
||||
# Recipe:: nginx_testnet
|
||||
#
|
||||
|
||||
rskj_nginx_site "testnet" do
|
||||
domain "rsk-testnet.kosmos.org"
|
||||
end
|
||||
37
site-cookbooks/kosmos_rsk/resources/nginx_site.rb
Normal file
37
site-cookbooks/kosmos_rsk/resources/nginx_site.rb
Normal file
@@ -0,0 +1,37 @@
|
||||
resource_name :rskj_nginx_site
|
||||
provides :rskj_nginx_site
|
||||
|
||||
property :network, String, required: true, name_property: true
|
||||
property :domain, String, required: true
|
||||
|
||||
action :create do
|
||||
include_recipe "kosmos-nginx"
|
||||
|
||||
network = new_resource.network
|
||||
domain = new_resource.domain
|
||||
|
||||
nginx_certbot_site domain
|
||||
|
||||
upstream_hosts = []
|
||||
search(:node, "role:rskj_#{network}").each do |node|
|
||||
upstream_hosts << node["knife_zero"]["host"]
|
||||
end
|
||||
upstream_hosts.push("localhost") if upstream_hosts.empty?
|
||||
|
||||
template "#{node['nginx']['dir']}/sites-available/#{domain}" do
|
||||
source "nginx_conf_rskj.erb"
|
||||
owner 'www-data'
|
||||
mode 0640
|
||||
variables domain: domain,
|
||||
upstream_name: "rskj_#{network}",
|
||||
upstream_hosts: upstream_hosts,
|
||||
upstream_port: "4444",
|
||||
ssl_cert: "/etc/letsencrypt/live/#{domain}/fullchain.pem",
|
||||
ssl_key: "/etc/letsencrypt/live/#{domain}/privkey.pem"
|
||||
notifies :reload, 'service[nginx]', :delayed
|
||||
end
|
||||
|
||||
nginx_site domain do
|
||||
action :enable
|
||||
end
|
||||
end
|
||||
@@ -1,23 +1,39 @@
|
||||
# Generated by Chef
|
||||
<% if File.exist?(@ssl_cert) && File.exist?(@ssl_key) -%>
|
||||
upstream _<%= @upstream_name %> {
|
||||
<% @upstream_hosts.each do |host| %>
|
||||
server <%= host %>:<%= @upstream_port %>;
|
||||
<% end %>
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
add_header Strict-Transport-Security "max-age=15768000";
|
||||
|
||||
ssl_certificate <%= @ssl_cert %>;
|
||||
ssl_certificate_key <%= @ssl_key %>;
|
||||
|
||||
server_name <%= @domain %>;
|
||||
|
||||
add_header Strict-Transport-Security "max-age=15768000";
|
||||
|
||||
access_log <%= node[:nginx][:log_dir] %>/<%= @domain %>.access.log json;
|
||||
error_log <%= node[:nginx][:log_dir] %>/<%= @domain %>.error.log warn;
|
||||
|
||||
location / {
|
||||
if ($request_method = 'OPTIONS') {
|
||||
add_header 'Access-Control-Allow-Origin' '*';
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
|
||||
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
|
||||
add_header 'Access-Control-Max-Age' 1209600;
|
||||
add_header 'Content-Type' 'text/plain; charset=utf-8';
|
||||
add_header 'Content-Length' 0;
|
||||
return 204;
|
||||
}
|
||||
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_redirect off;
|
||||
proxy_pass http://localhost:<%= @port %>;
|
||||
proxy_pass http://_<%= @upstream_name %>;
|
||||
}
|
||||
|
||||
ssl_certificate <%= @ssl_cert %>;
|
||||
ssl_certificate_key <%= @ssl_key %>;
|
||||
}
|
||||
<% end -%>
|
||||
|
||||
@@ -9,7 +9,7 @@ end
|
||||
|
||||
describe package('rskj') do
|
||||
it { should be_installed }
|
||||
its('version') { should eq '4.2.0~focal' }
|
||||
its('version') { should eq '4.4.0~focal' }
|
||||
end
|
||||
|
||||
describe service('rsk') do
|
||||
@@ -21,3 +21,10 @@ end
|
||||
describe port(4444) do
|
||||
it { should be_listening }
|
||||
end
|
||||
|
||||
describe parse_config_file('/etc/rsk/node.conf', {
|
||||
assignment_regex: /^\s*([^=]*?)\s*=\s*(.*?)\s*$/
|
||||
}) do
|
||||
its(['blockchain.config.name']) { should eq '"testnet"' }
|
||||
its(['database.dir']) { should eq '/var/lib/rsk/database/testnet' }
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user