Class: Heighliner::Cmds::Up
Instance Attribute Summary
#use_steerfile
Instance Method Summary
collapse
all_subcommands_usage, #define_options, #initialize, register, run_command, #set_config, #start_services, #stop_app, #stop_services
#option, #options
Instance Method Details
#build_cmd ⇒ Object
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/heighliner/cmds/up.rb', line 32
def build_cmd
platform_args = ''
platform_args = "--platform=#{force_platform}" unless force_platform.empty?
build_args = docker_build_args.map { |k, v| "--build-arg #{k}=#{v}" }
[
'docker build',
"-t heighliner:#{envname}-#{current_branch}",
"-f #{tmp_dockerfile_name} #{Config.work_dir}",
platform_args,
build_args.join(' ').to_s
]
end
|
#execute(opts) ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/heighliner/cmds/up.rb', line 20
def execute(opts)
ensure_setup
setup_app
setup_db
if opts[:attach]
attach_app
else
start_app
end
end
|
#setup_app ⇒ Object
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/heighliner/cmds/up.rb', line 45
def setup_app
Config.info_out.puts 'Setting up application'
File.write(tmp_dockerfile_name, docker_file_contents)
CommandRunner.run! Config.out, build_cmd.join("\n\t"), env_vars: {
'DOCKER_BUILDKIT' => '1',
'BUILDKIT_PROGRESS' => 'plain'
}
FileUtils.rm(tmp_dockerfile_name)
end
|
#usage ⇒ Object
10
11
12
13
14
15
16
17
18
|
# File 'lib/heighliner/cmds/up.rb', line 10
def usage
<<~EOS
Boots up the application in docker as defined in the \`Steerfile\` 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 \`~/.heighliner/<ENV_NAME>/<current_github_branch_name>/default.tar.bz\`. This can be restored at any time using the \`db_reset\` command.
USAGE: heighliner up
EOS
end
|