Skip to content

Instantly share code, notes, and snippets.

@cixelsyd
Created December 17, 2011 20:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cixelsyd/1491326 to your computer and use it in GitHub Desktop.
Save cixelsyd/1491326 to your computer and use it in GitHub Desktop.
"backupdb.rb" is the main recipe inside of a larger "backupdb" role
#
# Cookbook Name:: smashrun
# Attributes:: backupdb
#
# Copyright 2010, Smashrun, Inc.
# Author:: Steven Craig <support@smashrun.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# for reference, this is an example of the JSON inside my chef-server data bags:
# inside databag running_database:
# {"id":"SERVERHOSTNAME","database":"database1,database2,databaseN,master,msdb"}
#
# inside databag database_info:
# {"comment":"main website database","datadrive":"d:","restoredir":"\\MSSQL\\Restore","backupdir":"\\MSSQL\\Backup","transdrive":"e:","transfile":"database1_log.ldf","transinitsize":"256MB","datainitsize":"256MB","datadir":"\\MSSQL\\Data","id":"database1","datamaxsize":"10GB","datafile":"database1.mdf","transmaxsize":"10GB","collation":"SQL_Latin1_General_CP1_CI_AS","transdir":"\\MSSQL\\Logs","restoredrive":"d:","backupdrive":"d:","owner":"development"}
include_attribute "smashrun::createdb"
include_attribute "smashrun::build"
include_attribute "smashrun::store"
include_attribute "smashrun::deploy"
include_attribute "windows::sevenzip"
include_attribute "windows::putty"
include_attribute "windows::deltacopy"
# these are standard
default[:backupdb][:author_name] = "#{node[:createdb][:author_name]}"
default[:backupdb][:author_email] = "#{node[:createdb][:author_email]}"
default[:backupdb][:tempdir] = "#{node[:createdb][:tempdir]}"
# templated backupdb rules payload file
default[:backupdb][:basesql] = "backup.sql"
default[:backupdb][:baselog] = "backup.log"
default[:backupdb][:sqlscripts] = "#{node[:createdb][:sqlscripts]}"
default[:backupdb][:backupdir] = "#{node[:createdb][:backupdir]}"
# do not change: risky
default[:backupdb][:tag] = "#{node[:deploy][:tag]}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment