Class: DanarchyDeploy::Services::MySQL::NewServer
- Inherits:
-
Object
- Object
- DanarchyDeploy::Services::MySQL::NewServer
- Defined in:
- lib/danarchy_deploy/services/mysql/new_server.rb
Class Method Summary collapse
- .centos_new_mysql(mysql, options) ⇒ Object
- .debian_new_mysql(mysql, options) ⇒ Object
- .generate_root_mycnf(mysql, options) ⇒ Object
- .gentoo_new_mysql(mysql, options) ⇒ Object
- .new(os, mysql, options) ⇒ Object
- .opensuse_new_mysql(mysql, options) ⇒ Object
Class Method Details
.centos_new_mysql(mysql, options) ⇒ Object
42 43 44 45 |
# File 'lib/danarchy_deploy/services/mysql/new_server.rb', line 42 def self.centos_new_mysql(mysql, ) puts " ! CentOS/Redhat MySQL configuration not yet implemented!" end |
.debian_new_mysql(mysql, options) ⇒ Object
38 39 40 |
# File 'lib/danarchy_deploy/services/mysql/new_server.rb', line 38 def self.debian_new_mysql(mysql, ) puts " ! Debian/Ubuntu MySQL configuration not yet implemented!" end |
.generate_root_mycnf(mysql, options) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/danarchy_deploy/services/mysql/new_server.rb', line 51 def self.generate_root_mycnf(mysql, ) return if File.exist?(mysql[:default_file]) puts " |+ Generating #{mysql[:default_file]} file." password = SecureRandom.base64(14) source = [:deploy_dir] + '/templates/services/mysql/root_my.cnf.erb' templates = [{ target: mysql[:default_file], source: source, variables: { host: 'localhost', user: 'root', pass: password, port: '3306' } }] DanarchyDeploy::Templater.new(templates, ) end |
.gentoo_new_mysql(mysql, options) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/danarchy_deploy/services/mysql/new_server.rb', line 22 def self.gentoo_new_mysql(mysql, ) puts "\n > Performing first time MySQL configuration." cmd = 'emerge --config mariadb' config_result = DanarchyDeploy::Helpers.run_command(cmd, ) if config_result[:stderr] abort(' |! ERROR: Failed to configure MySQL') else config_result[:stdout] puts " |+ MySQL configured successfully" puts config_result[:stdout] end puts "\n > Starting MySQL." DanarchyDeploy::Services::Init.init_manager('gentoo', 'mysql', 'start', ) end |
.new(os, mysql, options) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/danarchy_deploy/services/mysql/new_server.rb', line 6 def self.new(os, mysql, ) self.generate_root_mycnf(mysql, ) if os == 'gentoo' self.gentoo_new_mysql(mysql, ) elsif os == 'opensuse' self.opensuse_new_mysql(mysql, ) elsif %w[debian ubuntu].include?(os) self.debian_new_mysql(mysql, ) elsif %w[centos redhat].include?(os) self.centos_new_mysql(mysql, ) end end |
.opensuse_new_mysql(mysql, options) ⇒ Object
47 48 49 |
# File 'lib/danarchy_deploy/services/mysql/new_server.rb', line 47 def self.opensuse_new_mysql(mysql, ) puts " ! OpenSUSE MySQL configuration not yet implemented!" end |