Class: Kaiser::Databases::Mysql
- Inherits:
-
Object
- Object
- Kaiser::Databases::Mysql
- Defined in:
- lib/kaiser/databases/mysql.rb
Instance Method Summary collapse
- #image_name ⇒ Object
-
#initialize(options) ⇒ Mysql
constructor
A new instance of Mysql.
- #options_hash ⇒ Object
Constructor Details
#initialize(options) ⇒ Mysql
Returns a new instance of Mysql.
6 7 8 |
# File 'lib/kaiser/databases/mysql.rb', line 6 def initialize() @options = end |
Instance Method Details
#image_name ⇒ Object
39 40 41 42 |
# File 'lib/kaiser/databases/mysql.rb', line 39 def image_name version = @options[:version] || '5.6' "mysql:#{version}" end |
#options_hash ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/kaiser/databases/mysql.rb', line 10 def testpass = @options[:root_password] || 'testpassword' parameters = @options[:parameters] || '' port = @options[:port] || 3306 { port: port, data_dir: '/var/lib/mysql', params: "-e MYSQL_ROOT_PASSWORD=#{testpass}", commands: parameters, waitscript_params: " -e MYSQL_ADDR=<%= db_container_name %> -e MYSQL_PORT=#{port} -e MYSQL_ROOT_PASSWORD=#{testpass}", waitscript: <<~SCRIPT #!/bin/bash echo "Waiting for mysql to start." until mysql -h"$MYSQL_ADDR" -P"$MYSQL_PORT" -uroot -p"$MYSQL_ROOT_PASSWORD" -e "SELECT 1" do printf "." sleep 1 done echo -e "\nmysql started." SCRIPT } end |