Merge branch 'master' into feature/535-liquor_cabinet

This commit is contained in:
2024-01-26 08:19:50 +03:00
12 changed files with 111 additions and 36 deletions

View File

@@ -11,6 +11,8 @@ node.default['akkounts']['smtp']['domain'] = 'kosmos.org'
node.default['akkounts']['smtp']['auth_method'] = 'plain'
node.default['akkounts']['smtp']['enable_starttls'] = 'auto'
node.default['akkounts']['btcpay']['store_id'] = nil
node.default['akkounts']['ejabberd']['admin_url'] = nil
node.default['akkounts']['lndhub']['api_url'] = nil

View File

@@ -20,6 +20,7 @@ user deploy_user do
end
package "libpq-dev"
package "libvips"
include_recipe 'redisio::default'
include_recipe 'redisio::enable'
@@ -70,6 +71,8 @@ end
if btcpay_host
env[:btcpay_api_url] = "http://#{btcpay_host}:23001/api/v1"
env[:btcpay_store_id] = node['akkounts']['btcpay']['store_id']
env[:btcpay_auth_token] = credentials["btcpay_auth_token"]
end
env[:discourse_public_url] = "https://#{node['discourse']['domain']}"
@@ -104,6 +107,7 @@ if lndhub_host
node.override["akkounts"]["lndhub"]["api_url"] = "http://#{lndhub_host}:3026"
env[:lndhub_legacy_api_url] = node["akkounts"]["lndhub"]["api_url"]
env[:lndhub_api_url] = node["akkounts"]["lndhub"]["api_url"]
env[:lndhub_admin_token] = credentials["lndhub_admin_token"]
env[:lndhub_public_url] = node["akkounts"]["lndhub"]["public_url"]
env[:lndhub_public_key] = node["akkounts"]["lndhub"]["public_key"]
if postgres_readonly_host

View File

@@ -18,7 +18,7 @@ server {
access_log <%= node[:openresty][:log_dir] %>/<%= @domain %>.access.log json;
error_log <%= node[:openresty][:log_dir] %>/<%= @domain %>.error.log warn;
location /kredits/ {
location / {
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Methods' 'GET' always;
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always;
@@ -31,6 +31,6 @@ server {
proxy_buffers 1024 8k;
proxy_http_version 1.1;
proxy_pass http://_akkounts_api/api/kredits/;
proxy_pass http://_akkounts_api/api/;
}
}

View File

@@ -0,0 +1,11 @@
#
# Cookbook Name:: kosmos_redis
# Recipe:: backup
#
databases = node['redisio']['servers'].map do |server, _|
"dump-#{server['port']}"
end
node.override["backup"]["redis"]["databases"] = databases
include_recipe "backup"

View File

@@ -3,16 +3,10 @@
# Recipe:: default
#
node.normal['redisio']['servers'] = [{
'port' => '6379',
'protected_mode' => 'no'
}]
include_recipe 'redisio::default'
include_recipe 'redisio::enable'
unless node.chef_environment == "development"
include_recipe "kosmos_redis::firewall"
# Backup the databases to S3
databases = node['redisio']['servers'].map do |server, _|
"dump-#{server['port']}"
end
node.override["backup"]["redis"]["databases"] = databases
include_recipe "backup"
end

View File

@@ -0,0 +1,19 @@
#
# Cookbook Name:: kosmos_redis
# Recipe:: replica
#
primary_host = search(:node, 'role:redis_server').first['knife_zero']['host'] rescue nil
if primary_host.nil?
Chef::Log.warn("No node found with 'redis_server' role. Stopping here.")
return
end
node.normal['redisio']['servers'] = [{
'port' => '6379',
'replicaof' => { 'address' => primary_host, 'port' => '6379' }
}]
include_recipe 'redisio::default'
include_recipe 'redisio::enable'