Extract mastodon db backup to its own recipe
This commit is contained in:
parent
4188b2976b
commit
4bfb7d5f5d
@ -24,6 +24,7 @@
|
|||||||
"kosmos-mastodon",
|
"kosmos-mastodon",
|
||||||
"kosmos-mastodon::default",
|
"kosmos-mastodon::default",
|
||||||
"kosmos-mastodon::nginx",
|
"kosmos-mastodon::nginx",
|
||||||
|
"kosmos-mastodon::backup",
|
||||||
"apt::default",
|
"apt::default",
|
||||||
"timezone_iii::default",
|
"timezone_iii::default",
|
||||||
"timezone_iii::debian",
|
"timezone_iii::debian",
|
||||||
@ -67,6 +68,9 @@
|
|||||||
"nginx::commons_conf",
|
"nginx::commons_conf",
|
||||||
"kosmos-nginx::firewall",
|
"kosmos-nginx::firewall",
|
||||||
"tor-full::default",
|
"tor-full::default",
|
||||||
|
"backup::default",
|
||||||
|
"logrotate::default",
|
||||||
|
"poise-git::default",
|
||||||
"git::default",
|
"git::default",
|
||||||
"git::package",
|
"git::package",
|
||||||
"kosmos-base::letsencrypt"
|
"kosmos-base::letsencrypt"
|
||||||
|
@ -4,4 +4,5 @@ run_list %w(
|
|||||||
role[postgresql_client]
|
role[postgresql_client]
|
||||||
kosmos-mastodon
|
kosmos-mastodon
|
||||||
kosmos-mastodon::nginx
|
kosmos-mastodon::nginx
|
||||||
|
kosmos-mastodon::backup
|
||||||
)
|
)
|
||||||
|
18
site-cookbooks/kosmos-mastodon/recipes/backup.rb
Normal file
18
site-cookbooks/kosmos-mastodon/recipes/backup.rb
Normal file
@ -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
|
@ -14,18 +14,3 @@ postgresql_database 'mastodon' do
|
|||||||
owner 'mastodon'
|
owner 'mastodon'
|
||||||
action :create
|
action :create
|
||||||
end
|
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
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user