snapshot.rst 1.82 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
.. _admin.snapshot:

====================================
Making a snapshot of a Lino database
====================================

Every Lino project directory created with :cmd:`getlino startsite` contains a
file named :xfile:`make_snapshot.sh`.

This script makes a :term:`snapshot` of this Lino site, i.e. an archive file
that contains its current state, including:

  - a Python dump made with :manage:`dump2py`
  - a file :file:`requirements.txt` containing the output of :cmd:`pip freeze`
  - other local files (configuration, local fixtures, uploads, etc.)
  - a `mysqldump`

The snapshot file is named :file:`snapshot.zip`.  If a file :file:`snapshot.zip`
already existed before (probably from a previous run), then
:xfile:`make_snapshot.sh` renames that file based on its time stamp and moves it
to an :term:`archive directory` before creating a new file.

If the :term:`archive directory` contains any **snapshots older than 60 days**,
the script removes them.  This is important because :xfile:`make_snapshot.sh`
usually also runs as a daily :doc:`cron job <cron>`.  If we didn't take care of
removing old snapshots, our server might run out of disk space some time in a
far future when we long have forgotten that your daily job is adding a new file
every day.

Glossary
========

.. glossary::

  snapshot

    An archive or zip file that contains the state of a Lino site, including
    database content and local configuration.

  archive directory

    A directory, usually under :file:`/var/backup/lino/mysite` where
    :term:`snapshots <snapshot>` of a Lino site are being stored.

.. xfile:: make_snapshot.sh

    Make a :term:`snapshot` of a given Lino site.

    This file is generated by :cmd:`getlino startsite` using the following
    template:
    https://github.com/lino-framework/getlino/blob/master/getlino/templates/make_snapshot.sh