mirror of
https://github.com/alanorth/cgspace-notes.git
synced 2024-12-18 11:12:18 +01:00
351 lines
15 KiB
Markdown
351 lines
15 KiB
Markdown
---
|
|
title: "November, 2021"
|
|
date: 2021-11-02T22:27:07+02:00
|
|
author: "Alan Orth"
|
|
categories: ["Notes"]
|
|
---
|
|
|
|
## 2021-11-02
|
|
|
|
- I experimented with manually sharding the Solr statistics on DSpace Test
|
|
- First I exported all the 2019 stats from CGSpace:
|
|
|
|
```console
|
|
$ ./run.sh -s http://localhost:8081/solr/statistics -f 'time:2019-*' -a export -o statistics-2019.json -k uid
|
|
$ zstd statistics-2019.json
|
|
```
|
|
|
|
<!--more-->
|
|
|
|
- Then on DSpace Test I created a `statistics-2019` core with the same instance dir as the main `statistics` core (as [illustrated in the DSpace docs](https://wiki.lyrasis.org/display/DSDOC6x/Testing+Solr+Shards))
|
|
|
|
```console
|
|
$ mkdir -p /home/dspacetest.cgiar.org/solr/statistics-2019/data
|
|
# create core in Solr admin
|
|
$ curl -s "http://localhost:8081/solr/statistics/update?softCommit=true" -H "Content-Type: text/xml" --data-binary "<delete><query>time:2019-*</query></delete>"
|
|
$ ./run.sh -s http://localhost:8081/solr/statistics-2019 -a import -o statistics-2019.json -k uid
|
|
```
|
|
|
|
- The key thing above is that you create the core in the Solr admin UI, but the data directory must already exist so you have to do that first in the file system
|
|
- I restarted the server after the import was done to see if the cores would come back up OK
|
|
- I remember last time I tried this the manually created statistics cores didn't come back up after I rebooted, but this time they did
|
|
|
|
## 2021-11-03
|
|
|
|
- While inspecting the stats for the new statistics-2019 shard on DSpace Test I noticed that I can't find any stats via the DSpace Statistics API for an item that _should_ have some
|
|
- I checked on CGSpace's and I can't find them there either, but I see them in Solr when I query in the admin UI
|
|
- I need to debug that, but it doesn't seem to be related to the sharding...
|
|
|
|
## 2021-11-04
|
|
|
|
- I spent a little bit of time debugging the Solr bug with the statistics-2019 shard but couldn't reproduce it for the few items I tested
|
|
- So that's good, it seems the sharding worked
|
|
- Linode alerted me to high CPU usage on CGSpace (linode18) yesterday
|
|
- Looking at the Solr hits from yesterday I see 91.213.50.11 making 2,300 requests
|
|
- According to AbuseIPDB.com this is owned by Registrarus LLC (registrarus.ru) and it has been reported for malicious activity by several users
|
|
- The ASN is 50340 (SELECTEL-MSK, RU)
|
|
- They are attempting SQL injection:
|
|
|
|
```console
|
|
91.213.50.11 - - [03/Nov/2021:06:47:20 +0100] "HEAD /bitstream/handle/10568/106239/U19ArtSimonikovaChromosomeInthomNodev.pdf?sequence=1%60%20WHERE%206158%3D6158%20AND%204894%3D4741--%20kIlq&isAllowed=y HTTP/1.1" 200 0 "https://cgspace.cgiar.org:443/bitstream/handle/10568/106239/U19ArtSimonikovaChromosomeInthomNodev.pdf" "Mozilla/5.0 (X11; U; Linux i686; en-CA; rv:1.8.0.10) Gecko/20070223 Fedora/1.5.0.10-1.fc5 Firefox/1.5.0.10"
|
|
```
|
|
|
|
- Another is in China, and they grabbed 1,200 PDFs from the REST API in under an hour:
|
|
|
|
```console
|
|
# zgrep 222.129.53.160 /var/log/nginx/rest.log.2.gz | wc -l
|
|
1178
|
|
```
|
|
|
|
- I will continue to split the Solr statistics back into year-shards on DSpace Test (linode26)
|
|
- Today I did all 2018 stats...
|
|
- I want to see if there is a noticeable change in JVM memory, Solr response time, etc
|
|
|
|
## 2021-11-07
|
|
|
|
- Update all Docker containers on AReS and rebuild OpenRXV:
|
|
|
|
```console
|
|
$ docker images | grep -v ^REPO | sed 's/ \+/:/g' | cut -d: -f1,2 | xargs -L1 docker pull
|
|
$ docker-compose build
|
|
```
|
|
|
|
- Then restart the server and start a fresh harvest
|
|
- Continue splitting the Solr statistics into yearly shards on DSpace Test (doing 2017, 2016, 2015, and 2014 today)
|
|
- Several users wrote to me last week to say that workflow emails haven't been working since 2021-10-21 or so
|
|
- I did a test on CGSpace and it's indeed broken:
|
|
|
|
```console
|
|
$ dspace test-email
|
|
|
|
About to send test email:
|
|
- To: fuuuu
|
|
- Subject: DSpace test email
|
|
- Server: smtp.office365.com
|
|
|
|
Error sending email:
|
|
- Error: javax.mail.SendFailedException: Send failure (javax.mail.AuthenticationFailedException: 535 5.7.139 Authentication unsuccessful, the user credentials were incorrect. [AM5PR0701CA0005.eurprd07.prod.outlook.com]
|
|
)
|
|
|
|
Please see the DSpace documentation for assistance.
|
|
```
|
|
|
|
- I sent a message to ILRI ICT to ask them to check the account/password
|
|
- I want to do one last test of the Elasticsearch updates on OpenRXV so I got a snapshot of the latest Elasticsearch volume used on the production AReS instance:
|
|
|
|
```console
|
|
# tar czf openrxv_esData_7.tar.xz /var/lib/docker/volumes/openrxv_esData_7
|
|
```
|
|
|
|
- Then on my local server:
|
|
|
|
```console
|
|
$ mv ~/.local/share/containers/storage/volumes/openrxv_esData_7/ ~/.local/share/containers/storage/volumes/openrxv_esData_7.2021-11-07.bak
|
|
$ tar xf /tmp/openrxv_esData_7.tar.xz -C ~/.local/share/containers/storage/volumes --strip-components=4
|
|
$ find ~/.local/share/containers/storage/volumes/openrxv_esData_7 -type f -exec chmod 660 {} \;
|
|
$ find ~/.local/share/containers/storage/volumes/openrxv_esData_7 -type d -exec chmod 770 {} \;
|
|
# copy backend/data to /tmp for the repository setup/layout
|
|
$ rsync -av --partial --progress --delete provisioning@ares:/tmp/data/ backend/data
|
|
```
|
|
|
|
- This seems to work: all items, stats, and repository setup/layout are OK
|
|
- I merged my [Elasticsearch pull request](https://github.com/ilri/OpenRXV/pull/126) from last month into OpenRXV
|
|
|
|
## 2021-11-08
|
|
|
|
- File [an issue for the Angular flash of unstyled content](https://github.com/DSpace/dspace-angular/issues/1391) on DSpace 7
|
|
- Help Udana from IWMI with a question about CGSpace statistics
|
|
- He found conflicting numbers when using the community and collection modes in Content and Usage Analysis
|
|
- I sent him more numbers directly from the DSpace Statistics API
|
|
|
|
## 2021-11-09
|
|
|
|
- I migrated the 2013, 2012, and 2011 statistics to yearly shards on DSpace Test's Solr to continute my testing of memory / latency impact
|
|
- I found out why the CI jobs for the DSpace Statistics API had been failing the past few weeks
|
|
- When I reverted to using the original falcon-swagger-ui project after they apparently merged my Falcon 3 changes, it seems that they actually only merged the Swagger UI changes, not the Falcon 3 fix!
|
|
- I switched back to using my own fork and now it's working
|
|
- Unfortunately now I'm getting an error installing my dependencies with Poetry:
|
|
|
|
```console
|
|
RuntimeError
|
|
|
|
Unable to find installation candidates for regex (2021.11.9)
|
|
|
|
at /usr/lib/python3.9/site-packages/poetry/installation/chooser.py:72 in choose_for
|
|
68│
|
|
69│ links.append(link)
|
|
70│
|
|
71│ if not links:
|
|
→ 72│ raise RuntimeError(
|
|
73│ "Unable to find installation candidates for {}".format(package)
|
|
74│ )
|
|
75│
|
|
76│ # Get the best link
|
|
```
|
|
|
|
- So that's super annoying... I'm going to try using Pipenv again...
|
|
|
|
## 2021-11-10
|
|
|
|
- 93.158.91.62 is scraping us again
|
|
- That's an IP in Sweden that is clearly a bot, but pretending to use a normal user agent
|
|
- I added them to the "bot" list in nginx so the requests will share a common DSpace session with other bots and not create Solr hits, but still they are causing high outbound traffic
|
|
- I modified the nginx configuration to send them an HTTP 403 and tell them to use a bot user agent
|
|
|
|
## 2021-11-14
|
|
|
|
- I decided to update AReS to the latest OpenRXV version with Elasticsearch 7.13
|
|
- First I took backups of the Elasticsearch volume and OpenRXV backend data:
|
|
|
|
```console
|
|
$ docker-compose down
|
|
$ sudo tar czf openrxv_esData_7-2021-11-14.tar.xz /var/lib/docker/volumes/openrxv_esData_7
|
|
$ cp -a backend/data backend/data.2021-11-14
|
|
```
|
|
|
|
- Then I checked out the latest git commit, updated all images, rebuilt the project:
|
|
|
|
```console
|
|
$ docker images | grep -v ^REPO | sed 's/ \+/:/g' | cut -d: -f1,2 | xargs -L1 docker pull
|
|
$ docker-compose build
|
|
$ docker-compose up -d
|
|
```
|
|
|
|
- Then I updated the repository configurations and started a fresh harvest
|
|
- Help Francesca from the Alliance with a question about embargos on CGSpace items
|
|
- I logged in as a normal user and a CGIAR user, and I was unable to access the PDF or full text of the item
|
|
- I was only able to access the PDF when I was logged in as an admin
|
|
|
|
## 2021-11-21
|
|
|
|
- Update all Docker images on AReS (linode20) and re-build OpenRXV
|
|
- Run all system updates and reboot the server
|
|
- Start a full harvest, but I notice that the number of items being harvested is not complete, so I stopped it
|
|
- Run all system updates on CGSpace (linode18) and DSpace Test (linode26) and reboot them
|
|
- ICT finally got back to use about the passwords for SMTP so I updated that and tested it to make sure it's working
|
|
- Some bot with IP 87.203.87.141 in Greece is making tons of requests to XMLUI with the user agent `Microsoft Internet Explorer`
|
|
- I added them to the list of IPs in nginx that get an HTTP 403 with a message to use a real user agent
|
|
- I will also purge all their requests from Solr:
|
|
|
|
```console
|
|
$ ./ilri/check-spider-ip-hits.sh -f /tmp/ips -p
|
|
Purging 10893 hits from 87.203.87.141 in statistics
|
|
|
|
Total number of bot hits purged: 10893
|
|
```
|
|
|
|
- I did a bit more work documenting and tweaking the PostgreSQL configuration for CGSpace and DSpace Test in the Ansible infrastructure playbooks
|
|
- I finally deployed the changes on both servers
|
|
|
|
## 2021-11-22
|
|
|
|
- Udana asked me about validating on OpenArchives again
|
|
- According to my notes we actually completed this in 2021-08, but for some reason we are no longer on the list and I can't validate again
|
|
- There seems to be a problem with their website because every link I try to validate says it received an HTTP 500 response from CGSpace
|
|
|
|
## 2021-11-23
|
|
|
|
- Help RTB colleagues with thumbnail issues on their [2020 Annual Report](https://hdl.handle.net/10568/114576)
|
|
- The PDF seems to be in landscape mode or something and the first page is half width, so the thumbnail renders with the left half being white
|
|
- I generated a new one manually with libvips and it is better:
|
|
|
|
```console
|
|
$ vipsthumbnail AR\ RTB\ 2020.pdf -s 600 -o '%s.jpg[Q=85,optimize_coding,strip]'
|
|
```
|
|
|
|
- I sent an email to the OpenArchives.org contact to ask for help with the OAI validator
|
|
- Someone responded to say that there have been a number of complaints about this on the oai-pmh mailing list recently...
|
|
- I sent an email to Pythagoras from GARDIAN to ask if they can use a more specific user agent than "Microsoft Internet Explorer" for their scraper
|
|
- He said he will change the user agent
|
|
|
|
## 2021-11-24
|
|
|
|
- I had an idea to check our Solr statistics for hits from all the IPs that I have listed in nginx as being bots
|
|
- Other than a few that I ruled out that *may* be humans, these are all making requests within one month or with no user agent, which is highly suspicious:
|
|
|
|
```console
|
|
$ ./ilri/check-spider-ip-hits.sh -f /tmp/ips.txt
|
|
Found 8352 hits from 138.201.49.199 in statistics
|
|
Found 9374 hits from 78.46.89.18 in statistics
|
|
Found 2112 hits from 93.179.69.74 in statistics
|
|
Found 1 hits from 31.6.77.23 in statistics
|
|
Found 5 hits from 34.209.213.122 in statistics
|
|
Found 86772 hits from 163.172.68.99 in statistics
|
|
Found 77 hits from 163.172.70.248 in statistics
|
|
Found 15842 hits from 163.172.71.24 in statistics
|
|
Found 172954 hits from 104.154.216.0 in statistics
|
|
Found 3 hits from 188.134.31.88 in statistics
|
|
|
|
Total number of hits from bots: 295492
|
|
```
|
|
|
|
## 2021-11-27
|
|
|
|
- Peter sent me corrections for the authors that I had sent him back in 2021-09
|
|
- I did a quick sanity check on them with OpenRefine, filtering out all the metadata with no replacements, then ran through my csv-metadata-quality script
|
|
- Then I imported them into my local instance as a test:
|
|
|
|
```console
|
|
$ ./ilri/fix-metadata-values.py -i /tmp/authors.csv -db dspace -u dspace -p 'fuuu' -f dc.contributor.author -t 'correct' -m 3
|
|
```
|
|
|
|
- Then I imported to CGSpace and started a full Discovery re-index:
|
|
|
|
```console
|
|
$ time chrt -b 0 ionice -c2 -n7 nice -n19 dspace index-discovery -b
|
|
|
|
real 272m43.818s
|
|
user 183m4.543s
|
|
sys 2m47.988
|
|
```
|
|
|
|
## 2021-11-28
|
|
|
|
- Run system updates on AReS server (linode20) and update all Docker containers and reboot
|
|
- Then I started a fresh harvest as I always do on Sunday
|
|
- I am experimenting with pinning npm version 7 on OpenRXV frontend because of these Angular errors:
|
|
|
|
```console
|
|
npm WARN EBADENGINE Unsupported engine {
|
|
npm WARN EBADENGINE package: '@angular-devkit/architect@0.901.15',
|
|
npm WARN EBADENGINE required: { node: '>= 10.13.0', npm: '^6.11.0 || ^7.5.6', yarn: '>= 1.13.0' },
|
|
npm WARN EBADENGINE current: { node: 'v12.22.7', npm: '8.1.3' }
|
|
npm WARN EBADENGINE }
|
|
```
|
|
|
|
## 2021-11-29
|
|
|
|
- Tezira reached out to me to say that submissions on CGSpace are taking forever
|
|
- I see a definite increase in locks in the last few days:
|
|
|
|
![PostgreSQL locks week](/cgspace-notes/2021/11/postgres_locks_ALL-week.png)
|
|
|
|
- The locks are all held by dspaceWeb (XMLUI):
|
|
|
|
```console
|
|
$ psql -c "SELECT application_name FROM pg_locks pl LEFT JOIN pg_stat_activity psa ON pl.pid = psa.pid" | sort | uniq -c | sort -n
|
|
1
|
|
1 ------------------
|
|
1 (1394 rows)
|
|
1 application_name
|
|
9 psql
|
|
1385 dspaceWeb
|
|
```
|
|
|
|
- I restarted PostgreSQL and the locks dropped down:
|
|
|
|
```console
|
|
$ psql -c "SELECT application_name FROM pg_locks pl LEFT JOIN pg_stat_activity psa ON pl.pid = psa.pid" | sort | uniq -c | sort -n
|
|
1
|
|
1 ------------------
|
|
1 (103 rows)
|
|
1 application_name
|
|
9 psql
|
|
94 dspaceWeb
|
|
```
|
|
|
|
## 2021-11-30
|
|
|
|
- IWMI sent me ORCID identifiers for some new staff
|
|
- We currently have 1332 unique identifiers, so this adds sixteen new ones:
|
|
|
|
```console
|
|
$ cat ~/src/git/DSpace/dspace/config/controlled-vocabularies/cg-creator-identifier.xml /tmp/iwmi-orcids.txt | grep -oE '[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}' | sort | uniq > /tmp/2021-11-30-combined-orcids.txt
|
|
$ wc -l /tmp/2021-11-30-combined-orcids.txt
|
|
1348 /tmp/2021-11-30-combined-orcids.txt
|
|
```
|
|
|
|
- After I combined them and removed duplicates, I resolved all the names using my `resolve-orcids.py` script:
|
|
|
|
```console
|
|
$ ./ilri/resolve-orcids.py -i /tmp/2021-11-30-combined-orcids.txt -o /tmp/2021-11-30-combined-orcids-names.txt
|
|
```
|
|
|
|
- Then I updated some ORCID identifiers that had changed in the XML:
|
|
|
|
```console
|
|
$ cat 2021-11-30-fix-orcids.csv
|
|
cg.creator.identifier,correct
|
|
"ADEBOWALE AKANDE: 0000-0002-6521-3272","ADEBOWALE AD AKANDE: 0000-0002-6521-3272"
|
|
"Daniel Ortiz Gonzalo: 0000-0002-5517-1785","Daniel Ortiz-Gonzalo: 0000-0002-5517-1785"
|
|
"FRIDAY ANETOR: 0000-0003-3137-1958","Friday Osemenshan Anetor: 0000-0003-3137-1958"
|
|
"Sander Muilerman: 0000-0001-9103-3294","Sander Muilerman-Rodrigo: 0000-0001-9103-3294"
|
|
$ ./ilri/fix-metadata-values.py -i 2021-11-30-fix-orcids.csv -db dspace -u dspace -p 'fuuu' -f cg.creator.identifier -t 'correct' -m 247
|
|
```
|
|
|
|
- Tag existing items from the IWMI's new authors with ORCID iDs using `add-orcid-identifiers-csv.py` (7 new metadata fields added):
|
|
|
|
```console
|
|
$ cat 2021-11-30-add-orcids.csv
|
|
dc.contributor.author,cg.creator.identifier
|
|
"Liaqat, U.W.","Umar Waqas Liaqat: 0000-0001-9027-5232"
|
|
"Liaqat, Umar Waqas","Umar Waqas Liaqat: 0000-0001-9027-5232"
|
|
"Munyaradzi, M.","Munyaradzi Junia Mutenje: 0000-0002-7829-9300"
|
|
"Mutenje, Munyaradzi","Munyaradzi Junia Mutenje: 0000-0002-7829-9300"
|
|
"Rex, William","William Rex: 0000-0003-4979-5257"
|
|
"Shrestha, Shisher","Nirman Shrestha: 0000-0002-0996-8611"
|
|
$ ./ilri/add-orcid-identifiers-csv.py -i 2021-11-30-add-orcids.csv -db dspace -u dspace -p 'fuuu'
|
|
```
|
|
|
|
<!-- vim: set sw=2 ts=2: -->
|