Installation | Topics | Beyond Lino

Making a snapshot of a Lino database

Every Lino project directory created with getlino startsite contains a file named make_snapshot.sh.

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

  • a Python dump made with pm dump2py

  • a file requirements.txt containing the output of pip freeze

  • other local files (configuration, local fixtures, uploads, etc.)

  • a mysqldump

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

If the archive directory contains any snapshots older than 60 days, the script removes them. This is important because make_snapshot.sh usually also runs as a daily cron job. 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

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 /var/backup/lino/mysite where snapshots of a Lino site are being stored.

make_snapshot.sh

Make a snapshot of a given Lino site.

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