Installing MediaMosa

Downloading your MediaMosa

Unpack you MediaMosa

  • Unpack it to your web directory (typically /var/www/your-site or /srv/www/your-site).

Set up Database

We advice using MySQL v5.1, or use MySQL variant like MariaDB.

MediaMosa is currently untested with PostgreSQL.

Use the database mediamosa example below to create your database 'mediamosa' with user 'mediamosa' before proceeding.

# The password entries below needs to be changed.

# Create the database.
CREATE DATABASE mediamosa DEFAULT CHARSET=utf8;

# Create localhost access for user 'mediamosa'.
CREATE USER 'mediamosa'@'localhost' IDENTIFIED BY 'mediamosa';

# Now grant usage for user 'mediamosa' on the 'mediamosa' database.
GRANT USAGE ON mediamosa.* TO 'mediamosa'@'localhost' IDENTIFIED BY 'mediamosa'
 WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0;

GRANT ALL ON mediamosa.* TO 'mediamosa'@'localhost';

You may change the 'mediamosa' database prefix and the database user name.

If you want to migrate your current MediaMosa v1.7 database to the new 2.x version, you have to create or have a database user, which has enough rights to read your current v1.7 databases.

Mount point

Create a mount point with read / write rights for Apache user (www-data), eg. /srv/mediamosa

Apache

Insert the vhost setup below into the new file /etc/apache2/sites-available/your-site, where your-site is the name of your MediaMosa site.

  • !server_name_clean => The server name of your MediaMosa installation, eg. mymediamosa.com
  • !document_root => The path of your MediaMosa installation on your server, eg. /var/www/mediamosa
  • !mount_point => Your SAN/NAS mount point, eg. /srv/mediamosa
<VirtualHost *:80>
    ServerName !server_name_clean
    ServerAlias admin.!server_name_clean www.!server_name_clean
    ServerAdmin webmaster@!server_name_clean
    DocumentRoot !document_root
    <Directory !document_root>
        Options FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>

    ErrorLog /var/log/apache2/!server_name_clean_error.log
    CustomLog /var/log/apache2/!server_name_clean_access.log combined
    ServerSignature On

    Alias /server-status !document_root
    <Directory !document_root/serverstatus>
        SetHandler server-status
        Order deny,allow
        Deny from all
        Allow from 127.0.0.1
     </Directory>

    # ticket
    Alias /ticket !mount_point/links
    <Directory !mount_point/links>
      Options FollowSymLinks
      AllowOverride All
      Order deny,allow
      Allow from All
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    ServerName app1.!server_name_clean
    ServerAdmin webmaster@!server_name_clean
    DocumentRoot !document_root
    <Directory !document_root>
        Options FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>

    ErrorLog /var/log/apache2/app1.!server_name_clean_error.log
    CustomLog /var/log/apache2/app1.!server_name_clean_access.log combined
    ServerSignature On
</VirtualHost>

<VirtualHost *:80>
    ServerName app2.!server_name_clean
    ServerAdmin webmaster@!server_name_clean
    DocumentRoot !document_root
    <Directory !document_root>
        Options FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>

    ErrorLog /var/log/apache2/app2.!server_name_clean_error.log
    CustomLog /var/log/apache2/app2.!server_name_clean_access.log combined
    ServerSignature On
</VirtualHost>

<VirtualHost *:80>
    ServerName upload.!server_name_clean
    ServerAdmin webmaster@!server_name_clean
    DocumentRoot !document_root
    <Directory !document_root>
        Options FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>

    <IfModule mod_php5.c>
        php_admin_value post_max_size 2008M
        php_admin_value upload_max_filesize 2000M
        php_admin_value memory_limit 128M
    </IfModule>

    ErrorLog /var/log/apache2/upload.!server_name_clean_error.log
    CustomLog /var/log/apache2/upload.!server_name_clean_access.log combined
    ServerSignature On
</VirtualHost>

<VirtualHost *:80>
    ServerName download.!server_name_clean
    ServerAdmin webmaster@!server_name_clean
    DocumentRoot !document_root
    <Directory !document_root>
        Options FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>

    ErrorLog /var/log/apache2/download.!server_name_clean_error.log
    CustomLog /var/log/apache2/download.!server_name_clean_access.log combined
    ServerSignature On
</VirtualHost>

<VirtualHost *:80>
    ServerName job1.!server_name_clean
    ServerAdmin webmaster@!server_name_clean
    DocumentRoot !document_root
    <Directory !document_root>
        Options FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>

    ErrorLog /var/log/apache2/job1.!server_name_clean_error.log
    CustomLog /var/log/apache2/job1.!server_name_clean_access.log combined
    ServerSignature On
</VirtualHost>

<VirtualHost *:80>
    ServerName job2.!server_name_clean
    ServerAdmin webmaster@!server_name_clean
    DocumentRoot !document_root
    <Directory !document_root>
        Options FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>

    ErrorLog /var/log/apache2/job2.!server_name_clean_error.log
    CustomLog /var/log/apache2/job2.!server_name_clean_access.log combined
    ServerSignature On
</VirtualHost>

Real example /etc/apache2/site-available/mediamosa:

<VirtualHost *>
  ServerName mediamosa
  ServerAlias mediamosa.local app1.mediamosa.local upload.mediamosa.local download.mediamosa.local openapi.mediamosa.local
  DocumentRoot /home/user/mediamosa

  <Directory /home/user/mediamosa>
   Options Indexes FollowSymLinks MultiViews
   AllowOverride All
    Order deny,allow
    Allow from All
  </Directory>

  Alias /server-status /home/user/mediamosa
  <Directory /home/user/mediamosa/serverstatus>
      SetHandler server-status
      Order deny,allow
      Deny from all
      Allow from 127.0.0.1
   </Directory>

  Alias /ticket /srv/mediamosa/links
  <Directory /srv/mediamosa/links>
   Options FollowSymLinks
   AllowOverride All
    Order deny,allow
    Allow from All
  </Directory>

  LogLevel warn
  ErrorLog /var/log/apache2/error.log
  CustomLog /var/log/apache2/access.log combined

  <IfModule mod_php5.c>
    php_admin_value post_max_size 2000M
    php_admin_value upload_max_filesize 2000M
    php_admin_value memory_limit 256M
  </IfModule>

</VirtualHost>

<VirtualHost *>
    ServerName job1.mediamosa.local
    ServerAdmin webmaster@mediamosa.local
    DocumentRoot /home/user/mediamosa
    <Directory /home/user/mediamosa>
        Options FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>

    ErrorLog /var/log/apache2/job1.mediamosa_error.log
    CustomLog /var/log/apache2/job1.mediamosa_access.log combined
    ServerSignature On
</VirtualHost>

<VirtualHost *>
    ServerName job2.mediamosa.local
    ServerAdmin webmaster@mediamosa.local
    DocumentRoot /home/user/mediamosa
    <Directory /home/user/mediamosa>
        Options FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>

    ErrorLog /var/log/apache2/job2.mediamosa_error.log
    CustomLog /var/log/apache2/job2.mediamosa_access.log combined
    ServerSignature On
</VirtualHost>

And example /etc/hosts data:

127.0.0.1       mediamosa
127.0.0.1       mediamosa.local
127.0.0.1       app1.mediamosa.local
127.0.0.1       app2.mediamosa.local
127.0.0.1       job1.mediamosa.local
127.0.0.1       job2.mediamosa.local
127.0.0.1       upload.mediamosa.local
127.0.0.1       download.mediamosa.local
127.0.0.1       openapi.mediamosa.local
  • In the default Apache2 docroot configuration, set the 'AllowOverride' parameter to 'All'. This enables so-called Clean URLs to be used for the REST services, i.e. without ?q= syntax.

Single-server setup with http://localhost/ for demonstration or testing purposes.

  • Add the following lines to your default localhost apache definition:
        # ticket
        Alias /ticket !mount_point/links
        <Directory !mount_point/links>
          Options FollowSymLinks
          AllowOverride All
          Order deny,allow
          Allow from All
        </Directory>
    
        <IfModule mod_php5.c>
            php_admin_value post_max_size 2008M
            php_admin_value upload_max_filesize 2000M
            php_admin_value memory_limit 128M
        </IfModule>
    

Enable the website:

sudo a2ensite your-site

Restart Apache:

sudo /etc/init.d/apache2 restart

PHP

  • In the PHP configuration file php.ini, set memory_limit = 128M.
  • Recommended settings:
    max_execution_time = 30
    max_input_time = 60
    memory_limit = 128M
    
    error_reporting = E_ALL & ~E_NOTICE
    

Start your new site

  • Load your new site, chose the Mediamosa profile and follow the instruction.

Cron

Set up your cron. The cron will be used trigger MediaMosa every minute for background jobs. The setup for cron is required for MediaMosa to run properly.

Modify your cron using crontab:

  • Use this command to edit your crontab: crontab -e
  • It opens an editor for your with your current crontab settings. Add this line at the bottom:
  • * * * * * /usr/bin/wget -O - -q -t 1 --header="Host: your-host-name" !http://localhost/cron.php?cron_key=your-cron-key
    • your-host-name => the server name of your MediaMosa installation, eg. mymediamosa.com
    • your-cron-key => your cron key, eg. e802ef99d978946398f746d870749c30, you can check it on this page: http://your-mediamosa/admin/reports/status
  • You can check your cron key on this page: admin/reports/status

Drupal related settings

  • Go to your MediaMosa sites directory.
  • Check these directories:
    • app1.mediamosa.local
    • app2.mediamosa.local
    • default
    • download.mediamosa.local
    • job1.mediamosa.local
    • job2.mediamosa.local
    • openapi.mediamosa.local
    • upload.mediamosa.local
    • AND:
  • Create a symlink to your example.setting.php on the same directories with the name settings.php
  • Create files directories too, with read/write permission to the apache user (www-data)
  • These are the interfaces (app, upload, download, job) is for Drupal just another website using the same Drupal installation. So in short; you are re-using your MediaMosa installation for more than one 'interface'. The admin is the main website and should be your default. So under sites/default is the administration website. Here you find settings.php. In this (default.)settings.php at the end you find 4 switches;
    • $conf['mediamosa_app'] = TRUE;
    • $conf['mediamosa_app_upload'] = TRUE;
    • $conf['mediamosa_app_download'] = TRUE;
    • $conf['mediamosa_admin'] = TRUE;
    • $conf['mediamosa_app_openapi'] = FALSE;
    • In the default setup, these are all TRUE (except "openapi"). This will allow some basic testing and is only for testing.
    • So for /sites/default/settings.php, turn all to FALSE except the $conf['mediamosa_admin'], keep that on TRUE. Now you have your admin.
    • Check the other interfaces too. Let's every config FALSE except the listed ones:
      • app1.mediamosa.local: $conf['mediamosa_app'] = TRUE;
      • app2.mediamosa.local: $conf['mediamosa_app'] = TRUE;
      • default: $conf['mediamosa_admin'] = TRUE;
      • download.mediamosa.local: $conf['mediamosa_app_download'] = TRUE;
      • job1.mediamosa.local: $conf['mediamosa_app'] = TRUE;
      • job2.mediamosa.local: $conf['mediamosa_app'] = TRUE;
      • openapi.mediamosa.local: $conf['mediamosa_app_openapi'] = TRUE;
      • upload.mediamosa.local: $conf['mediamosa_app_upload'] = TRUE;
  • More info:
    BASIC INSTALLATION GUIDE
    ------------------------
    
    Each MediaMosa (2.x) installation is split up into multiple URLs. Where each
    URL can be a different server. However, you can setup MediaMosa on one server,
    although only recommended for small websites or for testing purposes.
    
    The servers can be split up into these types;
    
    admin     - This is the drupal website for maintenance (default map).
    job       - A job server handles transcoding, creation of stills.
                (job1 / job2.mediamosa.local maps)
    app       - A app server handles REST calls, for example seaching and retrieving
                data from the database is done using REST calls on these servers.
                (app1 / app2.mediamosa.local maps)
    download  - A download server handles downloads of uploaded (media) files.
                (download.mediamosa.local map)
    upload    - A upload server handles uploads of (media) files like video/audio.
                (upload.mediamosa.local map)
    
    All types can be installed one server. However its good practice to use
    different URLs for each type. In our example setup we use 2xapp and 2xjob
    servers and we use the domain mediamosa.local. You are not required to use the
    example and adjust for own needs. All types are required. Upload and download
    can be combined and both can be used on the main website.
    
    The job servers are handled by MediaMosa, the number of process slots should be
    the same as number of processors in the server.
    
    Using more than one app server requires http load balancing, having the load
    balancer on app.mediamosa.local (example name) using app1 / app2 etc as child
    servers.
     
    Remember:
    Job, app, download and upload are REST interfaces.
    All types requires the complete installation.
    Download and upload REST interfaces are restricted to only REST calls that are
    related for download and/or upload.
    Each settings.php re-uses the default settings.
    Good practice is to study the example settings.php files.
    Enabling app/job and admin on the same URL/server will create conflicts with 
    /user uri of Drupal and REST calls that use /user in their URI. In most cases
    its smart to have one admin and no other types on it. In 2.x its no longer
    required to have multiple admins for each server type, all installations use
    the same database and is no longer split up on job servers like it was in 1.x.
    
  • More info: http://mediamosa.org/content/logout-problem-error-message-and-re-login-impossible#comment-652

Something went wrong. What should I do?

Don't hesitate to contact us.