diff --git a/nodes/mastodon-3.json b/nodes/mastodon-3.json index bfcb43c..7084da1 100644 --- a/nodes/mastodon-3.json +++ b/nodes/mastodon-3.json @@ -24,6 +24,7 @@ "kosmos-mastodon", "kosmos-mastodon::default", "kosmos-mastodon::nginx", + "kosmos-mastodon::backup", "apt::default", "timezone_iii::default", "timezone_iii::debian", @@ -67,6 +68,9 @@ "nginx::commons_conf", "kosmos-nginx::firewall", "tor-full::default", + "backup::default", + "logrotate::default", + "poise-git::default", "git::default", "git::package", "kosmos-base::letsencrypt" diff --git a/roles/mastodon.rb b/roles/mastodon.rb index f1064c4..a69e384 100644 --- a/roles/mastodon.rb +++ b/roles/mastodon.rb @@ -4,4 +4,5 @@ run_list %w( role[postgresql_client] kosmos-mastodon kosmos-mastodon::nginx + kosmos-mastodon::backup ) diff --git a/site-cookbooks/kosmos-mastodon/recipes/backup.rb b/site-cookbooks/kosmos-mastodon/recipes/backup.rb new file mode 100644 index 0000000..46bb664 --- /dev/null +++ b/site-cookbooks/kosmos-mastodon/recipes/backup.rb @@ -0,0 +1,18 @@ +# +# Cookbook Name:: kosmos-mastodon +# Recipe:: backup +# + +postgresql_data_bag_item = data_bag_item('credentials', 'postgresql') + +unless node.chef_environment == "development" + unless node["backup"]["postgresql"]["databases"].keys.include? 'mastodon' + node.override["backup"]["postgresql"]["host"] = "pg.kosmos.local" + node.override["backup"]["postgresql"]["databases"]["mastodon"] = { + username: "mastodon", + password: postgresql_data_bag_item['mastodon_user_password'] + } + end + + include_recipe "backup" +end diff --git a/site-cookbooks/kosmos-mastodon/recipes/pg_db.rb b/site-cookbooks/kosmos-mastodon/recipes/pg_db.rb index af15e80..563a356 100644 --- a/site-cookbooks/kosmos-mastodon/recipes/pg_db.rb +++ b/site-cookbooks/kosmos-mastodon/recipes/pg_db.rb @@ -14,18 +14,3 @@ postgresql_database 'mastodon' do owner 'mastodon' action :create end - -# -# Backup -# - -unless node.chef_environment == "development" - unless node["backup"]["postgresql"]["databases"].keys.include? 'mastodon' - node.override["backup"]["postgresql"]["databases"]["mastodon"] = { - username: "mastodon", - password: postgresql_data_bag_item['mastodon_user_password'] - } - end - - include_recipe "backup" -end