Class: PhusionPassenger::Standalone::RuntimeInstaller

Class PhusionPassenger::Standalone::RuntimeInstaller |
In: | lib/phusion_passenger/standalone/runtime_installer.rb
Parent: | AbstractInstaller

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:

- source_root: Path to the Phusion Passenger source root.

If you want RuntimeInstaller to compile and install Nginx, then you must specify these options:

- nginx_dir: Nginx will be installed into this directory.
- support_dir: See below.
- version (optional): The Nginx version to download. If not given then a hardcoded version number will be used.
- 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 you want RuntimeInstaller to compile and install the Phusion Passenger support files, then you must specify these:

- support_dir: The support files will be installed here. Should not equal `source_root`, or funny things might happen.

Other optional options:

- download_binaries: If true then RuntimeInstaller will attempt to download precompiled Nginx binaries and precompiled Phusion Passenger support 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.

Methods

- after_install
- before_install
- dependencies
- install!
- users_guide

Included Modules

- Utils

Protected Instance methods
after_install()

[ show source ]

         # File lib/phusion_passenger/standalone/runtime_installer.rb, line 173
    173:         def after_install
    174:                 super
    175:                 FileUtils.rm_rf(@working_dir)
    176:                 @plugin.call_hook(:runtime_installer_cleanup) if @plugin
    177:         end

before_install()

[ show source ]

         # File lib/phusion_passenger/standalone/runtime_installer.rb, line 163
    163:         def before_install
    164:                 super
    165:                 @plugin.call_hook(:runtime_installer_start, self) if @plugin
    166:                 @working_dir = "/tmp/#{myself}-passenger-standalone-#{Process.pid}"
    167:                 FileUtils.rm_rf(@working_dir)
    168:                 FileUtils.mkdir_p(@working_dir)
    169:                 @download_binaries = true if !defined?(@download_binaries)
    170:                 @binaries_url_root ||= STANDALONE_BINARIES_URL_ROOT
    171:         end

dependencies()

[ show source ]

        # File lib/phusion_passenger/standalone/runtime_installer.rb, line 76
    76:         def dependencies
    77:                 result = [
    78:                         Dependencies::GCC,
    79:                         Dependencies::GnuMake,
    80:                         Dependencies::DownloadTool,
    81:                         Dependencies::Ruby_DevHeaders,
    82:                         Dependencies::Ruby_OpenSSL,
    83:                         Dependencies::RubyGems,
    84:                         Dependencies::Rake,
    85:                         Dependencies::Rack,
    86:                         Dependencies::Curl_Dev,
    87:                         Dependencies::OpenSSL_Dev,
    88:                         Dependencies::Zlib_Dev,
    89:                         Dependencies::File_Tail,
    90:                         Dependencies::Daemon_Controller,
    91:                 ]
    92:                 if Dependencies.fastthread_required?
    93:                         result << Dependencies::FastThread
    94:                 end
    95:                 if Dependencies.asciidoc_required?
    96:                         result << Dependencies::AsciiDoc
    97:                 end
    98:                 return result
    99:         end

install!()

[ show source ]

         # File lib/phusion_passenger/standalone/runtime_installer.rb, line 105
    105:         def install!
    106:                 if @support_dir && @nginx_dir
    107:                         show_welcome_screen
    108:                 end
    109:                 check_dependencies(false) || exit(1)
    110:                 puts
    111:                 if passenger_support_files_need_to_be_installed?
    112:                         check_whether_we_can_write_to(@support_dir) || exit(1)
    113:                 end
    114:                 if nginx_needs_to_be_installed?
    115:                         check_whether_we_can_write_to(@nginx_dir) || exit(1)
    116:                 end
    117:
    118:                 if passenger_support_files_need_to_be_installed? && should_download_binaries?
    119:                         download_and_extract_passenger_binaries(@support_dir) do |progress, total|
    120:                                 show_progress(progress, total, 1, 1, "Extracting Passenger binaries...")
    121:                         end
    122:                         puts
    123:                         puts
    124:                 end
    125:                 if nginx_needs_to_be_installed? && should_download_binaries?
    126:                         download_and_extract_nginx_binaries(@nginx_dir) do |progress, total|
    127:                                 show_progress(progress, total, 1, 1, "Extracting Nginx binaries...")
    128:                         end
    129:                         puts
    130:                         puts
    131:                 end
    132:
    133:                 if nginx_needs_to_be_installed?
    134:                         nginx_source_dir = download_and_extract_nginx_sources do |progress, total|
    135:                                 show_progress(progress, total, 1, 7, "Extracting...")
    136:                         end
    137:                         if nginx_source_dir.nil?
    138:                                 puts
    139:                                 show_possible_solutions_for_download_and_extraction_problems
    140:                                 exit(1)
    141:                         end
    142:                 end
    143:                 if passenger_support_files_need_to_be_installed?
    144:                         install_passenger_support_files do |progress, total, phase, status_text|
    145:                                 if phase == 1
    146:                                         show_progress(progress, total, 2, 7, status_text)
    147:                                 else
    148:                                         show_progress(progress, total, 3..5, 7, status_text)
    149:                                 end
    150:                         end
    151:                 end
    152:                 if nginx_needs_to_be_installed?
    153:                         install_nginx_from_source(nginx_source_dir) do |progress, total, status_text|
    154:                                 show_progress(progress, total, 6..7, 7, status_text)
    155:                         end
    156:                 end
    157:
    158:                 puts
    159:                 color_puts "<green><b>All done!</b></green>"
    160:                 puts
    161:         end

users_guide()

[ show source ]

         # File lib/phusion_passenger/standalone/runtime_installer.rb, line 101
    101:         def users_guide
    102:                 return "#{DOCDIR}/Users guide Standalone.html"
    103:         end