Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

Select Status

RSS

flywaydb (30) Versions 7.3.1

Installs and configures flywaydb database migration tool

Policyfile
Berkshelf
Knife
cookbook 'flywaydb', '~> 7.3.1', :supermarket
cookbook 'flywaydb', '~> 7.3.1'
knife supermarket install flywaydb
knife supermarket download flywaydb
README
Dependencies
Changelog
Quality 50%

Flywaydb Cookbook

Cookbook Version
linux
win

Installs flywaydb and allows for execution of flyway commands via resource
actions.

Connector/J Drivers

  • To use a MariaDB Connector/J driver version other than the one that ships with flywaydb, set node['flywaydb']['mariadb']['version'] attribute to version desired.
  • To use MySQL Connector/J driver instead of MariaDB Connector/J driver for jdbc:mysql: connections, set mysql_driver attribute to true.

Requirements

  • Chef 11+

Platforms

  • CentOS/RedHat
  • Debian/Ubuntu
  • Windows

Usage

Use migrate, info, validate, baseline, or repair actions to install
flywaydb (if not installed) and execute associated flyway command.
An install action is also available if you just want to install
flywaydb but not execute any flyway commands.

Attributes

  • flyway_conf - Configuration path or settings to copy or create conf/flyway.conf. The flyway.conf file will be regenerated for each flywaydb execution and will be blanked out if flyway_conf is nil to prevent alt_conf from inadvertently inheriting its settings. Settings in alt_conf override settings in flyway.conf. Settings in parameters override all settings. Default: nil.
  • alt_conf - Alternative configuration path or settings. An array containing paths and/or settings is also supported. Each path and settings are written as conf/#{name}[_#{i + 1}].conf where name is the resource name and i is the index in array. Each item in array will result in an independent execution of Flyway. Settings in alt_conf override settings in flyway.conf. Settings in parameters override all settings. Default: nil.
  • parameters - Command-line parameters to pass to flyway command. Settings in parameters override all settings. Default: {}.
  • mysql_driver - MariaDB Connector/J driver is the default driver for jdbc:mysql: connections. Set to true to download and install MySQL Connector/J driver under drivers directory. This will then become the default driver for jdbc:mysql: connections. Default: false.
  • name - Name of the alternative conf file when alt_conf is defined. Defaults to resource block name.
  • install_dir - The base install directory. Default Linux: /opt/flywaydb Windows: #{ENV['SYSTEMDRIVE']}/flywaydb.
  • debug - Print debug output during execution of flyway commands. Default: false.
  • user - The owner of flywaydb. Creates a flyway user when nil or uses value passed in. Default nil.
  • group - The group of flywaydb. Creates flyway or modifies Administrators group when nil (or set to Administrators on Windows for backwards compatibility) or uses value passed in. Default nil.
  • password - Required only on Windows Servers that throw 'The password does not meet the password policy requirements.' error when creating flyway user. Default: nil.
  • sensitive - Suppress logging the Flyway command executed to hide sensitive information but still log Flyway stdout and stderr to Chef-client. Writing of conf files will also be suppressed when executing with Chef-client versions that support sensitive. Default: true.
  • timeout - Number of seconds to wait on flyway process before raising an Exception. Default: 259_200 (72hrs).

Examples

Single migration using settings

flywaydb 'myapp' do
  flyway_conf(
    url: 'jdbc:mysql//localhost/mydb',
    user: 'root',
    locations: 'filesystem:/opt/myapp/db/migration',
    cleanDisabled: true
  )
  action :migrate
end

Single migration using file path

flywaydb 'myapp' do
  flyway_conf(
    '/opt/myapp/db/flyway.conf'
  )
  action :migrate
end

Multiple migrations using settings

flywaydb 'myapp' do
  flyway_conf(
    user: 'root',
    url: 'jdbc:mysql//localhost/mysql'
  )
  alt_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'
    }
  ])
  parameters(
    password: password   
  )
  action :migrate
end

Multiple migrations using file paths

flywaydb 'myapp' do
  flyway_conf(
    '/opt/myapp/db/flyway.conf'
  )
  alt_conf([
    '/opt/myapp/db/custA.conf',
    '/opt/myapp/db/custB.conf'
  ])
  parameters(
    password: password   
  )
  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(
  flyway_conf: {
      'user' => 'root',
      'url' => 'jdbc:mysql://localhost/mysql'
  }
  alt_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'
    }
  ],
  parameters: {
      'password' => 'password'
  }
  debug: false,
  sensitive: true
)

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)
  • install_flywaydb(resource_name)

Getting Help

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

7.3.1 2018-12-03

  • Use Flyway 5.2.3

7.3.0 2018-11-12

  • Use Flyway 5.2.1 and remove warning for configFile

7.2.0 2018-03-18

  • Use Flyway 5.0.7

7.1.1 2017-08-15

  • Add respond_to? conditional to metadata chef version

7.1.0 2017-08-14

  • Use Flyway 4.2.0
  • Set MySQl driver to 5.1.43
  • Use cookstyle for unit testing

7.0.0 2017-04-01

  • Rename params attribute to parameters to be Chef 13 compatible
  • Use Flyway 4.1.2
  • Set MySQl driver to 5.1.41

6.1.0 2017-02-10

  • Use Flyway 4.1.1
  • Set MySQl driver to 5.1.40

6.0.0 2016-08-23

  • Append flywaydb directory to install directory e.g., /opt is now /opt/flywaydb
  • Fix #30 Make flyway executable

5.6.0 2016-08-03

  • Use Flyway 4.0.3

5.5.2 2016-07-22

  • Fix #27 Missing parameter 'run' in recursive process_conf call

5.5.1 2016-07-15

  • Fix #25 Do not create a user/group when passing in values

5.5.0 2016-06-08

  • Use Flyway 4.0.2
  • Set MariaDB driver version to nil to use the MariaDB Connector/J driver that ships with flywaydb

5.4.0 2016-05-30

  • Set MariaDB driver version to 1.4.5
  • Set MySQL driver version to 5.1.39

5.3.0 2016-05-22

  • Add timeout option that defaults to 72hrs

5.2.1 2016-05-16

  • Fix #20 MySQL driver missing when new version of flyway installed

5.2.0 2016-05-10

  • Use Flyway 4.0.1

5.1.2 2016-05-06

  • Fix #19 Cannot symlink flyway directory if older version of flywaydb cookbook ran previously
  • Fix #18 MySQL driver should overwrite the old one
  • Fix #17 System Error Message: Access is denied

5.1.1 2016-05-05

  • Fix #16 Chef::Exceptions::NoSuchResourceType
  • Fix #15 Flyway should automatically update if the version changes

5.1.0 2016-05-02

  • Fix #13 Flyway 4.0 commandline creates empty metadata table

5.0.2 2016-04-21

  • Fix #12 Blank flyway.conf if flyway_conf nil

5.0.1 2016-04-19

  • Fix #9 Extracting to flyway-4.0 on windows

5.0.0 2016-04-15

  • Add flyway_conf attribute
  • Add alt_conf attribute
  • Remove conf and ext_conf attributes

4.1.0 2016-04-14

  • Fix #6 Suppress the command that was executed to hide sensitive information but still log stdout and stderr

4.0.1 2016-04-12

  • Include default recipe in provide only if required

4.0.0 2016-03-24

  • Fix #4 Quote param values to avoid interpretation by the shell

3.1.0 2016-03-09

  • Use Flyway 4.0

3.0.1 2016-03-08

  • Fix #3 sensitive not defaulting to true
  • Fix clean action

3.0.0 2016-02-20

  • Remove global attributes ext_conf, conf, params, sensitive, and debug
  • Default sensitive to true

2.0.0 2016-02-10

  • Remove command recipes

1.0.0 2016-02-04

  • Initial release

Collaborator Number Metric
            

7.3.1 passed this metric

Contributing File Metric
            

7.3.1 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file

Foodcritic Metric
            

7.3.1 passed this metric

No Binaries Metric
            

7.3.1 passed this metric

Testing File Metric
            

7.3.1 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file

Version Tag Metric
            

7.3.1 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number