Class: Kaiser::Cmds::Up
Instance Method Summary
collapse
Methods inherited from Kaiser::Cli
all_subcommands_usage, #define_options, register, run_command, #set_config, #start_services, #stop_app, #stop_services
#option, #options
Instance Method Details
#execute(opts) ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/kaiser/cmds/up.rb', line 18
def execute(opts)
ensure_setup
setup_app
setup_db
if opts[:attach]
attach_app
else
start_app
end
end
|
#setup_app ⇒ Object
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/kaiser/cmds/up.rb', line 30
def setup_app
Config.info_out.puts 'Setting up application'
File.write(tmp_dockerfile_name, docker_file_contents)
build_args = docker_build_args.map { |k, v| "--build-arg #{k}=#{v}" }
CommandRunner.run! Config.out, "docker build
-t kaiser:#{envname}-#{current_branch}
-f #{tmp_dockerfile_name} #{Config.work_dir}
#{build_args.join(' ')}"
FileUtils.rm(tmp_dockerfile_name)
end
|
#usage ⇒ Object
8
9
10
11
12
13
14
15
16
|
# File 'lib/kaiser/cmds/up.rb', line 8
def usage
<<~EOS
Boots up the application in docker as defined in the \`Kaiserfile\` in its source code. Usually this will create two docker containers \`<ENV_NAME>-db\` and \`<ENV_NAME>-app\` running your database and application respectively.
A backup of the default database is created and saved to \`~/.kaiser/<ENV_NAME>/<current_github_branch_name>/.default.tar.bz\`. This can be restored at any time using the \`db_reset\` command.
USAGE: kaiser up
EOS
end
|