Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You should put up a maintenance page if the application is not going to be available for a while. I use this Capistrano task:</p> <pre><code>namespace :deploy do namespace :web do desc &lt;&lt;-DESC Present a maintenance page to visitors. Disables your application's web \ interface by writing a "maintenance.html" file to each web server. The \ servers must be configured to detect the presence of this file, and if \ it is present, always display it instead of performing the request. By default, the maintenance page will just say the site is down for \ "maintenance", and will be back "shortly", but you can customize the \ page by specifying the REASON and UNTIL environment variables: $ cap deploy:web:disable \\ REASON="a hardware upgrade" \\ UNTIL="12pm Central Time" Further customization will require that you write your own task. DESC task :disable, :roles =&gt; :web do require 'erb' on_rollback { run "rm #{shared_path}/system/maintenance.html" } reason = ENV['REASON'] deadline = ENV['UNTIL'] template = File.read('app/views/admin/maintenance.html.erb') page = ERB.new(template).result(binding) put page, "#{shared_path}/system/maintenance.html", :mode =&gt; 0644 end end end </code></pre> <p>The <code>app/views/admin/maintenance.html.erb</code> file should contain:</p> <pre><code>&lt;p&gt;We’re currently offline for &lt;%= reason ? reason : 'maintenance' %&gt; as of &lt;%= Time.now.utc.strftime('%H:%M %Z') %&gt;.&lt;/p&gt; &lt;p&gt;Sorry for the inconvenience. We’ll be back &lt;%= deadline ? "by #{deadline}" : 'shortly' %&gt;.&lt;/p&gt; </code></pre> <p>The final step is to configure the Apache virtual host with some directives to look for the <code>maintenance.html</code> file and redirect all requests to it if it's present:</p> <pre><code>&lt;IfModule mod_rewrite.c&gt; RewriteEngine On # Redirect all requests to the maintenance page if present RewriteCond %{REQUEST_URI} !\.(css|gif|jpg|png)$ RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f RewriteCond %{SCRIPT_FILENAME} !maintenance.html RewriteRule ^.*$ /system/maintenance.html [L] &lt;/IfModule&gt; </code></pre> <p>To put the application into maintenance mode, run <code>cap deploy:web:disable</code> and to make it live again do <code>cap deploy:web:enable</code>.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload