Class: Shippy::Cli::App

Inherits:
Base
  • Object
show all
Defined in:
lib/shippy/cli/app.rb

Instance Method Summary collapse

Methods inherited from Base

exit_on_failure?

Constructor Details

#initializeApp

Returns a new instance of App.



4
5
6
7
# File 'lib/shippy/cli/app.rb', line 4

def initialize(...)
  super(...)
  load_app
end

Instance Method Details

#deployObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/shippy/cli/app.rb', line 10

def deploy
  say "Deploying #{app_name} on #{SHIPPY.host}...", :magenta

  SHIPPY.compile
  archive
  backup
  upload
  create_network
  refresh
  stop_old
  pre_start_hooks
  start
  cleanup
  status
end

#logsObject



65
66
67
68
69
# File 'lib/shippy/cli/app.rb', line 65

def logs
  within_app do
    puts capture(:docker, "compose", "logs", verbosity: Logger::INFO)
  end
end

#refreshObject



27
28
29
30
31
32
33
# File 'lib/shippy/cli/app.rb', line 27

def refresh
  say "Pulling images for #{app_name} on #{SHIPPY.host}...", :magenta

  within_app do
    execute :docker, "compose", "pull"
  end
end

#restartObject



46
47
48
49
50
51
52
53
# File 'lib/shippy/cli/app.rb', line 46

def restart
  say "Restarting #{app_name} on #{SHIPPY.host}...", :magenta
  restart_options = options[:service] ? ["--", options[:service]] : []

  within_app do
    execute :docker, "compose", "restart", *restart_options
  end
end

#startObject



36
37
38
39
40
41
42
# File 'lib/shippy/cli/app.rb', line 36

def start
  say "Starting #{app_name} on #{SHIPPY.host}...", :magenta

  within_app do
    execute :docker, "compose", "up", "-d", SHIPPY.app&.deploy_flags
  end
end

#statusObject



72
73
74
75
76
77
78
# File 'lib/shippy/cli/app.rb', line 72

def status
  say "Status for #{app_name} on #{SHIPPY.host}...", :magenta

  within_app do
    puts capture(:docker, "compose", "ps", "-a")
  end
end

#stopObject



56
57
58
59
60
61
62
# File 'lib/shippy/cli/app.rb', line 56

def stop
  say "Stopping #{app_name} on #{SHIPPY.host}...", :magenta

  within_app do
    execute :docker, "compose", "down", "--remove-orphans"
  end
end