PageRenderTime 94ms CodeModel.GetById 40ms app.highlight 1ms RepoModel.GetById 39ms app.codeStats 0ms

/docs/disabling-sites.txt

https://bitbucket.org/ianb/silverlining/
Plain Text | 63 lines | 50 code | 13 blank | 0 comment | 0 complexity | 8220904c2219da81257e80e00994b132 MD5 | raw file
 1.. -*- mode: rst -*-
 2
 3=================
 4 Disabling Sites
 5=================
 6
 7When hosting a site it's likely that from time to time it will be
 8necessary to make it unavailable to the general public while some
 9maintenance is carried out.  Silver Lining provides a mechanism for
10allowing this.  It is important to recognise that it is *applications*
11that are disabled via this mechanism, rather than locations, so if the
12same application is accessible via two different locations (even if it
13is two different *deployments* of the application), and it is
14disabled, then it will appear to be disabled at both locations.  This
15is because if your application uses a database, then all different
16deployments of the application will share the database, and cleaning
17up databases is one of the key use-cases for this feature.
18
19Disabling an application
20========================
21
22The following command will disable an application called blog::
23
24    $ silver disable --by-name blog
25
26You can also disable the application by giving a path that it appears
27at::
28
29    silver disable --by-location www.example.com/blog
30
31Enabling an application
32=======================
33
34To re-enable an application you use the ``silver enable`` command,
35which takes the same options as silver disable command.
36
37The disabled special location
38=============================
39When an application is disabled, visitors to it will be shown a page
40explaining that the site is unavailable (similarly there is a
41not-found location which is shown when a URL is not resolved).  It is
42possible to replace this page by uploading a new WSGI application to
43the special location "disabled".  To restore the default application,
44use the ``silver activate`` command to point the disabled location to
45"default-disabled".
46
47Headers for disabled apps
48-------------------------
49It is sensible to return a "503 Service Unavailable" response from a
50disabled app and use the following headers:
51
52:Cache-Control: no-store, no-cache, max-age=0
53:Pragma: no-cache
54
55Access To disabled apps
56=======================
57While an application is disabled, it is still possible to access it
58via the command line tools.  ``silver backup``, ``restore``, ``run``
59etc. will all work as usual.  It's also possible to access the site
60through a web browser.  At present the application is only made
61available to clients connecting from localhost, so to view the site
62and access management facilities you will probably need to set up an
63SSH tunnel and manually update ``/etc/hosts`` on your own machine.