### Home Classes Methods

### In Files

- lib/phusion_passenger/standalone/runtime_installer.rb

### Parent

AbstractInstaller

### Methods

- #after_install
- #before_install
- #dependencies
- #run_steps
- #users_guide

### Included Modules

- PhusionPassenger::Standalone::Utils

### Class/Module Index

Quicksearch

- PhusionPassenger
- PhusionPassenger::AbstractInstaller
- PhusionPassenger::AbstractInstaller::Abort
- PhusionPassenger::AbstractInstaller::CommandError
- PhusionPassenger::AdminTools
- PhusionPassenger::AdminTools::MemoryStats
- PhusionPassenger::AdminTools::MemoryStats::Process
- PhusionPassenger::AdminTools::ServerInstance
- PhusionPassenger::AdminTools::ServerInstance::CorruptedDirectoryError
- PhusionPassenger::AdminTools::ServerInstance::GenerationsAbsentError
- PhusionPassenger::AdminTools::ServerInstance::Group
- PhusionPassenger::AdminTools::ServerInstance::Process
- PhusionPassenger::AdminTools::ServerInstance::RoleDeniedError
- PhusionPassenger::AdminTools::ServerInstance::StaleDirectoryError
- PhusionPassenger::AdminTools::ServerInstance::Stats
- PhusionPassenger::AdminTools::ServerInstance::UnsupportedGenerationStructureVersionError
- PhusionPassenger::AnalyticsLogger
- PhusionPassenger::AnalyticsLogger::Connection
- PhusionPassenger::AnalyticsLogger::Lock
- PhusionPassenger::AnalyticsLogger::Log
- PhusionPassenger::ClassicRails
- PhusionPassenger::ClassicRails::CGIFixed
- PhusionPassenger::ClassicRails::ThreadHandlerExtension
- PhusionPassenger::ConsoleTextTemplate
- PhusionPassenger::DebugLogging
- PhusionPassenger::LoaderSharedHelpers
- PhusionPassenger::MessageChannel
- PhusionPassenger::MessageChannel::InvalidHashError
- PhusionPassenger::MessageClient
- PhusionPassenger::NativeSupportLoader
- PhusionPassenger::Packaging
- PhusionPassenger::PlatformInfo
- PhusionPassenger::PlatformInfo::Depcheck
- PhusionPassenger::PlatformInfo::Depcheck::ConsoleRunner
- PhusionPassenger::PlatformInfo::Depcheck::Dependency
- PhusionPassenger::PlatformInfo::RuntimeError
- PhusionPassenger::Plugin
- PhusionPassenger::PreloaderSharedHelpers
- PhusionPassenger::Rack
- PhusionPassenger::Rack::OutOfBandGc
- PhusionPassenger::Rack::ThreadHandlerExtension
- PhusionPassenger::Rails3Extensions
- PhusionPassenger::Rails3Extensions::AnalyticsLogging
- PhusionPassenger::Rails3Extensions::AnalyticsLogging::ACExtension
- PhusionPassenger::Rails3Extensions::AnalyticsLogging::ASBenchmarkableExtension
- PhusionPassenger::Rails3Extensions::AnalyticsLogging::ExceptionLogger
- PhusionPassenger::RequestHandler
- PhusionPassenger::RequestHandler::ThreadHandler
- PhusionPassenger::RequestHandler::ThreadHandler::Interrupted
- PhusionPassenger::SharedConstants
- PhusionPassenger::Standalone
- PhusionPassenger::Standalone::AppFinder
- PhusionPassenger::Standalone::Command
- PhusionPassenger::Standalone::ConfigFile
- PhusionPassenger::Standalone::ConfigFile::DisallowedContextError
- PhusionPassenger::Standalone::HelpCommand
- PhusionPassenger::Standalone::Main
- PhusionPassenger::Standalone::PackageRuntimeCommand
- PhusionPassenger::Standalone::RuntimeInstaller
- PhusionPassenger::Standalone::StartCommand
- PhusionPassenger::Standalone::StatusCommand
- PhusionPassenger::Standalone::StopCommand
- PhusionPassenger::Standalone::Utils
- PhusionPassenger::Standalone::VersionCommand
- PhusionPassenger::Utils
- PhusionPassenger::Utils::AnsiColors
- PhusionPassenger::Utils::FileSystemWatcher
- PhusionPassenger::Utils::FileSystemWatcher::DirInfo
- PhusionPassenger::Utils::FileSystemWatcher::FileInfo
- PhusionPassenger::Utils::HostsFileParser
- PhusionPassenger::Utils::TeeInput
- PhusionPassenger::Utils::TmpIO
- PhusionPassenger::Utils::UnseekableSocket
- CommonLibraryBuilder
- Exception
- GC
- IO
- Object
- Signal

No matching classes.

# PhusionPassenger::Standalone::RuntimeInstaller

Installs the Phusion Passenger Standalone runtime by downloading and compiling Nginx, compiling the Phusion Passenger support binaries, and storing the results in the designated directories. This installer is entirely non-interactive.

The following option must be given:

- targets: An array containing at least one of:

  - :nginx - to indicate that you want to compile and install Nginx.

  - :support_binaries - to indicate that you want to compile and install the

        Phusion Passenger support binary files.

  - :ruby - to indicate that you want to compile and install the Ruby

        extension files.

If 'targets' contains :nginx, then you must also specify these options:

- nginx_dir: Nginx will be installed into this directory.

- support_dir: Path to the Phusion Passenger support binary files.

- nginx_version (optional): The Nginx version to download. If not given then a hardcoded version number will be used.

- nginx_tarball (optional): The location to the Nginx tarball. This tarball must contain the Nginx version as specified by `version`. If `tarball` is given then Nginx will not be downloaded; it will be extracted from this tarball instead.

If targets contains ':support_binaries', then you must also specify this options:

- support_dir: The support binary files will be installed here.

If targets contains ':ruby', then you must also specify this option:

- ruby_dir: The support binary files will be installed here.

Other optional options:

- download_binaries: If true then RuntimeInstaller will attempt to download precompiled Nginx binaries and precompiled Phusion Passenger support binary files from the network, if they exist for the current platform. The default is false.

- binaries_url_root: The URL on which to look for the aforementioned binaries. The default points to the Phusion website.

Please note that RuntimeInstaller will try to avoid compiling/installing things that don't need to be compiled/installed. This is done by checking whether some key files exist, and concluding that something doesn't need to be compiled/installed if they do. This quick check is of course not perfect; if you want to force a recompilation/reinstall then you should remove `nginx_dir` and `support_dir` before starting this installer.

### Protected Instance Methods

after_install() click to toggle source

    # File lib/phusion_passenger/standalone/runtime_installer.rb, line 209
    def after_install
            super
            FileUtils.remove_entry_secure(@working_dir) if @working_dir
            @plugin.call_hook(:runtime_installer_cleanup) if @plugin
    end

before_install() click to toggle source

    # File lib/phusion_passenger/standalone/runtime_installer.rb, line 201
    def before_install
            super
            @plugin.call_hook(:runtime_installer_start, self) if @plugin
            @working_dir = PhusionPassenger::Utils.mktmpdir("passenger.", PlatformInfo.tmpexedir)
            @download_binaries = true if !defined?(@download_binaries)
            @binaries_url_root ||= STANDALONE_BINARIES_URL_ROOT
    end

dependencies() click to toggle source

    # File lib/phusion_passenger/standalone/runtime_installer.rb, line 85
    def dependencies
            specs = [
                    'depcheck_specs/compiler_toolchain',
                    'depcheck_specs/ruby',
                    'depcheck_specs/gems',
                    'depcheck_specs/libs',
                    'depcheck_specs/utilities'
            ]
            ids = [
                    'gcc',
                    'g++',
                    'gmake',
                    'download-tool',
                    PlatformInfo.passenger_needs_ruby_dev_header? ? 'ruby-dev' : nil,
                    'ruby-openssl',
                    'rubygems',
                    'rake',
                    'rack',
                    'libcurl-dev',
                    'openssl-dev',
                    'zlib-dev',
                    'pcre-dev',
                    'daemon_controller >= 1.1.0'
            ].compact
            return [specs, ids]
    end

run_steps() click to toggle source

    # File lib/phusion_passenger/standalone/runtime_installer.rb, line 116
    def run_steps
            if @support_dir && @nginx_dir
                    show_welcome_screen
            end
            check_dependencies(false) || exit(1)
            check_whether_os_is_broken
            check_whether_system_has_enough_ram
            puts

            phase = 1
            total_phases = 0

            if binary_support_files_should_be_installed?
                    check_whether_we_can_write_to(@support_dir) || exit(1)
                    total_phases += 4
            end
            if ruby_extension_should_be_installed?
                    check_whether_we_can_write_to(@ruby_dir) || exit(1)
                    total_phases += 2
            end
            if nginx_needs_to_be_installed?
                    check_whether_we_can_write_to(@nginx_dir) || exit(1)
                    total_phases += 4
            end

            if binary_support_files_should_be_installed? && should_download_binaries?
                    download_and_extract_binary_support_files(@support_dir) do |progress, total|
                            show_progress(progress, total, 1, 1, "Extracting Passenger binaries...")
                    end
                    puts
                    puts
            end
            if ruby_extension_should_be_installed? && should_download_binaries?
                    download_and_extract_ruby_extension(@ruby_dir) do |progress, total|
                            show_progress(progress, total, 1, 1, "Extracting Ruby extension...")
                    end
                    puts
                    puts
            end
            if nginx_needs_to_be_installed? && should_download_binaries?
                    download_and_extract_nginx_binaries(@nginx_dir) do |progress, total|
                            show_progress(progress, total, 1, 1, "Extracting Nginx binaries...")
                    end
                    puts
                    puts
            end

            if nginx_needs_to_be_installed?
                    nginx_source_dir = download_and_extract_nginx_sources do |progress, total|
                            show_progress(progress, total, phase, total_phases, "Extracting...")
                    end
                    phase += 1
                    if nginx_source_dir.nil?
                            puts
                            show_possible_solutions_for_download_and_extraction_problems
                            exit(1)
                    end
            end
            if ruby_extension_should_be_installed?
                    phase += install_ruby_extension do |progress, total, subphase, status_text|
                            show_progress(progress, total, phase + subphase, total_phases, status_text)
                    end
            end
            if binary_support_files_should_be_installed?
                    install_binary_support_files do |progress, total, subphase, status_text|
                            if subphase == 0
                                    show_progress(progress, total, phase, total_phases, status_text)
                            else
                                    show_progress(progress, total, phase + 1 .. phase + 3, total_phases, status_text)
                            end
                    end
                    phase += 4
            end
            if nginx_needs_to_be_installed?
                    install_nginx_from_source(nginx_source_dir) do |progress, total, status_text|
                            show_progress(progress, total, phase .. phase + 2, total_phases, status_text)
                    end
                    phase += 3
            end

            puts
            puts "<green><b>All done!</b></green>"
            puts
    end

users_guide() click to toggle source

    # File lib/phusion_passenger/standalone/runtime_installer.rb, line 112
    def users_guide
            return "#{PhusionPassenger.doc_dir}/Users guide Standalone.html"
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.