Install | Topics | Beyond Lino
Set up a public demo server¶
A demo server is similar to a production server, but the sites contain demo data instead of production data, so you don’t need backups and the server usually updates automatically.
(1) Set up a main environment as described in
Set up a main environment, and then run getlino configure as follows:
# getlino configure --clone --web-server nginx --server-domain <YOUR_PUBLIC_DOMAIN_NAME> --https --monit --db-engine mysql --db-user demo --db-password demo
(2) The --clone option is optional, it means to clone all
repositories and to use the latest development versions. Without that option,
your demo server will show the released versions.
(3) Rename your pull.sh to pull_and_prep.sh and
modify it:
also run
pm prepandpm buildcacheon all demo sitesrestart supervisor
use echo instead of logger for output messages
See less `which pull_and_prep.sh` on an existing demo server for inspiration.
(4) Remove make_snapshot.sh entries from project
directories and supervisor config.
(5) To manualy upgrade all demo sites, say sudo su and then
run pull_and_prep.sh.
(6) Create a script silently_pull_and_prep.sh in
/usr/local/bin with this content:
#!/bin/bash
source /usr/local/lino/venvs/main/bin/activate
umask 002
LOGFILE=/var/log/lino/pull_and_prep.log
/usr/local/lino/venvs/main/bin/pull_and_prep.sh > $LOGFILE 2>&1 || cat $LOGFILE
(7) Create a file /etc/cron.d/pull_demos with this content:
00 4 * * * root /usr/local/bin/silently_pull_and_prep_demos.sh
(8) Note that we redirect stdout to a file, and if no error occurs (exitcode 0) the job just stops, but if some error occured, it outputs the full log, which will then be sent to the cron admins to notify them about the error.
Multiple versions¶
Instead of using a single virtualenv called main, you may use
multiple shared environments on your demo server.
You may create other shared virtualenvs by changing the branch and clone another set of repositories:
# getlino configure --shared-env /usr/local/lino/shared/latest --clone
# getlino configure --shared-env /usr/local/lino/shared/pypi
Specify --shared-env when creating demo sites:
# getlino startsite noi first --shared-env /usr/local/lino/shared/latest
# getlino startsite tera second --shared-env /usr/local/lino/shared/pypi