cookbook 'flywaydb', '= 1.0.0', :supermarket
flywaydb
(28) Versions
1.0.0
-
Follow2
Installs and configures flywaydb database migration tool
cookbook 'flywaydb', '= 1.0.0'
knife cookbook site install flywaydb
knife cookbook site download flywaydb
Flywaydb Cookbook
Installs flywaydb and allows for execution of flyway commands via recipe or resource actions.
Requirements
- Chef 11+
Platforms
- CentOS/RedHat
- Debian/Ubuntu
- Windows
Usage
Recipes
Include migrate, info, validate, baseline, or repair recipe in cookbook or run list to install flywaydb and execute associated flyway command.
Attributes
node['flywaydb']['conf']
- A hash or array of hashes used to create the default Configuration file(s) for the flyway conf file. Key values automatically get prefixed with flyway. This attribute will be ignored ifext_conf
is set.node['flywaydb']['ext_conf']
- Path or array of paths to external Configuration file(s). Theconf
attribute will be ignored if this is set.node['flywaydb']['params']
- A hash of command-line parameters to pass to flyway command. Command-line parameters override Configuration files.node['flywaydb']['name']
- The name of the flyway conf file. Defaultflyway
.node['flywaydb']['debug']
- Print debug output during execution of flyway commands. Defaultfalse
.node['flywaydb']['sensitive']
- Ensure that sensitive resource data is not logged by the chef-client. Defaultfalse
.node['flywaydb']['version']
- The flywaydb version to install. Default3.2.1
.node['flywaydb']['sha256']
- The flywaydb SHA 256 checksum for linux or windows platform.node['flywaydb']['install_dir']
- The base install directory. Default linux:/opt/flyway
windows:C:\flyway
.node['flywaydb']['user']
- The owner of flywaydb. Defaultflyway
.node['flywaydb']['group']
- The group of flywaydb. Defaultflyway
.
Examples
Single flyway conf migration
{
"run_list": [
"recipe[flywaydb::migrate]"
],
"flywaydb": {
"conf": {
"url": "jdbc:mysql/localhost/mydb",
"user": "root",
"password": "changeme",
"locations": "filesystem:/opt/myapp/db/migration"
}
}
}
Multiple flyway conf migrations with command-line parameters
{
"run_list": [
"recipe[flywaydb::migrate]"
],
"flywaydb": {
"params": {
"user": "root",
"password": "changeme",
"url": "jdbc:mysql/localhost/mysql"
},
"conf": [
{
"schemas": "custA",
"locations": "filesystem:/opt/myapp/db/migration/core,/opt/myapp/db/migration/custA"
},
{
"schemas": "custB",
"locations": "filesystem:/opt/myapp/db/migration/core,/opt/myapp/db/migration/custA"
}
]
}
}
Multiple flyway ext_conf migrations with command-line parameters
{
"run_list": [
"recipe[flywaydb::migrate]"
],
"flywaydb": {
"params": {
"user": "root",
"password": "changeme",
"url": "jdbc:mysql/localhost/mysql"
},
"ext_conf": [
"/opt/myapp/custA.properties",
"/opt/myapp/custB.properties"
]
}
}
Resources
Use migrate, info, validate, baseline, or repair actions to install flywaydb and execute associated flyway command.
Attributes
conf
A hash or array of hashes used to create the default Configuration file(s) for the flyway conf file. Key values automatically get prefixed with flyway. This attribute will be ignored ifext_conf
is set.ext_conf
- Path or array of paths to external Configuration file(s). Theconf
attribute will be ignored if this is set.params
- A hash of command-line parameters to pass to flyway command. Command-line parameters override Configuration files.name
- The name of the flyway conf file. Defaults to resource name.debug
- Print debug output during execution of flyway commands. Defaultfalse
.sensitive
- Ensure that sensitive resource data is not logged by the chef-client. Defaultfalse
.
Examples
Single flyway conf migration
flywaydb 'myapp' do
conf({
url: 'jdbc:mysql/localhost/mydb',
user: 'root',
password: 'changeme',
locations: 'filesystem:/opt/myapp/db/migration'
})
action :migrate
end
Multiple flyway conf migrations with command-line parameters
flywaydb 'myapp' do
params({
user: 'root',
password: 'changeme',
url: 'jdbc:mysql/localhost/mysql'
})
conf([
{
schemas: 'custA',
locations: 'filesystem:/opt/myapp/db/migration/core,/opt/myapp/db/migration/custA'
},
{
schemas: 'custB',
locations: 'filesystem:/opt/myapp/db/migration/core,/opt/myapp/db/migration/custB'
}
])
action :migrate
end
Multiple flyway ext_conf migrations with command-line parameters
flywaydb 'myapp' do
params({
user: 'root',
password: 'changeme',
url: 'jdbc:mysql/localhost/mysql'
})
ext_conf([
'/opt/myapp/custA.properties',
'/opt/myapp/custB.properties'
])
action :migrate
end
ChefSpec Matchers
This cookbook includes custom ChefSpec matchers you can use to test your own cookbooks.
Example Matcher Usage
expect(chef_run).to migrate_flywaydb('flyway').with(
params: {
'user' => 'mysql',
'password' => 'mysql',
'url' => 'jdbc:mysql://localhost/mysql'
}
conf: [
{
'schemas' => 'custA',
'locations' => 'filesystem:/opt/myapp/db/migration/core,/opt/myapp/db/migration/custA'
},
{
'schemas' => 'custB',
'locations' => 'filesystem:/opt/myapp/db/migration/core,/opt/myapp/db/migration/custB'
}
],
debug: false,
sensitive: false
)
Cookbook Matchers
- migrate_flywaydb(resource_name)
- clean_flywaydb(resource_name)
- baseline_flywaydb(resource_name)
- info_flywaydb(resource_name)
- repair_flywaydb(resource_name)
- validate_flywaydb(resource_name)
Getting Help
- Ask specific questions on Stack Overflow.
- Report bugs and discuss potential features in Github issues.
Contributing
Please refer to CONTRIBUTING.
License
MIT - see the accompanying LICENSE file for details.
Dependent cookbooks
This cookbook has no specified dependencies.
Contingent cookbooks
There are no cookbooks that are contingent upon this one.
CHANGELOG
1.0.0 - 2015/02/04
- Initial release
Foodcritic Metric
1.0.0 passed this metric
1.0.0 passed this metric