Skip to content

specify/sp6-stats

Repository files navigation

Specify 6 Usage Statistics

This website provides some information on the usage of Specify 6.

Screenshots

Main page Feedback Exceptions Usage Stats Collection Object count for KU collection Query Edit count for KU collection

Private

The UI for displaying the usage stats.

Installation

Configuration

  1. Clone this repository

  2. Install Docker and Docker compose

  3. Copy ./env.example file to ./.env and change the variables as applicable

  4. Edit docker-compose.yml in all the places where you see CHANGE THIS:

  5. Copy ./sp7-stats/config/auth.example.conf to ./sp7-stats/config/auth.conf and change the variables as applicable. That would require you to create a GitHub OAuth App. See the instructions

  6. Generate fullchain.pem and privkey.pem (certificate and the private key) using Let's Encrypt and put (or symlink) these files into the ./sp7-stats/config/ directory.

    While in development, you can generate self-signed certificates:

    openssl req \
       -x509 -sha256 -nodes -newkey rsa:2048 -days 365 \
       -keyout ./sp7-stats/config/privkey.pem \
       -out ./sp7-stats/config/fullchain.pem
  7. It is recommended to set up daily cron to the following location http://<yourdomain>/cron/refresh_data.php. This will automatically unzip the files and compile the information so that users can get up to date data.

  8. It is also highly recommended to create indexes for track and trackitem tables in the stats database:

    SHOW INDEX FROM `track`; # Show existing indexes for `track`
    SHOW INDEX FROM `trackitem`; # Show existing indexes for `trackitem`
    CREATE UNIQUE INDEX `track_index` on `track` (`trackid`,`ip`,`timestampcreated`); # Create indexes for `track`
    CREATE UNIQUE INDEX `trackitem_index` on `trackitem` (`trackid`,`name`,`value`,`countamt`); # Create indexes for `trackitem`

Start up

Production

Start the containers: docker compose up -d

Development

Start the containers:

docker-compose \                                                                       2m 53s
  -f docker-compose.yml \
  -f docker-compose.development.yml \
  up --build

In development, MariaDB database is accessible outside Docker and a ./source-data/ directory is mounted into the container.

Optional settings

You can go over the other settings in the ./config/optional.php and ./config/cache.php files and see if there is anything you would like to adjust.

For example, you can change the duration of time before compiled data is considered out of date by changing CACHE_DURATION. The default value is set to 7 daysanalytics

Public

The endpoint for collecting incoming stats from Specify 6

The public directory is meant to be served at specify6-prod.nhm.ku.edu.

Credit for used resources

There were snippets of code/files from the following resources used: