Installing Lino on a production server

Here is a set of conventions which we suggest to use as a site maintainer when setting up a Lino production server.

Configure a Lino production server

Install getlino into a shared virtual environment outside of your home:

$ sudo mkdir /usr/local/lino/shared/env
$ cd /usr/local/lino/shared/env
$ sudo chown root:www-data .
$ sudo chmod g+ws .
$ virtualenv -p python3 master
$ . master/bin/activate
$ pip install getlino

Run getlino configure as root:

$ sudo env PATH=$PATH getlino configure

The env PATH=$PATH is needed to work around the controversial Debian feature of overriding the PATH for security reasons (source).

Install a first site. You will do the following for every new site on your server.

$ sudo env PATH=$PATH getlino startsite noi first

Point your browser to http://first.localhost

If your customers want to access their Lino from outside of their intranet, then you need to setup a domain name and add the --https option in above command line.

Some useful additions to your shell

Add the following to your system-wide /etc/bash.bashrc:

alias ll='ls -al'
alias a='. env/bin/activate'

function pywhich() {
  python -c "import $1; print($1.__file__)"
}

# find another name if your team also uses golang
function go() {
    for BASE in /usr/local/lino/lino_local
    do
      if [ -d $BASE/$1 ] ; then
        cd $BASE/$1;
        return;
      fi
    done
    echo Oops: no project $1
    return -1
}

If you want Logging all bash commands to syslog, then add also this:

# copied from http://backdrift.org/logging-bash-history-to-syslog-using-traps
function log2syslog
{
   declare COMMAND
   COMMAND=$(fc -ln -0)
   logger -p local1.notice -t bash -i -- "${USER}:${COMMAND}"
}
trap log2syslog DEBUG

After these changes you must close and reopen your terminal to activate them. You can now do the following to quickly cd to a project directory and activate its Python environment:

$ go prj1
$ a

Configure a Lino demo server

Warning : This is the deeper Python jungle. Don't try this before you have installed a few contributor environments and production servers.

Run getlino configure as root:

$ sudo -H env PATH=$PATH getlino configure --shared-env /usr/local/lino/shared/master --clone

That is, you say --clone and create a --shared-env.

You may create other shared envs by changing the branch and clone another set of repositories:

$ sudo -H env PATH=$PATH getlino configure --shared-env /usr/local/lino/shared/stable --clone --branch stable

Specify --shared-env when creating demo sites:

$ sudo -H env PATH=$PATH getlino startsite noi first --shared-env /usr/local/lino/shared/stable
$ sudo -H env PATH=$PATH getlino startsite tera second --shared-env /usr/local/lino/shared/master