summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Gemfile3
-rw-r--r--Gemfile.lock5
-rw-r--r--app/models/gs5_backup.rb53
-rw-r--r--config/backup.rb32
4 files changed, 93 insertions, 0 deletions
diff --git a/Gemfile b/Gemfile
index f65e118..58523e1 100644
--- a/Gemfile
+++ b/Gemfile
@@ -79,6 +79,9 @@ gem 'unicorn'
gem 'thin'
+# Backup https://github.com/meskyanichi/backup
+gem 'backup'
+
# Local Variables:
# mode: ruby
# End:
diff --git a/Gemfile.lock b/Gemfile.lock
index 6bb234f..64b9f6f 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -31,6 +31,9 @@ GEM
acts_as_list (0.1.9)
addressable (2.3.2)
arel (3.0.2)
+ backup (3.0.27)
+ open4 (~> 1.3.0)
+ thor (>= 0.15.4, < 2)
bcrypt-ruby (3.0.1)
better_errors (0.3.2)
coderay (>= 1.0.0)
@@ -119,6 +122,7 @@ GEM
multi_json (1.5.0)
mysql2 (0.3.11)
nokogiri (1.5.6)
+ open4 (1.3.0)
polyglot (0.3.3)
private_pub (1.0.3)
faye
@@ -201,6 +205,7 @@ PLATFORMS
DEPENDENCIES
acts_as_list
+ backup
bcrypt-ruby
better_errors
binding_of_caller
diff --git a/app/models/gs5_backup.rb b/app/models/gs5_backup.rb
new file mode 100644
index 0000000..928245f
--- /dev/null
+++ b/app/models/gs5_backup.rb
@@ -0,0 +1,53 @@
+# encoding: utf-8
+
+##
+# Backup Generated: gs5_backup
+# Once configured, you can run the backup with the following command:
+#
+# $ backup perform -t gs5_backup [-c <path_to_configuration_file>]
+#
+Backup::Model.new(:gs5_backup, 'GS5 backup') do
+ ##
+ # Split [Splitter]
+ #
+ # Split the backup file in to chunks of 250 megabytes
+ # if the backup file size exceeds 250 megabytes
+ #
+ split_into_chunks_of 640
+
+ ##
+ # MySQL [Database]
+ #
+ database MySQL do |db|
+ # To dump all databases, set `db.name = :all` (or leave blank)
+ db.name = system_odbc_configuration['gemeinschaft']['DATABASE']
+ db.username = system_odbc_configuration['gemeinschaft']['USER']
+ db.password = system_odbc_configuration['gemeinschaft']['PASSWORD']
+ db.host = "localhost"
+ db.port = 3306
+ db.socket = "/tmp/mysql.sock"
+ # Note: when using `skip_tables` with the `db.name = :all` option,
+ # table names should be prefixed with a database name.
+ # e.g. ["db_name.table_to_skip", ...]
+ db.skip_tables = ["skip", "these", "tables"]
+ db.only_tables = ["only", "these" "tables"]
+ db.additional_options = ["--quick", "--single-transaction"]
+ # Optional: Use to set the location of this utility
+ # if it cannot be found by name in your $PATH
+ # db.mysqldump_utility = "/opt/local/bin/mysqldump"
+ end
+
+ ##
+ # Local (Copy) [Storage]
+ #
+ store_with Local do |local|
+ local.path = "/var/backups/gs5"
+ local.keep = 5
+ end
+
+ ##
+ # Gzip [Compressor]
+ #
+ compress_with Gzip
+
+end
diff --git a/config/backup.rb b/config/backup.rb
new file mode 100644
index 0000000..a7d98c3
--- /dev/null
+++ b/config/backup.rb
@@ -0,0 +1,32 @@
+# encoding: utf-8
+
+##
+# Backup
+# Generated Main Config Template
+#
+# For more information:
+#
+# View the Git repository at https://github.com/meskyanichi/backup
+# View the Wiki/Documentation at https://github.com/meskyanichi/backup/wiki
+# View the issue log at https://github.com/meskyanichi/backup/issues
+
+##
+# Global Configuration
+# Add more (or remove) global configuration below
+#
+# Backup::Storage::S3.defaults do |s3|
+# s3.access_key_id = "my_access_key_id"
+# s3.secret_access_key = "my_secret_access_key"
+# end
+#
+# Backup::Encryptor::OpenSSL.defaults do |encryption|
+# encryption.password = "my_password"
+# encryption.base64 = true
+# encryption.salt = true
+# end
+
+##
+# Load all models from the models directory (after the above global configuration blocks)
+Dir[File.join(File.dirname(Config.config_file), "models", "*.rb")].each do |model|
+ instance_eval(File.read(model))
+end