Skip to content

HTTPServer

DebRez edited this page Aug 20, 2019 · 10 revisions

HTTP Server Setup

This page describes how to setup the MTT HTTP Server used for submitting and viewing MTT results. Most of the code is written in PHP. This server works with both the perl and python MTT clients. To enable reporting from the python client follow the instructions in the MTT Wiki "MTT Cherrypy Server" after completing these instructions.

Note that different operating systems treat Httpd/Apache2 differently. This wiki was written while setting up the HTTP Server and PHP on OpenSUSE Leap 42.2.

Many instructions on setting up httpd/Apache2 suggest editing either the httpd.conf or apache2.conf (depends on operating system). This should be avoided because a future update of the software could overwrite those files. A better practice is to use a virtual host configuration file as described here.

MTT Setup

These instructions should be performed as root.
$MTT_TRUNK refers to the absolute path to your local root mtt installation. $WWW_ROOT refers to the absolute path to the www/mtt directory. Default is /var/www/mtt.

  1. Copy the files in $MTT_TRUNK/server/php to $WWW_ROOT. Make sure the files are readable by the Apache user. You may need to mkdir www.
$ cp -R $MTT_TRUNK/server/php $WWW_ROOT
$ chmod -R 755 $WWW_ROOT
  1. Create a tmp directory in $WWW_ROOT. This directory should be readable and writable by the Apache user since this is where graphs are temporarily stored. For example:
$ mkdir /var/www/mtt/tmp
$ mkdir /var/www/mtt/tmp/log
$ chmod -R 777 /var/www/mtt/tmp
  1. Edit the $WWW_ROOT/config.inc file. First create it:
$ cp /var/www/mtt/config.inc.tmpl /var/www/mtt/config.inc
  • If this is not the real MTT Reporter database server (i.e. it is something set up to troubleshoot issues) comment out the first section of the code from line 13 to line 26. Edit line 44 to reflect your local installation in /$WWW_ROOT (/var/www/mtt/body_suffix.html for example). Comment out mtt_http_username and mtt_http_password. Edit mtt_graph_tmp_dir and mtt_err_log_file to reflect your $WWW_ROOT/tmp directory.:
    • If you have a Google Analytics account you can specify the account number in the $mtt_google_analytics_account field.

    • Set the database name in $mtt_database_name as follows:

# Database name
$mtt_database_name = "mtt";
  • Set the database username in $mtt_database_username to the PostgreSQL user that will be accessing the database. Default is mtt.
  • Set the database user's password. There is an example of how to specify this in a text file if you do not want to put it in plain text here for security reasons.

Apache Setup

To install Apache2 with PHP support the following packages need to be installed (package names may differ based on your specific operating system):

apache2
php7
apache2-mod_php7
php7-pgsql

In the following sections we assume you have a directory called $WWW_ROOT that resolves to the address http://my-server/mtt. Make sure the file upload size settings are high enough to accept MTTDatabase submissions:

/etc/php7/apache2/php.ini:
; Maximum allowed size for uploaded files.
upload_max_filesize = 20M
; Maximum size of POST data that PHP will accept.
post_max_size = 20M

Create a virtual host configuration in Apache2 for the MTT Reporter server.

  1. cd to /etc/apache2/vhosts.d.
  2. cp vhost.template mtt_reporter.conf
  3. Edit the mtt_reporter.conf to reflect your setup.
<VirtualHost *:80>
    ServerName your_server_name.here
    DocumentRoot $WWW_ROOT
    ErrorLog $WWW_ROOT/tmp/log/MTT_Reporter_error.log
    CustomLog $WWW_ROOT/tmp/log/access.log combined
    <Directory "$$WWW_ROOT">
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
        # Limit Upload to 20Mb
        LimitRequestBody 20971520
    </Directory>

</VirtualHost>
  1. Start up the server and enable it to start on reboot.
$ systemctl start apache2      (or httpd)
$ systemctl enable apache2     (or httpd)
  1. Enable PHP with apache2 as follows.
$ a2enmod php7
  1. Go to http://my-server/mtt and you should see the reporter running.
  2. MTT Clients can submit data to http://my-server/mtt/submit.
Clone this wiki locally