Class: Cany::Recipes::WebServer

Inherits:
Cany::Recipe show all
Defined in:
lib/cany/recipes/web_server.rb

Direct Known Subclasses

Thin, Unicorn

Defined Under Namespace

Classes: DSL

Instance Attribute Summary collapse

Attributes inherited from Cany::Recipe

#inner, #spec

Instance Method Summary collapse

Methods inherited from Cany::Recipe

#build, #clean, #configure, #create, #depend, #exec, from_name, hook, #hook, #install, #install_content, #install_dir, #install_link, #install_service, option, #option, #prepare, #recipe, register_as, #rmtree, #ruby_bin, #run_hook

Methods included from Mixins::DependMixin

#create_dep

Constructor Details

#initialize(*args) ⇒ WebServer

Returns a new instance of WebServer.



14
15
16
17
18
# File 'lib/cany/recipes/web_server.rb', line 14

def initialize(*args)
  @user = 'www-data'
  @group = 'www-data'
  super
end

Instance Attribute Details

#groupString?

Returns The group name as which the web server process should executed.

Returns:

  • (String, nil)

    The group name as which the web server process should executed



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/cany/recipes/web_server.rb', line 8

class WebServer < Cany::Recipe
  attr_accessor :user, :group
  class DSL < Cany::Recipe::DSL
    delegate :user, :group
  end

  def initialize(*args)
    @user = 'www-data'
    @group = 'www-data'
    super
  end

  def binary
    recipe(:system).configure :service_pre_scripts, {
      mkdir_run: "mkdir -p /var/run/#{spec.name}",
      chown_run: "chown #{user}:#{group} /var/run/#{spec.name}"
    }
    install_service name, ["/usr/bin/#{spec.name}"] + launch_command, user: user, group: group
    inner.binary
  end
end

#userString?

Returns The user name as which the web server process should executed.

Returns:

  • (String, nil)

    The user name as which the web server process should executed



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/cany/recipes/web_server.rb', line 8

class WebServer < Cany::Recipe
  attr_accessor :user, :group
  class DSL < Cany::Recipe::DSL
    delegate :user, :group
  end

  def initialize(*args)
    @user = 'www-data'
    @group = 'www-data'
    super
  end

  def binary
    recipe(:system).configure :service_pre_scripts, {
      mkdir_run: "mkdir -p /var/run/#{spec.name}",
      chown_run: "chown #{user}:#{group} /var/run/#{spec.name}"
    }
    install_service name, ["/usr/bin/#{spec.name}"] + launch_command, user: user, group: group
    inner.binary
  end
end

Instance Method Details

#binaryObject



20
21
22
23
24
25
26
27
# File 'lib/cany/recipes/web_server.rb', line 20

def binary
  recipe(:system).configure :service_pre_scripts, {
    mkdir_run: "mkdir -p /var/run/#{spec.name}",
    chown_run: "chown #{user}:#{group} /var/run/#{spec.name}"
  }
  install_service name, ["/usr/bin/#{spec.name}"] + launch_command, user: user, group: group
  inner.binary
end