PageRenderTime 42ms CodeModel.GetById 20ms app.highlight 1ms RepoModel.GetById 19ms app.codeStats 0ms

/docs/filelayout.txt

https://bitbucket.org/ianb/silverlining/
Plain Text | 80 lines | 62 code | 18 blank | 0 comment | 0 complexity | defcbbb49bf561f09ff1fe1d8ecc6d5e MD5 | raw file
 1File Layout
 2===========
 3
 4This document describes how files are laid out in the Silver Lining
 5code base, and on production servers (and how the two relate).
 6
 7General Patterns
 8----------------
 9
10Anything that is a "script" (a file meant to be executed) generally
11has a ``-`` in the name somewhere, to help indicate that it is *not* a
12module (since you cannot import names with dashes).
13
14The Silver Lining Code Base
15---------------------------
16
17Here are some notable features:
18
19* The ``silverlining`` package is basically for *managing* the
20  process.  It is *not* installed on the production servers, nor is it
21  generally importable by applications (nor is there anything worth
22  importing).
23
24* The ``silversupport`` is uploaded to the production server, and also
25  used locally.  Applications may find it useful to import some
26  routines from this library.  There's also simply pieces here that
27  both ``silverlining`` and server management scripts need to use, and
28  this is the one shared codebase for that.
29
30* ``silversupport`` gets uploaded to
31  ``/usr/local/share/silverlining/lib`` (this directory is added to
32  ``sys.path`` to make it importable).
33
34* There are a bunch of scripts that are run *on the server*.  Lots of
35  what Silver Lining does is just ``ssh server "command"``, with the
36  actual code on the server.  All Silver Linings scripts are uploaded
37  *from* ``silverlining/mgr-scripts/`` to
38  ``/usr/local/share/silverlining/mgr-scripts/``.  These are *only*
39  run on the server, not locally.  Each script also adds
40  ``/usr/local/share/silverlining/lib`` to its path at the top of the
41  script.
42
43* Files in ``silverlining/server-files/`` are rsync'd to the server's
44  root.  That is, the file layout under that directory matches the
45  server layout exactly.  ``silversupport`` and ``mgr-scripts`` are
46  rsync'd separately.
47
48* Some of the files used for *setting up* a server are in
49  ``silverlining/server-sync-scripts/``.  This includes the *very
50  important* ``update-from-server.sh`` script, which does most of the
51  configuration of servers.  If there's anything that needs to be done
52  (or checked, or fixed) every time a server is created or updated,
53  that's probably the place to look.  (Per-service tasks, like
54  installing a database configuration file, go in the service code.)
55
56Services
57--------
58
59Services are modules in ``silversupport.services.*``, named after the
60service.  Resource files for services go in that package as well (for
61instance, the ``pg_hba.conf`` that the postgis service uses is in
62``silversupport/services/postgis-pg_hba.conf``).
63
64Server Files
65------------
66
67The files created by ``silver setup-node`` are generally put in
68``/usr/local/share/silverlining/``.
69
70Configuration files get put wherever they belong, e.g.,
71``/etc/apache2/sites-enabled/wsgi_runner``.
72
73Log files go in ``/var/log/silverlining/``.
74
75Individual applications have log files in
76``/var/log/silverlining/apps/APP_NAME``, specifically ``errors.log``
77is anything written to stderr, stdout, or ``environ['wsgi.errors']``.
78These items are also grouped by request (all content written is
79buffered, written out in one chunk with a header/footer to help group
80it to a request).