Parent

Class/Module Index [+]

Quicksearch

PhusionPassenger::Standalone::StartCommand

Public Class Methods

description() click to toggle source
# File lib/phusion_passenger/standalone/start_command.rb, line 38
def self.description
        return "Start Phusion Passenger Standalone."
end
new(args) click to toggle source
# File lib/phusion_passenger/standalone/start_command.rb, line 42
def initialize(args)
        super(args)
        @console_mutex = Mutex.new
        @termination_pipe = IO.pipe
        @threads = []
        @interruptable_threads = []
        @plugin = PhusionPassenger::Plugin.new('standalone/start_command', self, @options)
end

Public Instance Methods

run() click to toggle source
# File lib/phusion_passenger/standalone/start_command.rb, line 51
def run
        parse_my_options
        sanity_check_options

        require 'phusion_passenger/standalone/runtime_locator'
        @runtime_locator = RuntimeLocator.new(@options[:runtime_dir],
                @options[:nginx_version])
        ensure_runtime_installed
        exit if @options[:runtime_check_only]
        determine_various_resource_locations
        require_app_finder
        @app_finder = AppFinder.new(@args, @options)
        @apps = @app_finder.scan
        @plugin.call_hook(:found_apps, @apps)

        extra_controller_options = {}
        @plugin.call_hook(:before_creating_nginx_controller, extra_controller_options)
        create_nginx_controller(extra_controller_options)

        begin
                start_nginx
                show_intro_message
                if @options[:daemonize]
                        if PlatformInfo.ruby_supports_fork?
                                daemonize
                        else
                                daemonize_without_fork
                        end
                end
                Thread.abort_on_exception = true
                @plugin.call_hook(:nginx_started, @nginx)
                ########################
                ########################
                touch_temp_dir_in_background
                watch_log_files_in_background if should_watch_logs?
                wait_until_nginx_has_exited if should_wait_until_nginx_has_exited?
        rescue Interrupt
                begin_shutdown
                stop_threads
                stop_nginx
                exit 2
        rescue SignalException => signal
                begin_shutdown
                stop_threads
                stop_nginx
                if signal.message == 'SIGINT' || signal.message == 'SIGTERM'
                        exit 2
                else
                        raise
                end
        rescue Exception => e
                begin_shutdown
                stop_threads
                stop_nginx
                raise
        ensure
                begin_shutdown
                begin
                        stop_touching_temp_dir_in_background if should_wait_until_nginx_has_exited?
                        stop_threads
                ensure
                        finalize_shutdown
                end
        end
ensure
        if @temp_dir
                FileUtils.remove_entry_secure(@temp_dir) rescue nil
        end
        @plugin.call_hook(:cleanup)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.