Class: Mobilis::MysqlInstance
Instance Method Summary
collapse
#children, #display, #docker_image_name, #generate_build_sh, #git_commit_all, #initialize, #linked_to_rails_project, #links, #name, #options, #parents, #set_links, #type
#append_line, #oblivious_run_command, #run_command, #run_docker, #set_file_contents, #set_second_line, #write_file
Instance Method Details
#child_env_vars ⇒ Object
12
13
14
|
# File 'lib/mobilis/mysql_instance.rb', line 12
def child_env_vars
[ ]
end
|
#data_dir ⇒ Object
28
29
30
|
# File 'lib/mobilis/mysql_instance.rb', line 28
def data_dir
"./data/#{ name }"
end
|
#env_vars ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/mobilis/mysql_instance.rb', line 16
def env_vars
vars = []
if linked_to_rails_project
vars << "MYSQL_DATABASE=#{ linked_to_rails_project.name }_production"
end
vars.concat [
"MYSQL_USER=#{ name }",
"MYSQL_PASSWORD=#{ name }_password",
"MYSQL_RANDOM_ROOT_PASSWORD=true"
]
end
|
#generate ⇒ Object
8
9
10
|
# File 'lib/mobilis/mysql_instance.rb', line 8
def generate
FileUtils.mkdir_p data_dir
end
|
#has_local_build ⇒ Object
32
33
34
|
# File 'lib/mobilis/mysql_instance.rb', line 32
def has_local_build
false
end
|
#password ⇒ Object
44
45
46
|
# File 'lib/mobilis/mysql_instance.rb', line 44
def password
"#{name}_password"
end
|
#url ⇒ Object
36
37
38
|
# File 'lib/mobilis/mysql_instance.rb', line 36
def url
"mysql2://#{ username }:#{ password }@#{ name }:3306/?pool=5"
end
|
#username ⇒ Object
40
41
42
|
# File 'lib/mobilis/mysql_instance.rb', line 40
def username
name
end
|