Skip to content

Commit

Permalink
Merge pull request #168 from engineyard/feature/TEY-140-aurora-pg
Browse files Browse the repository at this point in the history
[TEY-138, TEY-140] Support for Aurora PostgreSQL
  • Loading branch information
jfuechsl authored Mar 16, 2020
2 parents 6ac2a5b + 36f5862 commit c0a74a9
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 56 deletions.
4 changes: 2 additions & 2 deletions cookbooks/app/recipes/prep.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
is_solo = ['solo'].include?(node['dna']['instance_role'])
unless is_solo # for solo leave the db stuff to the db cookbook
case node.engineyard.environment['db_stack_name']
when /postgres/
when /^postgres\d+/, /^aurora-postgresql\d+/
include_recipe "postgresql::default"
when /mysql/, /aurora/, /mariadb/
when /^mysql\d+/, /^aurora\d+/, /^mariadb\d+/
include_recipe "mysql::client"
include_recipe "mysql::user_my.cnf"
when "no_db"
Expand Down
21 changes: 0 additions & 21 deletions cookbooks/ey-lib/libraries/db_log_paths.rb

This file was deleted.

33 changes: 8 additions & 25 deletions cookbooks/ey-lib/libraries/db_type_and_version.rb
Original file line number Diff line number Diff line change
@@ -1,32 +1,15 @@
module RDSHelpers
def db_host_is_rds?
node.engineyard.environment[:db_provider_name] == 'amazon_rds'
end
end

class Chef
class Recipe
# returns the db_type and specific version number
# nil - no database, or unknown database
def db_type_and_version
case node.engineyard.environment['db_stack_name']
when "postgres"
["postgres", "8.3"]
when "postgres9"
["postgres", "9.0"]
when /postgres(\d+)_(.*)/
["postgres", "#{$1}.#{$2}"]
when "mysql"
["mysql", "5.0"]
when /mysql(\d+)_(.*)/
["mysql", "#{$1}.#{$2}"]
else
nil
end
end

def db_host_is_rds?
node.engineyard.environment[:db_provider_name] == 'amazon_rds'
end
include RDSHelpers
end

class Resource
def db_host_is_rds?
node.engineyard.environment[:db_provider_name] == 'amazon_rds'
end
include RDSHelpers
end
end
4 changes: 2 additions & 2 deletions cookbooks/ey-lib/libraries/ey-environment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,9 @@ def db_adapter(app_type)
stack_name = @hash['db_stack_name'].gsub /[^a-z]+/, ''
# see https://tickets.engineyard.com/issue/DATA-66 to understand this
case stack_name
when 'aurora', 'mariadb'
when 'aurora', 'mariadb', 'mysql'
'mysql'
when 'postgres'
when 'postgres', 'aurorapostgresql'
'postgresql'
else
stack_name
Expand Down
8 changes: 4 additions & 4 deletions cookbooks/postgresql/attributes/version.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
case attribute['dna']['engineyard']['environment']['db_stack_name']
when "postgres9_5"
when "postgres9_5", "aurora-postgresql9_5"
default['postgresql']['latest_version'] = '9.5.18'
default['postgresql']['short_version'] = '9.5'
when "postgres9_6"
when "postgres9_6", "aurora-postgresql9_6"
default['postgresql']['latest_version'] = '9.6.14'
default['postgresql']['short_version'] = '9.6'
when "postgres10"
when "postgres10", "aurora-postgresql10"
default['postgresql']['latest_version'] = '10.9'
default['postgresql']['short_version'] = '10'
when "postgres11"
when "postgres11", "aurora-postgresql11"
default['postgresql']['latest_version'] = '11.4'
default['postgresql']['short_version'] = '11'
end
Expand Down
4 changes: 2 additions & 2 deletions cookbooks/util/recipes/prep.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
include_recipe "ey-cron"

case node.engineyard.environment['db_stack_name']
when /postgres/
when /^postgres\d+/, /^aurora-postgresql\d+/
include_recipe "postgresql::default"
when /mysql/, /aurora/, /mariadb/
when /^mysql\d+/, /^aurora\d+/, /^mariadb\d+/
include_recipe "mysql::client"
include_recipe "mysql::user_my.cnf"
when "no_db"
Expand Down

0 comments on commit c0a74a9

Please sign in to comment.