Permalink
82a11c6 Sep 30, 2015
@mgogoulos @jean
248 lines (165 sloc) 9.18 KB

Installation

This is the most up to date Plumi installation guide.

A comprehensive Plumi introduction/installation/maintenance/setup guide can be found at https://trinket.io/mgogoulos/courses/plumi-4-5#/.

There is also Plumi's user/admin manual at http://en.flossmanuals.net/Plumi/Introduction

Environment

We use and test Plumi mainly in Debian 7, using Python 2.7

Plumi users have reported that they've succesfully installed and run Plumi portals on Mint Linux 17 http://blog.plumi.org/2014/09/03/installation-on-mint-linux-17/ and FreeBSD 9.1 http://blog.plumi.org/2014/09/03/plumi-installed-successfully-on-free-bsd-9-1/


Quick installation

This assumes you are on ubuntu/debian

step 1: install the necessary packages:

#apt-get install build-essential pkg-config git-core python-dev libjpeg62-dev zlib1g-dev libxslt1-dev groff-base libbz2-dev

You may have to install some more packages if you are building a development environment:

#apt-get install subversion

step 2: get the Plone 4.2 installer from plone.org

step 3: run the installer, and let it build Python

step 2: in the instance directory created by the installer, get plumi from github and ceate a virtualenv environment:

$rm *.cfg *.py
$git clone https://github.com/plumi/plumi.app .
$virtualenv .

step 3: edit site.cfg and change users, if necessary (ftp user, cache user, etc):

$vi site.cfg

step 4: run the buildout:

$./bin/buildout -Nv

step 5: run the buildout for ffmpeg:

$cd ffmpeg
$virtualenv .
$./bin/pip install zc.buildout
$./bin/buildout -Nv

step 6: start supervisord as root, this will start all services as users defined in site.cfg:

#./bin/supervisord

Now check that services have started:

root@userx:/home/user/plumi# ./bin/supervisorctl status
cache                            RUNNING    pid 22650, uptime 0:21:29
nginx                            RUNNING    pid 22651, uptime 0:21:29
ploneftp                         RUNNING    pid 22649, uptime 0:21:29
transcodedaemon                  RUNNING    pid 22612  uptime 0:21:29
uwsgi                            RUNNING    pid 22646, uptime 0:21:29
worker                           RUNNING    pid 22647, uptime 0:21:29
zeo                              RUNNING    pid 22645, uptime 0:21:29

If you start plumi as normal user, without changing the default ports, it will not be able to load nginx to port 80, and also start cacher, since default user for cacher is root. Make sure you edit site.cfg and change the users if you have not root priviledges.

System dependencies

  • install gcc/g++ dev tools

    e.g. sudo apt-get install build-essential pkg-config

  • install git

    e.g. sudo apt-get install git-core

  • install python and header files (tested with python 2.6 and 2.7)

    e.g. sudo apt-get install python-dev

  • install libjpeg, zlib, libpcre, libxslt header files

    e.g. sudo apt-get install libjpeg62-dev zlib1g-dev, libxslt1-dev or for Ubuntu 11.04 jpeg support: sudo apt-get install libjpeg8-dev for png support in Ubuntu 11.04 you may have to install zlib from source

  • install groff-base

    e.g. sudo apt-get install groff-base

Creating a Python Virtual Environment

If you are running other applications and web sites on your server, it may be worth while creating a python virtual environment for developing in - this can avoid problems between python packages installed by your operating system and those installed by easy_install. You will need to have the virtualenv package installed first - in Debian and Ubuntu systems you can apt-get install python-virtualenv, then:

virtualenv --no-site-packages plumi.app

Initial configuration

This step is optional for testing/development builds. However, even in those cases you may wish to customize some of the options inside site.cfg, especially if ports 8080, 8888, 8021, 8000, 8100 or 8890 are already used by other apps in your system.

If you're deploying for production you should have 2 different hostnames available, one for your Plumi site (e.g. new.plumi.org) and another for the transcoder/videoserver (e.g.newvideos.plumi.org), both pointing to your public ip address. You could also install the transcoding server in a different machine or even have multiple transcoding servers with load balancing, but this setup will not be covered in this guide. Please ensure that these hostnames are set up in advance of your site installation and have had sufficient time to propagate through the Internet (eg: 24-48 hours). If you server is not going to be accessed from the Internet, you still need to set up the domains within your private network (eg: internal DNS server, /etc/hosts files on all workstations, etc).

Before running buildout, you should customize the options inside site.cfg. At the very least you should change the following:

  • secret: a shared secret key for encrypted communication between Plumi and

    transcodedaemon. Just enter a random string of 4, 8, 16 or 32 characters.

  • www-server-name: the hostname of your Plumi site (e.g. www.engagemedia.org)

  • www-videoserver-name: the hostname of your transcoder & videoserver

    (e.g. videos.engagemedia.org)

If you decided not to change the default user for zope, zeo and transcode in site.cfg make sure that it exists in your system. If not, add it:

sudo useradd zope

Install Plumi 4.x

Once you're ready with the initial configuration execute the following two commands. Do it as your regular user for testing/dev builds but make sure you are root for production builds:

cd ffmpeg
python bootstrap.py (or ../bin/python bootstrap.py if you use virtualenv)
./bin/buildout

After the ffmpeg buildout is finished you should run the plumi buildout:

cd ..
python bootstrap.py (or ./bin/python bootstrap.py if you use virtualenv)
./bin/buildout

That should take some time, so feel free to get some cofee or fresh air while buildout is downloading, compiling and installing dependencies (Zope, Plone, ffmpeg, etc). If all goes well your Plumi instance will be ready after that point.

Running Plumi 4.x

Supervisor will be managing the internal ZEO server, the transcodedaemon, the async worker instance, the varnish cache server, the uwsgi WSGI web server, as well as the externally facing ploneFTP server and the nginx web server in production builds.

Start supervisor like this:

./bin/supervisord

Confirm that zeo, uwsgi and transcodedaemon are up and running:

./bin/supervisorctl status

If you ran buildout as a regular (non root) user and you did not change the default ports for nginx and ploneftp in site.cfg (www-address & plumiftp-address respectively) you'll see that both ploneftp and nginx failed to start because you don't have permission to bind on to the priviledged ports 80 and 21. Nothing to worry about if you're just evaluating Plumi, you can still use it without nginx. Just go to port 8000 on localhost to access directly the uwsgi web server.

Run the plumisite command to create a new Plumi site:

./bin/plumisite

Alternatively, if you can create the Plumi site through the web, using the ZMI.

After that step you're ready to roll! Your new Plumi site will be available at http://localhost:8000/Plone or at http://{www-server-name} for production builds.

If you want to do some development, you can use Paster instead of uwsgi since the latter is more suited for production. Stop uwsgi and start paster as shown below:

./bin/supervisorctl stop uwsgi

./bin/paster serve development.ini --reload

The --reload option will consume more resources but it's very handy for dev since it will automatically reload any python modules that you edit.

If you have changed the default port, hostname, or the secret encryption key for the transcode daemon in site.cfg, you should go to the transcode settings panel (e.g. http://localhost:8000/Plone/@@transcode-controlpanel ) and enter the same host, port and key there.

Add a new user to your Plumi site for testing and start publishing videos!

In order to shutdown all Plumi related services, use the following command:

./bin/supervisorctl shutdown

If you want to ensure that Plumi will start automatically whenever your server is turned on, add the following lines to your /etc/rc.local file replacing PATH_TO_PLUMI with the actual absolute path of your plumi setup:

PATH_TO_PLUMI/bin/supervisord

Configuring Video statistics

To record and show video views and downloads you'll need a working Piwik installation. Add the tracking tag in Site-Setup->Site and fill the form in Site-Setup-> Piwik Settings with the piwik url, the site id on piwik and the api key (if you have anonymous access on piwik for your site you can leave anonymous instead of the API key).

Configuring subtitles and downloads

By default, subtitle support through Universal Subtitles is enabled. You can disable it through Site Setup->Transcode Settings. You can also disable downloads through embedded videos there.