ess-acppo / ag-bie

This repository has the code to the agriculture's implementation of ALA BIE
1 stars 4 forks source link

Add date of last index creation to home page #15

Closed ess-acppo-djd closed 4 years ago

ess-acppo-djd commented 6 years ago

Somewhere on the homepage provide the date and time the index was last processed. This should be the date and time the "tlog" file is created in the directory /data/solr/bie/data/tlog.

Note that processing alternates between the directory

/data/solr/bie/data

and the directory

/data/solr/bie/data-offline

mbohun commented 6 years ago

NOTE: this is related/overlapping with issue: #13

mbohun commented 6 years ago

The first/simple implementation:

  1. as user tomcat (sudo su tomcat7 -s/bin/bash):
    echo \
       '<Context path="/version/" docBase="/var/lib/tomcat7/webapps-sit-ag-bie.oztaxa.com/version/" />' \
       > /var/lib/tomcat7/conf/Catalina/sit-ag-bie.oztaxa.com/version.xml
  2. still as user tomcat:
    mkdir -p /var/lib/tomcat7/webapps-sit-ag-bie.oztaxa.com/version
  3. as admin/sudo-er (user ubuntu), restart tomcat:
    sudo systemctl restart tomcat7.service
  4. as user tomcat create a test JSON file in /var/lib/tomcat7/webapps-sit-ag-bie.oztaxa.com/version, for example (info.json); NOTE: This is the JSON file that will be automatically re-generated/written every time we run the SOLR combine taxas (jenkins job-s / script-s):
    {
        "env": "SIT",
        "ag-bie": "0.4",
        "input": {
            "generated": "2018-08-21 16:35",
            "NAQS": {
                "tblBiota": "tblBiota_20180821.csv"
            },
            "BNTi-icn": {
                "nsl_dawr_bieexport": "https://dev56-icn.oztaxa.com/nxl/services/export/namesCsv"
            }
        },
        "comment": "THIS IS ONLY AN EXAMPLE!"
    }
  5. test it from a client over HTTPS:
    mbohun@linux-cr70:~> curl -s https://sit-ag-bie.oztaxa.com/version/info.json | jq '.'
    {
      "env": "SIT",
      "ag-bie": "0.4",
      "input": {
        "generated": "2018-08-21 16:35",
        "NAQS": {
          "tblBiota": "tblBiota_20180821.csv"
        },
        "BNTi-icn": {
          "nsl_dawr_bieexport": "https://dev56-icn.oztaxa.com/nxl/services/export/namesCsv"
        }
      },
      "comment": "THIS IS ONLY AN EXAMPLE!"
    }
mbohun commented 6 years ago

Although it is possible to read/report the time from /data/solr/bie/data/tlog//data/solr/bie/data-offline/tlog you will need some mechanism to find out which one is the most "recent one":

ubuntu@ip-172-31-16-30:~$ ls -lahF /data/solr/bie/data-offline/tlog/
total 3.8M
drwxr-xr-x 2 tomcat7 tomcat7 4.0K Aug 22 00:20 ./
drwxr-xr-x 4 tomcat7 tomcat7 4.0K Jul 25 11:18 ../
-rw-r--r-- 1 tomcat7 tomcat7 3.8M Aug 22 00:20 tlog.0000000000000000188
ubuntu@ip-172-31-16-30:~$ ls -lahF /data/solr/bie/data/tlog/
total 1.4M
drwxr-xr-x 2 tomcat7 tomcat7 4.0K Aug 21 00:21 ./
drwxr-xr-x 4 tomcat7 tomcat7 4.0K Jul 25 11:18 ../
-rw-r--r-- 1 tomcat7 tomcat7 1.4M Aug 21 00:21 tlog.0000000000000000172

Possible solutions/alternatives:

moziauddin commented 4 years ago

This is not needed based on the business requirements at this stage