Installing a preview site¶
A same site operator will have a a series of sites, one in “production” state and maybe another in “preview” state. Every site has its “life cycle” : it typically starts as a “preview” site, then becomes the “production” site, and maybe afterwards remains alive for some time as the “old” site.
Remember that virtual environments cannot change their name. So you will prefer to give your project directories neutral names like “v1”, “v2”, “v3” instead of “preview”, “old”, “new”, “testing” or “prod”.
When the site operator asks for an upgrade, you start by setting up a new preview site.
Copy the current production project directory to a new directory:
$ df -h $ cp -a afoo bfoo
In the afoo directory run:
$ python manage.py dump2py snapshot2preview
In the bfoo directory:
logdirectory point to a different directory:
$ rm log $ mkdir /var/log/lino/bfoo $ ln -s /var/log/lino/bfoo log
Have a look at all the following files in the preview project and replace afoo with bfoo where needed:
envdirectory in the copy and create a new one with virtualenv. Activate the new env. Run pull.sh to update repositories. Install Lino from repositories.
Create the new database in mysql or pg
Add a vhost to make the preview site accessible to end-users
Setup a web page for release notes which serves as a roadmap to you and the users.
During the preparation phase you run repeatedly a script that synchronizes the preview site, i.e. migrates the production data to the preview site:
$ go preview $ ./initdb_from_prod.sh
When you and the users agree that preview seems ready for production, you announce a date and time for an upgrade attempt.
An upgrade attempt lasts an agreed lapse of time (e.g. one hour).
As the hosting provider you make sure that the preview site has been synchronized from the production site.
During the upgrade attempt users must test whether everything works as expected. They must be aware that their changes during this time might get lost in case they decide to cancel the attempt, and that they will remain if the attempt succeeds.