Module: DeploYML::Servers::Mongrel

Defined in:
lib/deployml/servers/mongrel.rb

Overview

Provides methods for configuring, starting, stopping and restarting the Mongrel web server.

Instance Method Summary collapse

Instance Method Details

#initialize_serverObject

Initializes options used when calling mongrel.



14
15
16
17
# File 'lib/deployml/servers/mongrel.rb', line 14

def initialize_server
  @mongrel = Options::Mongrel.new(@server_options)
  @mongrel.environment ||= @name
end

#mongrel_cluster(shell, *arguments) ⇒ Object

Executes a command via the mongrel_rails command.

Parameters:

  • shell (LocalShell, RemoteShell)

    The shell to execute commands in.

  • arguments (Array)

    Additional arguments to call mongrel_rails with.



28
29
30
31
32
# File 'lib/deployml/servers/mongrel.rb', line 28

def mongrel_cluster(shell,*arguments)
  options = arguments + ['-c', @mongrel.config]

  shell.ruby 'mongrel_rails', *options
end

#server_config(shell) ⇒ Object

Configures Mongrel by calling mongrel_rails cluster::configure.

Parameters:

Raises:

  • (MissingOption)

    No config option was listed under the server option in the deploy.yml configuration file.



44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/deployml/servers/mongrel.rb', line 44

def server_config(shell)
  unless @mongrel.config
    raise(MissingOption,"No 'config' option specified under server options",caller)
  end

  shell.status "Configuring Mongrel ..."

  options = ['-c', shell.uri.path] + @mongrel.arguments
  shell.ruby 'mongrel_rails', 'cluster::configure', *options

  shell.status "Mongrel configured."
end

#server_restart(shell) ⇒ Object

Restarts Mongrel by calling mongrel_rails cluster::restart.

Parameters:



91
92
93
94
95
96
97
# File 'lib/deployml/servers/mongrel.rb', line 91

def server_restart(shell)
  shell.status "Restarting Mongrel(s) ..."

  mongrel_cluster 'cluster::restart'

  shell.status "Mongrel(s) restarted."
end

#server_start(shell) ⇒ Object

Starts Mongrel by calling mongrel_rails cluster::start.

Parameters:



63
64
65
66
67
68
69
# File 'lib/deployml/servers/mongrel.rb', line 63

def server_start(shell)
  shell.status "Starting Mongrel(s) ..."

  mongrel_cluster 'cluster::start'

  shell.status "Mongrel(s) started."
end

#server_stop(shell) ⇒ Object

Stops Mongrel by calling mongrel_rails cluster::stop.

Parameters:



77
78
79
80
81
82
83
# File 'lib/deployml/servers/mongrel.rb', line 77

def server_stop(shell)
  shell.status "Stopping Mongrel(s) ..."

  mongrel_cluster 'cluster::stop'

  shell.status "Mongrel(s) stopped."
end