Class: Dolphin::Deploy

Inherits:
Base
  • Object
show all
Defined in:
lib/dolphin/deploy.rb

Overview

Deploy tasks

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Dolphin::Base

Instance Method Details

#bundleObject



5
6
7
8
9
10
11
12
13
14
# File 'lib/dolphin/deploy.rb', line 5

def bundle
  menu = [
    "
      cd #{@deploy_dir}
      sudo bundle install --quiet
    ",
  ]

  execute menu
end

#goObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/dolphin/deploy.rb', line 17

def go
  # check lock
  invoke "dolphin:lock:check"
  # put lock
  invoke "dolphin:lock:create"

  # update code
  invoke "dolphin:git:update"

  # no need to invoke since it is within the same class
  bundle

  # restart app server
  invoke "dolphin:puma:restart"

  # remove lock
  invoke "dolphin:lock:release"
end

#newrelicObject



69
70
71
72
73
74
75
76
77
# File 'lib/dolphin/deploy.rb', line 69

def newrelic
  menu = [
    "
      sudo /etc/init.d/newrelic-sysmond start
    ",
  ]

  execute menu
end

#rollback(tag = nil) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/dolphin/deploy.rb', line 37

def rollback(tag=nil)
  # check lock, must explicitly not passing arguments
  invoke "dolphin:lock:check", []
  # put lock
  invoke "dolphin:lock:create", []

  # checkout tag
  invoke "dolphin:git:checkout"

  # restart app server
  invoke "dolphin:puma:restart", []

  # remove lock
  invoke "dolphin:lock:release", []
end

#tryObject



54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/dolphin/deploy.rb', line 54

def try
  menu = [
    "
      cd #{@deploy_dir}
      pwd
      chruby
      which bundle
      bundle check
    ",
  ]

  execute menu
end