Fix missing Mastodon/PosgreSQL backups
The backup cookbook was incomplete, and also there was no database configured to be backed up.
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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"] -%>
|
||||
|
||||
@@ -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 = []
|
||||
|
||||
Reference in New Issue
Block a user