Merge branch 'master' into feature/25-ipfs_cluster

This commit is contained in:
Greg Karékinian
2018-10-26 16:46:44 +02:00
12 changed files with 105 additions and 40 deletions

View File

@@ -94,10 +94,11 @@ application schlupp_xmpp_path do
"HUBOT_RSS_HEADER" => "Update:",
"HUBOT_AUTH_ADMIN" => "basti,garret,greg",
"REDIS_URL" => "redis://localhost:6379/5apps_schlupp_xmpp",
"RS_OPS_TOKEN" => schlupp_xmpp_data_bag_item['rs_ops_token'],
"WEBHOOK_TOKEN" => schlupp_xmpp_data_bag_item['webhook_token'],
"AIRTABLE_API_KEY" => schlupp_xmpp_data_bag_item['airtable_api_key'],
"GITHUB_TOKEN" => schlupp_xmpp_data_bag_item['github_token'] }
"GITHUB_TOKEN" => schlupp_xmpp_data_bag_item['github_token'],
"AWS_ACCESS_KEY_ID" => schlupp_xmpp_data_bag_item['aws_access_key_id'],
"AWS_SECRET_ACCESS_KEY" => schlupp_xmpp_data_bag_item['aws_secret_access_key'] }
)
notifies :run, "execute[systemctl daemon-reload]", :delayed

View File

@@ -26,6 +26,11 @@ set_unless["backup"]["mysql"]["databases"] = []
set_unless["backup"]["mysql"]["username"] = "root"
set_unless["backup"]["mysql"]["host"] = "localhost"
# PostgreSQL default settings
set_unless["backup"]["postgresql"]["databases"] = []
set_unless["backup"]["postgresql"]["host"] = "localhost"
set_unless["backup"]["postgresql"]["port"] = 5432
# Redis default settings
set_unless["backup"]["redis"]["databases"] = []
set_unless["backup"]["redis"]["host"] = "localhost"

View File

@@ -17,7 +17,11 @@ KosmosBackup.new(:default, 'default backup') do
<%- end -%>
<%- if node["backup"]["postgresql"] -%>
database PostgreSQL
<%- node["backup"]["postgresql"]["databases"].each do |db_name| -%>
database PostgreSQL, :"<%= db_name.to_sym %>" do |db|
db.name = "<%= db_name %>"
end
<%- end -%>
<%- end -%>
<%- if node["mongodb"] -%>

View File

@@ -45,15 +45,7 @@ Database::MySQL.defaults do |db|
end
<%- end -%>
<%- if node["backup"]["mysql"] -%>
Database::MySQL.defaults do |db|
db.host = "<%= node["backup"]["mysql"]["host"] %>"
db.username = "<%= node["backup"]["mysql"]["username"] %>"
db.password = "<%= node["backup"]["mysql"]["password"] %>"
db.additional_options = ['--quick', '--single-transaction']
end
<%- end -%>
<%- if node["backup"]["redis"] -%>
Database::Redis.defaults do |db|
db.host = "<%= node["backup"]["redis"]["host"] %>"
db.port = 6379
@@ -61,13 +53,14 @@ Database::Redis.defaults do |db|
<%# db.password = "my_password"%>
<%# db.socket = "/tmp/redis.sock"%>
end
<%- end -%>
<%- if node["backup"]["postgresql"] -%>
Database::PostgreSQL.defaults do |db|
db.username = "<%= node["backup"]["postgresql"]["username"] %>"
db.password = "<%= node["backup"]["postgresql"]["password"] %>"
db.host = "<%= node["backup"]["postgresql"]["host"] %>"
db.port = 5432
db.port = "<%= node["backup"]["postgresql"]["port"] %>"
# db.socket = "/var/run/postgresql/.s.PGSQL.5432"
# When dumping all databases, `skip_tables` and `only_tables` are ignored.
db.skip_tables = []

View File

@@ -22,6 +22,12 @@ firewall_rule 'mosh' do
command :allow
end
firewall_rule 'prosody_http_upload' do
port 5281
protocol :tcp
command :allow
end
firewall_rule 'hubot_express_hal8000' do
port 8080
protocol :tcp

View File

@@ -1,5 +1,6 @@
node.default["kosmos-mastodon"]["directory"] = "/opt/mastodon"
node.default["kosmos-mastodon"]["puma_port"] = 3000
node.default["kosmos-mastodon"]["streaming_port"] = 4000
node.default["kosmos-mastodon"]["server_name"] = "kosmos.social"
node.default["kosmos-mastodon"]["redis_url"] = "redis://localhost:6379/1"
node.default["kosmos-mastodon"]["directory"] = "/opt/mastodon"
node.default["kosmos-mastodon"]["puma_port"] = 3000
node.default["kosmos-mastodon"]["streaming_port"] = 4000
node.default["kosmos-mastodon"]["server_name"] = "kosmos.social"
node.default["kosmos-mastodon"]["redis_url"] = "redis://localhost:6379/1"
node.default["kosmos-mastodon"]["sidekiq_threads"] = 25

View File

@@ -154,7 +154,8 @@ application mastodon_path do
source "mastodon-sidekiq.systemd.service.erb"
variables user: user,
app_dir: mastodon_path,
bundle_path: "/opt/ruby_build/builds/#{ruby_version}/bin/bundle"
bundle_path: "/opt/ruby_build/builds/#{ruby_version}/bin/bundle",
sidekiq_threads: node["kosmos-mastodon"]["sidekiq_threads"]
notifies :run, "execute[systemctl daemon-reload]", :delayed
notifies :restart, "service[mastodon-sidekiq]", :delayed
end
@@ -179,10 +180,18 @@ application mastodon_path do
end
end
#
# Backup
#
unless node.chef_environment == "development"
# Backup the database to S3
node.override["backup"]["postgresql"]["host"] = "localhost"
node.override["backup"]["postgresql"]["username"] = "postgres"
node.override["backup"]["postgresql"]["password"] = node['postgresql']['password']['postgres']
unless node["backup"]["postgresql"]["databases"].include? 'mastodon'
node.override["backup"]["postgresql"]["databases"] =
node["backup"]["postgresql"]["databases"].to_a << "mastodon"
end
include_recipe "backup"
end

View File

@@ -10,7 +10,7 @@ WorkingDirectory=<%= @app_dir %>
Environment="RAILS_ENV=production"
Environment="DB_POOL=50"
Environment="LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.1"
ExecStart=<%= @bundle_path %> exec sidekiq -c 5 -q default -q mailers -q pull -q push
ExecStart=<%= @bundle_path %> exec sidekiq -c <%= @sidekiq_threads %> -q default -q mailers -q pull -q push
TimeoutSec=15
Restart=always