Class: Escualo::Plugin::Nginx

Inherits:
Object
  • Object
show all
Defined in:
lib/escualo/plugin/nginx.rb

Instance Method Summary collapse

Instance Method Details

#check(ssh, _options) ⇒ Object



15
16
17
# File 'lib/escualo/plugin/nginx.rb', line 15

def check(ssh, _options)
  ssh.exec!('nginx -v').include? 'nginx version: nginx/1'
end

#run(ssh, options) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/escualo/plugin/nginx.rb', line 3

def run(ssh, options)
  config = options.nginx_conf.try { |it| File.read it }

  ssh.perform! %Q{
    sudo add-apt-repository #{Escualo::PPA.for 'nginx/stable'} &&
    sudo apt-get update &&
    sudo apt-get install nginx -y &&
    #{config ? "/etc/nginx/nginx.conf < cat #{config} && " : ''}
    service nginx restart
  }, options
end