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

Included Modules

Utils

Protected Instance methods

[Source]

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

[Source]

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

[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::Daemon_Controller,
90:                 ]
91:                 if Dependencies.fastthread_required?
92:                         result << Dependencies::FastThread
93:                 end
94:                 if Dependencies.asciidoc_required?
95:                         result << Dependencies::AsciiDoc
96:                 end
97:                 return result
98:         end

[Source]

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

[Source]

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

[Validate]