metamod:test

This is an old revision of the document!


How to test the software

The EXAMPLE application that is included in the source tree (app/example) can be used to test the software. The following steps describes how to do this.

1. Edit the app/example/master_config.txt file. Several variables in this file must be adjusted according to the local computer environment. The most important are:

SERVER The server name on which the software should run (something like mycomputer.mydomain.com).
SOURCE_DIRECTORY The absolute path of the source directory where the software is found.
TARGET_DIRECTORY The target directory to which the software is installed. Must NOT be a subdirectory of the SOURCE_DIRECTORY.
ADMIN_DOMAIN This will typically be the domain found in the SERVER variable (like mydomain.com).
BASE_PART_OF_EXTERNAL_URL This is the initial part of URLs that external links to the web applications are to use. It will typically be http://mycomputer.mydomain.com or http://mycomputer.mydomain.com:8080 if you are using an unusual port.
LOCAL_URL Appended to BASE_PART_OF_EXTERNAL_URL, this represents the top URL for the web applications. URLs for the individual applications are constructed by appending directory names for each of the applications to this top URL.
WEBRUN_DIRECTORY The top directory for the runtime environment.
OPENDAP_DIRECTORY The top directory of the data repository. This directory is assumed to be accessible through an OPeNDAP server which has to be installed as a separate package (not part of METAMOD 2.x). If no OPeNDAP server is installed, the METAMOD 2.x software will mostly work, apart from links to data files from the web applications.
OPENDAP_URL The URL used to access the data files. If no OPeNDAP server is installed, use an URL for HTTP download.
OPERATOR_EMAIL E-mail address for the person responsible for operating the METAMOD 2.x installation.

The app/example/master_config.txt file is already configured for testing, meaning that E-mails sent from the system to users are sent to the operator instead, and that the system works on a “virtual timescale” which goes faster than real time. But one variable has to be adjusted in the 'Test configuration' section of the master_config.txt:

TEST_IMPORT_BASETIME This variable should be set to the value returned by the upload/scripts/show_time_now.pl script, which returns the current time as “seconds since the epoch”.

2. To copy the software to the target directory and make the substitutions prescribed by the master_config.txt file, do the following:

cd to the source directory (i.e. the top METAMOD 2.x directory)
run:    ./update_target.pl app/example

3. Assuming the PostgreSQL software is already installed, the PostgreSQL users (admin and webuser) that are to access the database must be created. This step is only needed one time. PostgreSQL users are for the whole PostgreSQL installation, and not connected to specific databases.

cd to the target directory
run:    scripts/createusers.sh

Metamod assumes to be running on a safe-system. Please make sure that admin and webuser are allowed to connect to the database:

pslq -U admin template1

If this fails (or requires a password), consider updating pg_hba.conf to allow all local connections (requires a postgres restart):

# "local" is for Unix domain socket connections only
local   all         all                               trust
# IPv4 local connections:
host    all         all         127.0.0.1/32          trust
# IPv6 local connections:
host    all         all         ::1/128               trust

4. Initialize the runtime environment:

cd to the target directory
run:    ./prepare_runtime_env.sh

5. Initialize the database, and load static data:

cd to the target directory
cd init
run:    ./create_and_load_all.sh

You may check the output of this script in the create_and_load_all.out1) file in the same init directory. Also check the databaselog (path given by the LOGFILE variable in master_config.txt).

6. Ensure that you have a working Apache 2.x installation with PHP 5.x. The httpd daemon should run as the same user as the METAMOD 2.x perl scripts. Otherwise problems with access rights to files created by PHP and perl respectively will araise. These problems could be solved by using 'umask' and similar tools, but the METAMOD 2.x software is not prepared for this. The same runtime user for PHP and the perl scripts is assumed. The Apache installation must allow .htaccess files and softlinks.

7. Make the METAMOD 2.x URLs accessible through the Apache server. This can either be done by making the METAMOD 2.x htdocs directory the Apache 2.x DocumentRoot directory. Otherwise, this can be done by providing a symbolic link in the Apache 2.x DocumentRoot directory to the METAMOD 2.x htdocs directory. This symbolic link must agree with the LOCAL_URL set up in the master_config.txt file.

8. At this time all the web applications should work. Confirm this by visiting the URLs for the two main web pages in the example application (METAMODSEARCH and METAMODUPLOAD) from a browser (the URLs are found in the master_config.txt file). Check also that the administration web page is working.

9. Enter the METAMODUPLOAD web page from a browser and create a user account. The operator will recieve an E-mail with the user details and an URL. Activating this URL will admit the user into the system. After activating this URL, the user recieves an E-mail with a password. In the test environment, this E-mail will be sent to the operator instead.

10. Start the perl scripts responsible for loading data into the database:

cd to the target directory
run:     ./start_services.sh

11. Enter the METAMODUPLOAD web page from a browser and log into the user account you have created. Enter the “Administration” page and create the directory 'test1' (this will also be the name of a new dataset that later will be loaded into the database). Go back to the “Upload files” page and upload the two files test1_arctic20.200611.cdl and test1_synop_99710.cdl found in the testdata directory.

12. After a few minutes, check that metadata from the files have been loaded into the database. This can be done by looking at the databaselog (path defined by the LOGFILE variable in master_config.txt), and by entering the METAMODSEARCH web page and search for the data. You may also consult the output files from the two perl scripts started by start_services.sh: upload_monitor.out and import_dataset.out.

13. Do a similar exercise with the files test2_arctic20.200611.cdl and test2_synop_99710.cdl. A new directory/dataset has to be created for these files in the administration page: 'test2'. These files do not satisfy the requirements specified in the etc/conf_digest_nc.xml file. The perl script digesting these files will generate an error report that will be accessible from the METAMODUPLOAD web page. Also, the data provider will be sent an E-mail with a reference to this error report. In the test environment, this E-mail will be sent to the operator instead.

14. Stop the perl scripts responsible for loading data into the database:

cd to the target directory
run:     ./stop_services.sh

1)
Search for records containing the word “ERROR”
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
  • metamod/test.1282550865.txt.gz
  • Last modified: 2022-05-31 09:23:19
  • (external edit)