-
Notifications
You must be signed in to change notification settings - Fork 47
HTTPServer
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.
These instructions should be performed as root.
$MTT_TRUNK refers to the absolute path to your local mtt installation.
$WWW_ROOT refers to the absolute path to the www/mtt directory. Default is /var/www/mtt.
- Copy the files in
$MTT_TRUNK/server/php
to$WWW_ROOT/www/mtt
. Make sure the files are readable by the Apache user. You may need to mkdir www.
cp -R $MTT_TRUNK/server/php $WWW_ROOT/www/mtt
chmod a +r $WWW_ROOT/www/mtt
- Create a
tmp
directory in$WWW_ROOT/www/mtt/
. This directory should be readable and writable by the Apache user since this is where graphs are temporarily stored.
mkdir $WWW_ROOT/www/mtt/tmp
chmod a +rw $WWW_ROOT/www/mtt/tmp
- Edit the
$WWW_ROOT/www/mtt/config.inc
file. First create it:
cp config.inc.tmpl 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 4 to line 26. Edit line 44 to reflect your local installation /$WWW_ROOT/www/mtt/body_suffix.html. Comment out mtt_http_username and mtt_http_password. Edit mtt_graph_tmp_dir and mtt_err_log_file to reflect your www/mtt/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.
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
In the following sections we assume you have a directory called $WWW_ROOT/www/mtt
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.
- cd to /etc/apache2/vhosts.d. May be /etc/httpd/vhosts.d
- cp vhost.template mtt_reporter.conf
- Edit the mtt_reporter.conf to reflect your setup.
<VirtualHost *:80>
ServerName your_server_name.here
DocumentRoot $WWW_ROOT/www/
ErrorLog /var/www/mtt/tmp/log/MTT_Reporter_error.log
CustomLog /var/www/mtt/tmp/log/access.log combined
<Directory "$WWW_ROOT/www/mtt">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
# Limit Upload to 20Mb
LimitRequestBody 20971520
</Directory>
</VirtualHost>
- Go to
http://my-server/mtt
and you should see the reporter running. - MTT Clients can submit data to
http://my-server/mtt/submit
.