cgspace-notes/docs/2020-04/index.html

710 lines
38 KiB
HTML
Raw Normal View History

2020-04-02 09:54:46 +02:00
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta property="og:title" content="April, 2020" />
<meta property="og:description" content="2020-04-02
Maria asked me to update Charles Staver&rsquo;s ORCID iD in the submission template and on CGSpace, as his name was lower case before, and now he has corrected it
2020-04-02 11:33:41 +02:00
I updated the fifty-eight existing items on CGSpace
Looking into the items Udana had asked about last week that were missing Altmetric donuts:
2020-04-02 15:30:44 +02:00
The first is still missing its DOI, so I added it and tweeted its handle (after a few hours there was a donut with score 222)
2020-04-02 11:33:41 +02:00
The second item now has a donut with score 2 since I tweeted its handle last week
The third item now has a donut with score 1 since I tweeted it last week
On the same note, the one item Abenet pointed out last week now has a donut with score of 104 after I tweeted it last week
2020-04-02 09:54:46 +02:00
" />
<meta property="og:type" content="article" />
<meta property="og:url" content="https://alanorth.github.io/cgspace-notes/2020-04/" />
<meta property="article:published_time" content="2020-04-02T10:53:24+03:00" />
2020-05-31 19:49:41 +02:00
<meta property="article:modified_time" content="2020-05-31T20:15:08+03:00" />
2020-04-02 09:54:46 +02:00
<meta name="twitter:card" content="summary"/>
<meta name="twitter:title" content="April, 2020"/>
<meta name="twitter:description" content="2020-04-02
Maria asked me to update Charles Staver&rsquo;s ORCID iD in the submission template and on CGSpace, as his name was lower case before, and now he has corrected it
2020-04-02 11:33:41 +02:00
I updated the fifty-eight existing items on CGSpace
Looking into the items Udana had asked about last week that were missing Altmetric donuts:
2020-04-02 15:30:44 +02:00
The first is still missing its DOI, so I added it and tweeted its handle (after a few hours there was a donut with score 222)
2020-04-02 11:33:41 +02:00
The second item now has a donut with score 2 since I tweeted its handle last week
The third item now has a donut with score 1 since I tweeted it last week
On the same note, the one item Abenet pointed out last week now has a donut with score of 104 after I tweeted it last week
2020-04-02 09:54:46 +02:00
"/>
2020-11-07 15:22:36 +01:00
<meta name="generator" content="Hugo 0.78.1" />
2020-04-02 09:54:46 +02:00
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "BlogPosting",
"headline": "April, 2020",
2020-04-02 09:55:42 +02:00
"url": "https://alanorth.github.io/cgspace-notes/2020-04/",
2020-04-30 13:49:46 +02:00
"wordCount": "3406",
2020-04-02 09:54:46 +02:00
"datePublished": "2020-04-02T10:53:24+03:00",
2020-05-31 19:49:41 +02:00
"dateModified": "2020-05-31T20:15:08+03:00",
2020-04-02 09:54:46 +02:00
"author": {
"@type": "Person",
"name": "Alan Orth"
},
"keywords": "Notes"
}
</script>
<link rel="canonical" href="https://alanorth.github.io/cgspace-notes/2020-04/">
<title>April, 2020 | CGSpace Notes</title>
<!-- combined, minified CSS -->
2020-11-16 09:54:00 +01:00
<link href="https://alanorth.github.io/cgspace-notes/css/style.d20c61b183eb27beb5b2c48f70a38b91c8bb5fb929e77b447d5f77c7285221ad.css" rel="stylesheet" integrity="sha256-0gxhsYPrJ761ssSPcKOLkci7X7kp53tEfV93xyhSIa0=" crossorigin="anonymous">
2020-04-02 09:54:46 +02:00
<!-- minified Font Awesome for SVG icons -->
2020-11-16 09:54:00 +01:00
<script defer src="https://alanorth.github.io/cgspace-notes/js/fontawesome.min.4ed405d7c7002b970d34cbe6026ff44a556b0808cb98a9db4008752110ed964b.js" integrity="sha256-TtQF18cAK5cNNMvmAm/0SlVrCAjLmKnbQAh1IRDtlks=" crossorigin="anonymous"></script>
2020-04-02 09:54:46 +02:00
<!-- RSS 2.0 feed -->
</head>
<body>
<div class="blog-masthead">
<div class="container">
<nav class="nav blog-nav">
<a class="nav-link " href="https://alanorth.github.io/cgspace-notes/">Home</a>
</nav>
</div>
</div>
<header class="blog-header">
<div class="container">
<h1 class="blog-title" dir="auto"><a href="https://alanorth.github.io/cgspace-notes/" rel="home">CGSpace Notes</a></h1>
<p class="lead blog-description" dir="auto">Documenting day-to-day work on the <a href="https://cgspace.cgiar.org">CGSpace</a> repository.</p>
</div>
</header>
<div class="container">
<div class="row">
<div class="col-sm-8 blog-main">
<article class="blog-post">
<header>
<h2 class="blog-post-title" dir="auto"><a href="https://alanorth.github.io/cgspace-notes/2020-04/">April, 2020</a></h2>
2020-11-16 09:54:00 +01:00
<p class="blog-post-meta">
<time datetime="2020-04-02T10:53:24+03:00">Thu Apr 02, 2020</time>
in
2020-04-02 09:54:46 +02:00
<span class="fas fa-folder" aria-hidden="true"></span>&nbsp;<a href="/cgspace-notes/categories/notes/" rel="category tag">Notes</a>
</p>
</header>
<h2 id="2020-04-02">2020-04-02</h2>
<ul>
2020-04-02 11:33:41 +02:00
<li>Maria asked me to update Charles Staver&rsquo;s ORCID iD in the submission template and on CGSpace, as his name was lower case before, and now he has corrected it
<ul>
<li>I updated the fifty-eight existing items on CGSpace</li>
</ul>
</li>
<li>Looking into the items Udana had asked about last week that were missing Altmetric donuts:
<ul>
2020-04-02 15:30:44 +02:00
<li><a href="https://hdl.handle.net/10568/103225">The first</a> is still missing its DOI, so I added it and <a href="https://twitter.com/mralanorth/status/1245632619661766657">tweeted its handle</a> (after a few hours there was a donut with score 222)</li>
2020-04-02 11:33:41 +02:00
<li><a href="https://hdl.handle.net/10568/106899">The second item</a> now has a donut with score 2 since I <a href="https://twitter.com/mralanorth/status/1243158045540134913">tweeted its handle</a> last week</li>
<li><a href="https://hdl.handle.net/10568/107258">The third item</a> now has a donut with score 1 since I <a href="https://twitter.com/mralanorth/status/1243158786392625153">tweeted it</a> last week</li>
</ul>
</li>
<li>On the same note, the <a href="https://hdl.handle.net/10568/106573">one item</a> Abenet pointed out last week now has a donut with score of 104 after I <a href="https://twitter.com/mralanorth/status/1243163710241345536">tweeted it</a> last week</li>
2020-04-02 09:54:46 +02:00
</ul>
2020-04-02 15:30:44 +02:00
<ul>
<li>Altmetric responded about <a href="https://hdl.handle.net/10568/101286">one item</a> that had no donut since at least 2019-12 and said they fixed some problems with their bot&rsquo;s user agent
<ul>
<li>I decided to <a href="https://twitter.com/mralanorth/status/1245703049445851140">tweet the item</a>, as I can&rsquo;t remember if I ever did it before</li>
</ul>
</li>
</ul>
2020-04-07 09:37:48 +02:00
<h2 id="2020-04-05">2020-04-05</h2>
<ul>
<li>Update PostgreSQL JDBC driver to version 42.2.12</li>
</ul>
<h2 id="2020-04-07">2020-04-07</h2>
<ul>
<li>Yesterday Atmire sent me their <a href="https://github.com/ilri/DSpace/pull/445">pull request for DSpace 6 modules</a></li>
<li>Peter pointed out that some items have his ORCID identifier (<code>cg.creator.id</code>) twice
<ul>
<li>I think this is because my early <code>add-orcid-identifiers.py</code> script was adding identifiers to existing records without properly checking if there was already one present (at first it only checked if there was one with the exact <code>place</code> value)</li>
<li>As a test I dropped all his ORCID identifiers and added them back with the <code>add-orcid-identifiers.py</code> script:</li>
</ul>
</li>
</ul>
<pre><code>$ psql -h localhost -U postgres dspace -c &quot;DELETE FROM metadatavalue WHERE resource_type_id=2 AND metadata_field_id=240 AND text_value LIKE '%Ballantyne%';&quot;
DELETE 97
$ ./add-orcid-identifiers-csv.py -i 2020-04-07-peter-orcids.csv -db dspace -u dspace -p 'fuuu' -d
</code></pre><ul>
<li>I used this CSV with the script (all records with his name have the name standardized like this):</li>
</ul>
<pre><code>dc.contributor.author,cg.creator.id
&quot;Ballantyne, Peter G.&quot;,&quot;Peter G. Ballantyne: 0000-0001-9346-2893&quot;
</code></pre><ul>
<li>Then I tried another way, to identify all duplicate ORCID identifiers for a given resource ID and group them so I can see if count is greater than 1:</li>
</ul>
<pre><code>dspace=# \COPY (SELECT DISTINCT(resource_id, text_value) as distinct_orcid, COUNT(*) FROM metadatavalue WHERE resource_type_id = 2 AND metadata_field_id = 240 GROUP BY distinct_orcid ORDER BY count DESC) TO /tmp/2020-04-07-duplicate-orcids.csv WITH CSV HEADER;
COPY 15209
</code></pre><ul>
<li>Of those, about nine authors had duplicate ORCID identifiers over about thirty records, so I created a CSV with all their name variations and ORCID identifiers:</li>
</ul>
<pre><code>dc.contributor.author,cg.creator.id
&quot;Ballantyne, Peter G.&quot;,&quot;Peter G. Ballantyne: 0000-0001-9346-2893&quot;
&quot;Ramirez-Villegas, Julian&quot;,&quot;Julian Ramirez-Villegas: 0000-0002-8044-583X&quot;
&quot;Villegas-Ramirez, J&quot;,&quot;Julian Ramirez-Villegas: 0000-0002-8044-583X&quot;
&quot;Ishitani, Manabu&quot;,&quot;Manabu Ishitani: 0000-0002-6950-4018&quot;
&quot;Manabu, Ishitani&quot;,&quot;Manabu Ishitani: 0000-0002-6950-4018&quot;
&quot;Ishitani, M.&quot;,&quot;Manabu Ishitani: 0000-0002-6950-4018&quot;
&quot;Ishitani, M.&quot;,&quot;Manabu Ishitani: 0000-0002-6950-4018&quot;
&quot;Buruchara, Robin A.&quot;,&quot;Robin Buruchara: 0000-0003-0934-1218&quot;
&quot;Buruchara, Robin&quot;,&quot;Robin Buruchara: 0000-0003-0934-1218&quot;
&quot;Jarvis, Andy&quot;,&quot;Andy Jarvis: 0000-0001-6543-0798&quot;
&quot;Jarvis, Andrew&quot;,&quot;Andy Jarvis: 0000-0001-6543-0798&quot;
&quot;Jarvis, A.&quot;,&quot;Andy Jarvis: 0000-0001-6543-0798&quot;
&quot;Tohme, Joseph M.&quot;,&quot;Joe Tohme: 0000-0003-2765-7101&quot;
&quot;Hansen, James&quot;,&quot;James Hansen: 0000-0002-8599-7895&quot;
&quot;Hansen, James W.&quot;,&quot;James Hansen: 0000-0002-8599-7895&quot;
&quot;Asseng, Senthold&quot;,&quot;Senthold Asseng: 0000-0002-7583-3811&quot;
</code></pre><ul>
<li>Then I deleted <em>all</em> their existing ORCID identifier records:</li>
</ul>
<pre><code>dspace=# DELETE FROM metadatavalue WHERE resource_type_id=2 AND metadata_field_id=240 AND text_value SIMILAR TO '%(0000-0001-6543-0798|0000-0001-9346-2893|0000-0002-6950-4018|0000-0002-7583-3811|0000-0002-8044-583X|0000-0002-8599-7895|0000-0003-0934-1218|0000-0003-2765-7101)%';
DELETE 994
</code></pre><ul>
<li>And then I added them again using the <code>add-orcid-identifiers</code> records:</li>
</ul>
<pre><code>$ ./add-orcid-identifiers-csv.py -i 2020-04-07-fix-duplicate-orcids.csv -db dspace -u dspace -p 'fuuu' -d
</code></pre><ul>
<li>I ran the fixes on DSpace Test and CGSpace as well</li>
2020-04-07 15:32:02 +02:00
<li>I started testing the <a href="https://github.com/ilri/DSpace/pull/445">pull request</a> sent by Atmire yesterday
<ul>
<li>I notice that we now need <code>yarn</code> to build, and I need to bump the Node.js <code>engine</code> version in our Mirage 2 theme in order to get it to build on Node.js 10.x</li>
2020-04-12 16:09:14 +02:00
<li>Font Awesome icons for GitHub etc weren&rsquo;t loading, and after a bit of troubleshooting I replaced version 4.5.0 with 5.13.0 and to my surprise they now include Mendeley and ORCID so we can get rid of the Academicons dependency</li>
</ul>
</li>
</ul>
<h2 id="2020-04-12">2020-04-12</h2>
<ul>
<li>Testing the Atmire DSpace 6.3 code with a clean CGSpace DSpace 5.8 database snapshot
<ul>
<li>One Flyway migration failed so I had to manually remove it (and of course create the pgcrypto extension):</li>
</ul>
</li>
</ul>
<pre><code>dspace63=# DELETE FROM schema_version WHERE version IN ('5.8.2015.12.03.3');
dspace63=# CREATE EXTENSION pgcrypto;
</code></pre><ul>
<li>Then DSpace 6.3 started up OK and I was able to see some statistics in the Content and Usage Analysis (CUA) module, but not on community, collection, or item pages
<ul>
<li>I also noticed at least one of these errors in the DSpace log:</li>
</ul>
</li>
</ul>
<pre><code>2020-04-12 16:34:33,363 ERROR com.atmire.dspace.app.xmlui.aspect.statistics.editorparts.DataTableTransformer @ java.lang.IllegalArgumentException: Invalid UUID string: 1
</code></pre><ul>
<li>And I remembered I actually need to run the DSpace 6.4 Solr UUID migrations:</li>
</ul>
<pre><code>$ export JAVA_OPTS=&quot;-Xmx1024m -Dfile.encoding=UTF-8&quot;
$ ~/dspace63/bin/dspace solr-upgrade-statistics-6x
</code></pre><ul>
<li>Run system updates on DSpace Test (linode26) and reboot it</li>
<li>More work on the DSpace 6.3 stuff, improving the GDPR consent logic to use <a href="https://github.com/chiiya/haven">haven</a> instead of cookieconsent
<ul>
<li>It works better by injecting the Google Analytics script after the user clicks agree, and it also has a preferences section that gets automatically injected on the privacy page!</li>
2020-04-07 15:32:02 +02:00
</ul>
</li>
2020-04-07 09:37:48 +02:00
</ul>
2020-04-13 16:24:05 +02:00
<h2 id="2020-04-13">2020-04-13</h2>
<ul>
<li>I realized that <code>solr-upgrade-statistics-6x</code> only processes 100,000 records by default so I think we actually need to finish running it for all legacy Solr records before asking Atmire why CUA statlets and detailed statistics aren&rsquo;t working</li>
<li>For now I am just doing 250,000 records at a time on my local environment:</li>
</ul>
<pre><code>$ export JAVA_OPTS=&quot;-Xmx2000m -Dfile.encoding=UTF-8&quot;
$ ~/dspace63/bin/dspace solr-upgrade-statistics-6x -n 250000
</code></pre><ul>
<li>Despite running the migration for all of my local 1.5 million Solr records, I still see a few hundred thousand like <code>-1</code> and <code>0-unmigrated</code>
<ul>
<li>I will purge them all and try to import only a subset&hellip;</li>
<li>After importing again I see there are indeed tens of thousands of these documents with IDs &ldquo;-1&rdquo; and &ldquo;0&rdquo;</li>
<li>They are all <code>type: 5</code>, which is &ldquo;SITE&rdquo; according to <code>Constants.java</code>:</li>
</ul>
</li>
</ul>
<pre><code>/** DSpace site type */
public static final int SITE = 5;
</code></pre><ul>
<li>Even after deleting those documents and re-running <code>solr-upgrade-statistics-6x</code> I still get the UUID errors when using CUA and the statlets</li>
<li>I have sent some feedback and questions to Atmire (including about the  issue with glypicons in the header trail)</li>
<li>In other news, my local Artifactory container stopped working for some reason so I re-created it and it seems some things have changed upstream (port 8082 for web UI?):</li>
</ul>
<pre><code>$ podman rm artifactory
$ podman pull docker.bintray.io/jfrog/artifactory-oss:latest
$ podman create --ulimit nofile=32000:32000 --name artifactory -v artifactory_data:/var/opt/jfrog/artifactory -p 8081-8082:8081-8082 docker.bintray.io/jfrog/artifactory-oss
$ podman start artifactory
2020-04-14 19:01:06 +02:00
</code></pre><h2 id="2020-04-14">2020-04-14</h2>
<ul>
<li>A few days ago Peter asked me to update an author&rsquo;s name on CGSpace and in the controlled vocabularies:</li>
</ul>
<pre><code>dspace=# UPDATE metadatavalue SET text_value='Knight-Jones, Theodore J.D.' WHERE resource_type_id=2 AND metadata_field_id=3 AND text_value='Knight-Jones, T.J.D.';
</code></pre><ul>
<li>I updated his existing records on CGSpace, changed the controlled lists, added his ORCID identifier to the controlled list, and tagged his thirty-nine items with the ORCID iD</li>
<li>The new DSpace 6 stuff that Atmire sent modifies the Mirage 2&rsquo;s <code>pom.xml</code> to copy the each theme&rsquo;s resulting <code>node_modules</code> to each theme after building and installing with <code>ant update</code> because they moved some packages from bower to npm and now reference them in <code>page-structure.xsl</code>
<ul>
<li>This is a good idea, because bower is no longer supported, and npm has gotten a lot better, but it causes an extra 200,000 files to get copied!</li>
<li>Most scripts are concatenated into <code>theme.js</code> during build, so we don&rsquo;t need the <code>node_modules</code> after that, but there are three scripts in <code>page-structure.xsl</code> that are not included there</li>
<li>The scripts are a very old version of modernizr which is not even available on npm, html5shiv, and respond.js</li>
<li>For modernizr I can simply download a static copy and put it in <code>0_CGIAR/scripts</code> and concatenate it into <code>theme.js</code></li>
<li>For the others, I can revert to using them from bower&rsquo;s <code>vendor</code> directory, which is installed by the parent XMLUI Mirage 2 theme</li>
<li>During this process I also realized that <code>mvn clean</code> doesn&rsquo;t actually clean everything, and <code>dspace/modules/xmlui-mirage2/target</code> is remaining from previous builds and contains a bunch of shit from previous builds (including all the themes which I was trying to build without!)
<ul>
<li>This must be a DSpace bug, but I should theoretically check on vanilla DSpace and then file a bug&hellip;</li>
</ul>
</li>
</ul>
</li>
</ul>
2020-04-17 18:40:30 +02:00
<h2 id="2020-04-17">2020-04-17</h2>
<ul>
<li>Atmire responded to some of the issues I raised earlier this week about the DSpace 6 pull request
<ul>
<li>They said they don&rsquo;t think the glyphicon encoding issue is due to their changes, but I built a new clean version of the vanilla <code>6_x-dev</code> branch from before their pull request and it <em>does not</em> have the encoding issue in the Mirage 2 header trails</li>
<li>Also, they said we need to use something called <code>AtomicStatisticsUpdateCLI</code> to do the Solr legacy integer ID to UUID conversion so I asked for more information about that workflow</li>
</ul>
</li>
</ul>
2020-04-20 11:41:21 +02:00
<h2 id="2020-04-20">2020-04-20</h2>
<ul>
<li>Looking into a high rate of outgoing bandwidth from yesterday on CGSpace (linode18):</li>
</ul>
<pre><code># cat /var/log/nginx/*.log /var/log/nginx/*.log.1 | grep -E &quot;19/Apr/2020:0[6789]&quot; | goaccess --log-format=COMBINED -
</code></pre><ul>
<li>One host in Russia (91.241.19.70) download 23GiB over those few hours in the morning
<ul>
<li>It looks like all the requests were for one single item&rsquo;s bitstreams:</li>
</ul>
</li>
</ul>
<pre><code># grep -c 91.241.19.70 /var/log/nginx/access.log.1
8900
# grep 91.241.19.70 /var/log/nginx/access.log.1 | grep -c '10568/35187'
8900
</code></pre><ul>
<li>I thought the host might have been Yandex misbehaving, but its user agent is:</li>
</ul>
<pre><code>Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_3; nl-nl) AppleWebKit/527 (KHTML, like Gecko) Version/3.1.1 Safari/525.20
</code></pre><ul>
<li>I will purge that IP from the Solr statistics using my <code>check-spider-ip-hits.sh</code> script:</li>
</ul>
<pre><code>$ ./check-spider-ip-hits.sh -d -f /tmp/ip -p
(DEBUG) Using spider IPs file: /tmp/ip
(DEBUG) Checking for hits from spider IP: 91.241.19.70
Purging 8909 hits from 91.241.19.70 in statistics
Total number of bot hits purged: 8909
</code></pre><ul>
<li>While investigating that I noticed ORCID identifiers missing from a few authors names, so I added them with my <code>add-orcid-identifiers.py</code> script:</li>
</ul>
<pre><code>$ ./add-orcid-identifiers-csv.py -i 2020-04-20-add-orcids.csv -db dspace -u dspace -p 'fuuu' -d
</code></pre><ul>
<li>The contents of <code>2020-04-20-add-orcids.csv</code> was:</li>
</ul>
<pre><code>dc.contributor.author,cg.creator.id
&quot;Schut, Marc&quot;,&quot;Marc Schut: 0000-0002-3361-4581&quot;
&quot;Schut, M.&quot;,&quot;Marc Schut: 0000-0002-3361-4581&quot;
&quot;Kamau, G.&quot;,&quot;Geoffrey Kamau: 0000-0002-6995-4801&quot;
&quot;Kamau, G&quot;,&quot;Geoffrey Kamau: 0000-0002-6995-4801&quot;
&quot;Triomphe, Bernard&quot;,&quot;Bernard Triomphe: 0000-0001-6657-3002&quot;
&quot;Waters-Bayer, Ann&quot;,&quot;Ann Waters-Bayer: 0000-0003-1887-7903&quot;
&quot;Klerkx, Laurens&quot;,&quot;Laurens Klerkx: 0000-0002-1664-886X&quot;
</code></pre><ul>
2020-09-16 12:47:13 +02:00
<li>I confirmed some of the authors' names from the report itself, then by looking at their profiles on ORCID.org</li>
2020-04-20 11:41:21 +02:00
<li>Add new ILRI subject &ldquo;COVID19&rdquo; to the <code>5_x-prod</code> branch</li>
<li>Add new CCAFS Phase II project tags to the <code>5_x-prod</code> branch</li>
<li>I will deploy these to CGSpace in the next few days</li>
</ul>
2020-04-24 20:36:23 +02:00
<h2 id="2020-04-24">2020-04-24</h2>
<ul>
<li>Atmire responded to my ticket about the  issue with glypicons and said their test server does not show this same issue
<ul>
<li>They asked if I am using the <code>JAVA_OPTS=-Dfile.encoding=UTF-8</code> when building DSpace and running Tomcat</li>
<li>I set it explicitly for Maven and Ant just now (and cleared all XMLUI caches) but the issue is still there</li>
<li>I asked them if they are building on macOS or Linux, and which Node.js version (I&rsquo;m using 10.20.1, which is the current LTS branch).</li>
</ul>
</li>
</ul>
2020-04-26 09:41:27 +02:00
<h2 id="2020-04-25">2020-04-25</h2>
<ul>
<li>I researched a bit more about the  issue with glypicons and realized it&rsquo;s due to <a href="https://github.com/twbs/bootstrap-sass/issues/919">a bug in libsass</a>
<ul>
<li>I have Ruby sass version 3.4.25 installed in my local environment, but DSpace Mirage 2 is supposed to build with 3.3.14</li>
<li>Downgrading the version fixes it, though I wonder: why did I not have this issue on the <code>6.x-dev</code> branch before Atmire&rsquo;s pull request, and also on <code>5_x-prod</code> where I&rsquo;ve been building for a few months here&hellip;</li>
</ul>
</li>
<li>I deployed the latest <code>5_x-prod</code> branch on CGSpace (linode18), ran all updates, and rebooted the server
<ul>
<li>This includes the &ldquo;COVID19&rdquo; ILRI subject, the new CCAFS Phase II project tags, and the changes to an ILRI author name</li>
<li>After restarting the server I had to restart Tomcat three times before all Solr statistics cores loaded properly.</li>
<li>After that I started a full Discovery reindexing to pick up some author changes I made last week:</li>
</ul>
</li>
</ul>
<pre><code>$ export JAVA_OPTS=&quot;-Dfile.encoding=UTF-8 -Xmx1024m&quot;
$ time chrt -i 0 ionice -c2 -n7 nice -n19 dspace index-discovery -b
</code></pre><ul>
<li>I ran the <code>dspace cleanup -v</code> process on CGSpace and got an error:</li>
</ul>
<pre><code>Error: ERROR: update or delete on table &quot;bitstream&quot; violates foreign key constraint &quot;bundle_primary_bitstream_id_fkey&quot; on table &quot;bundle&quot;
Detail: Key (bitstream_id)=(184980) is still referenced from table &quot;bundle&quot;.
</code></pre><ul>
<li>The solution is, as always:</li>
</ul>
<pre><code>$ psql -d dspace -U dspace -c 'update bundle set primary_bitstream_id=NULL where primary_bitstream_id in (183996);'
UPDATE 1
2020-04-27 08:17:08 +02:00
</code></pre><ul>
<li>I spent some time working on the XMLUI themes in DSpace 6
<ul>
<li>Atmire&rsquo;s pull request modifies <code>pom.xml</code> to <em>not</em> exclude <code>node_modules</code>, which means an extra ~260,000 files get copied to our installation folder because of all the themes</li>
<li>I worked on the <code>Gruntfile.js</code> to copy Font Awesome and Bootstrap glyphicon fonts out of <code>node_modules</code> and into <code>fonts</code> at build time, but still <code>jquery-ui.min.css</code> was being referenced as a <code>url()</code> in CSS</li>
<li>SASS can include imported CSS in your compiled CSS—instead of including an <code>@import url(..)</code> if you import it without the &ldquo;.css&rdquo;, but our version of Ruby SASS doesn&rsquo;t support that</li>
<li>I hacked <code>Gruntfile.js</code> to use <code>dart-sass</code> instead of Ruby <code>compass</code> (including installing compass&rsquo;s mixins via npm!) but then <a href="https://github.com/sass/dart-sass/issues/345">dart-sass converts all the glyphicon ASCII escape codes to Unicode literals</a> and they show up garbled in Firefox</li>
<li>I tried to use <code>node-sass</code> instead of dart-sass and it doesn&rsquo;t replace the ASCII escapes with literals, but then I get the the  issue with the glyphicon in the header trail again! Back to square one!</li>
<li>So that was a waste of five hours&hellip;</li>
<li>I might just leave this <a href="https://github.com/twbs/bootstrap-sass/issues/919">tiny hack</a> in <code>0_CGIAR/styles/_style.scss</code> to override this and be done with it:</li>
</ul>
</li>
</ul>
<pre><code>.breadcrumb &gt; li + li:before {
content: &quot;/\00a0&quot;;
}
2020-04-27 15:39:04 +02:00
</code></pre><h2 id="2020-04-27">2020-04-27</h2>
<ul>
<li>File an issue on DSpace Jira about the <a href="https://jira.lyrasis.org/browse/DS-4492"><code>mvn clean</code> task not removing the Mirage 2 target directory</a></li>
<li>My changes to DSpace XMLUI Mirage 2 build process mean that we don&rsquo;t need Ruby gems at all anymore! We can completely build without them!</li>
2020-04-27 15:57:32 +02:00
<li>Trying to test the <code>com.atmire.statistics.util.update.atomic.AtomicStatisticsUpdateCLI</code> script but there is an error:</li>
</ul>
<pre><code>Exception: org.apache.solr.search.SyntaxError: Cannot parse 'cua_version:${cua.version.number}': Encountered &quot; &quot;}&quot; &quot;} &quot;&quot; at line 1, column 32.
Was expecting one of:
&quot;TO&quot; ...
&lt;RANGE_QUOTED&gt; ...
&lt;RANGE_GOOP&gt; ...
</code></pre><ul>
<li>Seems something is wrong with the variable interpolation, and I see two configurations in the <code>atmire-cua.cfg</code> file:</li>
</ul>
<pre><code>atmire-cua.cua.version.number=${cua.version.number}
atmire-cua.version.number=${cua.version.number}
</code></pre><ul>
<li>I sent a message to Atmire to check</li>
2020-04-27 15:39:04 +02:00
</ul>
2020-04-28 17:18:34 +02:00
<h2 id="2020-04-28">2020-04-28</h2>
<ul>
<li>I did some work on DSpace 6 to modify our XMLUI theme to use Font Awesome icons via SVG + JavaScript instead of using web fonts
<ul>
<li>The difference is about 105K less, plus two fewer network requests since we don&rsquo;t need the web fonts anymore</li>
<li>Before:
<ul>
<li><code>scripts/theme.js</code>: 654K</li>
<li><code>styles/main.css</code>: 220K</li>
<li><code>fa-brands-400.woff2</code>: 75K</li>
<li><code>fa-solid-900.woff2</code>: 78K</li>
<li>Total: 1027K</li>
</ul>
</li>
<li>After:
<ul>
<li><code>scripts/theme.js</code>: 704K</li>
<li><code>styles/main.css</code>: 218K</li>
<li>Total: 922K</li>
</ul>
</li>
</ul>
</li>
2020-05-31 19:49:41 +02:00
<li>I manually edited the CUA version variable and was then able to run the <code>com.atmire.statistics.util.update.atomic.AtomicStatisticsUpdateCLI</code> script
2020-04-28 17:18:34 +02:00
<ul>
<li>On the first run it took one hour to process 100,000 records on my local test instance&hellip;</li>
<li>On the second run it took one hour to process 140,000 records</li>
2020-04-29 13:20:28 +02:00
<li>On the third run it took one hour to process 150,000 records</li>
</ul>
</li>
</ul>
<h2 id="2020-04-29">2020-04-29</h2>
<ul>
<li>I found out that running the Atmire CUA script with more memory and a larger number of records (-r 20000) makes it run faster
<ul>
<li>Now the process finishes, but there are errors on some records:</li>
</ul>
</li>
</ul>
<pre><code>Record uid: ee085cc0-0110-42c5-80b9-0fad4015ed9f couldn't be processed
com.atmire.statistics.util.update.atomic.ProcessingException: something went wrong while processing record uid: ee085cc0-0110-42c5-80b9-0fad4015ed9f, an error occured in the com.atmire.statistics.util.update.atomic.processor.ContainerOwnerDBProcessor
at com.atmire.statistics.util.update.atomic.AtomicStatisticsUpdater.applyProcessors(AtomicStatisticsUpdater.java:304)
at com.atmire.statistics.util.update.atomic.AtomicStatisticsUpdater.processRecords(AtomicStatisticsUpdater.java:176)
at com.atmire.statistics.util.update.atomic.AtomicStatisticsUpdater.performRun(AtomicStatisticsUpdater.java:161)
at com.atmire.statistics.util.update.atomic.AtomicStatisticsUpdater.update(AtomicStatisticsUpdater.java:128)
at com.atmire.statistics.util.update.atomic.AtomicStatisticsUpdateCLI.main(AtomicStatisticsUpdateCLI.java:78)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.dspace.app.launcher.ScriptLauncher.runOneCommand(ScriptLauncher.java:229)
at org.dspace.app.launcher.ScriptLauncher.main(ScriptLauncher.java:81)
Caused by: java.lang.NullPointerException
at com.atmire.dspace.cua.CUADSOServiceImpl.findByLegacyID(CUADSOServiceImpl.java:40)
at com.atmire.statistics.util.update.atomic.processor.AtomicUpdateProcessor.getDSpaceObject(AtomicUpdateProcessor.java:49)
at com.atmire.statistics.util.update.atomic.processor.ContainerOwnerDBProcessor.process(ContainerOwnerDBProcessor.java:45)
at com.atmire.statistics.util.update.atomic.processor.ContainerOwnerDBProcessor.visit(ContainerOwnerDBProcessor.java:38)
at com.atmire.statistics.util.update.atomic.record.UsageRecord.accept(UsageRecord.java:23)
at com.atmire.statistics.util.update.atomic.AtomicStatisticsUpdater.applyProcessors(AtomicStatisticsUpdater.java:301)
... 10 more
</code></pre><ul>
<li>I&rsquo;ve sent a message to Atmire to ask for advice</li>
<li>Also, now I can actually see the CUA statlets and usage statistics
<ul>
<li>Unfortunately it seems they are using Font Awesome 4 in their CUA module and this means that some icons are broken because the names have changed, but also some of their code is using Unicode characters instead of classes in spans!</li>
<li>I&rsquo;ve reverted my sweet SVG work from yesterday and adjusted the Font Awesome 5 SCSS to add a few more icons that they are using</li>
2020-04-28 17:18:34 +02:00
</ul>
</li>
2020-04-29 16:33:34 +02:00
<li>Tezira said she was having issues submitting items on CGSpace today
<ul>
<li>I looked at all the errors in the DSpace log and see a few SQL pooling errors around mid day:</li>
</ul>
</li>
</ul>
<pre><code>$ grep ERROR dspace.log.2020-04-29 | cut -f 3- -d' ' | sort | uniq -c | sort -n
1 ERROR org.dspace.storage.rdbms.DatabaseManager @ SQL findByUnique Error -
1 ERROR org.dspace.storage.rdbms.DatabaseManager @ SQL find Error -
1 ERROR org.dspace.storage.rdbms.DatabaseManager @ SQL query singleTable Error -
1 ERROR org.dspace.storage.rdbms.DatabaseManager @ SQL QueryTable Error -
</code></pre><ul>
<li>I looked in Munin and I see that there is a strange spike in the database pool usage this afternoon:</li>
</ul>
<p><img src="/cgspace-notes/2020/04/jmx_tomcat_dbpools-day.png" alt="Tomcat Database Pool usage day"></p>
<ul>
<li>Looking at the past month it does seem to be something strange:</li>
</ul>
<p><img src="/cgspace-notes/2020/04/jmx_tomcat_dbpools-month.png" alt="Tomcat Database Pool usage month"></p>
<ul>
<li>Database connections do seem high:</li>
</ul>
<pre><code>$ psql -c 'select * from pg_stat_activity' | grep -o -E '(dspaceWeb|dspaceApi|dspaceCli)' | sort | uniq -c
5 dspaceApi
6 dspaceCli
88 dspaceWeb
</code></pre><ul>
<li>Most of those are idle in transaction:</li>
</ul>
<pre><code>$ psql -c 'select * from pg_stat_activity' | grep 'dspaceWeb' | grep -c &quot;idle in transaction&quot;
67
</code></pre><ul>
<li>I don&rsquo;t see anything in the PostgreSQL or Tomcat logs suggesting anything is wrong&hellip; I think the solution to clear these idle connections is probably to just restart Tomcat</li>
2020-04-30 09:44:23 +02:00
<li>I looked at the Solr stats for this month and see lots of suspicious IPs:</li>
</ul>
<pre><code>$ curl -s 'http://localhost:8081/solr/statistics/select?q=*:*&amp;fq=dateYearMonth:2020-04&amp;rows=0&amp;wt=json&amp;indent=true&amp;facet=true&amp;facet.field=ip
&quot;88.99.115.53&quot;,23621, # Hetzner, using XMLUI and REST API with no user agent
&quot;104.154.216.0&quot;,11865,# Google cloud, scraping XMLUI with no user agent
&quot;104.198.96.245&quot;,4925,# Google cloud, using REST API with no user agent
&quot;52.34.238.26&quot;,2907, # EcoSearch on XMLUI, user agent: EcoSearch (+https://search.ecointernet.org/)
</code></pre><ul>
<li>And a bunch more&hellip; ugh&hellip;
<ul>
<li>70.32.90.172: scraping REST API for IWMI/WLE pages with no user agent</li>
<li>2a01:7e00::f03c:91ff:fe16:fcb: Linode, REST API, no user agent</li>
<li>2607:f298:5:101d:f816:3eff:fed9:a484: DreamHost, XMLUI and REST API, python-requests/2.18.4</li>
<li>2a00:1768:2001:7a::20: Netherlands, XMLUI, trying SQL injections</li>
</ul>
</li>
<li>I need to start blocking requests without a user agent&hellip;</li>
<li>I purged these user agents using my <code>check-spider-ip-hits.sh</code> script:</li>
</ul>
<pre><code>$ for year in {2010..2019}; do ./check-spider-ip-hits.sh -f /tmp/ips -s statistics-$year -p; done
$ ./check-spider-ip-hits.sh -f /tmp/ips -s statistics -p
</code></pre><ul>
<li>Then I added a few of them to the bot mapping in the nginx config because it appears they are regular harvesters since 2018</li>
<li>Looking through the Solr stats faceted by the <code>userAgent</code> field I see some interesting ones:</li>
</ul>
<pre><code>$ curl 'http://localhost:8081/solr/statistics/select?q=*%3A*&amp;rows=0&amp;wt=json&amp;indent=true&amp;facet=true&amp;facet.field=userAgent'
...
&quot;Delphi 2009&quot;,50725,
&quot;OgScrper/1.0.0&quot;,12421,
</code></pre><ul>
<li>Delphi is only used by IP addresses in Greece, so that&rsquo;s obviously the GARDIAN people harvesting us&hellip;</li>
<li>I have no idea what OgScrper is, but it&rsquo;s not a user!</li>
<li>Then there are 276,000 hits from <code>MEL-API</code> from Jordanian IPs in 2018, so that&rsquo;s obviously CodeObia guys&hellip;</li>
<li>Other user agents:
<ul>
<li>GigablastOpenSource/1</li>
<li>Owlin Domain Resolver V1</li>
<li>API scraper</li>
<li>MetaURI</li>
</ul>
</li>
<li>I don&rsquo;t know why, but my <code>check-spider-hits.sh</code> script doesn&rsquo;t seem to be handling the user agents with spaces properly so I will delete those manually after</li>
<li>First delete the ones without spaces, creating a temp file in <code>/tmp/agents</code> containing the patterns:</li>
</ul>
<pre><code>$ for year in {2010..2019}; do ./check-spider-hits.sh -f /tmp/agents -s statistics-$year -p; done
$ ./check-spider-hits.sh -f /tmp/agents -s statistics -p
</code></pre><ul>
<li>That&rsquo;s about 300,000 hits purged&hellip;</li>
<li>Then remove the ones with spaces manually, checking the query syntax first, then deleting in yearly cores and the statistics core:</li>
</ul>
<pre><code>$ curl -s &quot;http://localhost:8081/solr/statistics/select&quot; -d &quot;q=userAgent:/Delphi 2009/&amp;rows=0&quot;
...
&lt;lst name=&quot;responseHeader&quot;&gt;&lt;int name=&quot;status&quot;&gt;0&lt;/int&gt;&lt;int name=&quot;QTime&quot;&gt;52&lt;/int&gt;&lt;lst name=&quot;params&quot;&gt;&lt;str name=&quot;q&quot;&gt;userAgent:/Delphi 2009/&lt;/str&gt;&lt;str name=&quot;rows&quot;&gt;0&lt;/str&gt;&lt;/lst&gt;&lt;/lst&gt;&lt;result name=&quot;response&quot; numFound=&quot;38760&quot; start=&quot;0&quot;&gt;&lt;/result&gt;
$ for year in {2010..2019}; do curl -s &quot;http://localhost:8081/solr/statistics-$year/update?softCommit=true&quot; -H &quot;Content-Type: text/xml&quot; --data-binary '&lt;delete&gt;&lt;query&gt;userAgent:&quot;Delphi 2009&quot;&lt;/query&gt;&lt;/delete&gt;'; done
$ curl -s &quot;http://localhost:8081/solr/statistics/update?softCommit=true&quot; -H &quot;Content-Type: text/xml&quot; --data-binary '&lt;delete&gt;&lt;query&gt;userAgent:&quot;Delphi 2009&quot;&lt;/query&gt;&lt;/delete&gt;'
</code></pre><ul>
<li>Quoting them works for now until I can look into it and handle it properly in the script</li>
<li>This was about 400,000 hits in total purged from the Solr statistics</li>
2020-04-28 17:18:34 +02:00
</ul>
2020-04-30 10:21:42 +02:00
<h2 id="2020-04-30">2020-04-30</h2>
<ul>
<li>The TLS certificates on DSpace Test (linode26) have not been renewing correctly
<ul>
<li>The log shows the message &ldquo;No renewals were attempted&rdquo;</li>
<li>The <code>certbot-auto certificates</code> command doesn&rsquo;t list the certificate I have installed</li>
<li>I guess this is because I copied it from the previous server&hellip;</li>
<li>I moved the Let&rsquo;s Encrypt directory, got a new cert, then revoked the old one:</li>
</ul>
</li>
</ul>
<pre><code># mv /etc/letsencrypt /etc/letsencrypt.bak
# /opt/certbot-auto certonly --standalone --email fu@m.com -d dspacetest.cgiar.org --standalone --pre-hook &quot;/bin/systemctl stop nginx&quot; --post-hook &quot;/bin/systemctl start nginx&quot;
# /opt/certbot-auto revoke --cert-path /etc/letsencrypt.bak/live/dspacetest.cgiar.org/cert.pem
# rm -rf /etc/letsencrypt.bak
</code></pre><ul>
<li>Run all system updates on DSpace Test and reboot it</li>
2020-04-30 13:49:46 +02:00
<li>Tezira is still having issue submitting to CGSpace and the database is definitely busy according to Munin:</li>
2020-04-30 10:21:42 +02:00
</ul>
2020-04-30 13:49:46 +02:00
<p><img src="/cgspace-notes/2020/04/postgres_connections_cgspace-week.png" alt="Tomcat postgres connections week"></p>
<ul>
<li>But I don&rsquo;t see a lot of connections in PostgreSQL itself:</li>
</ul>
<pre><code>$ psql -c 'select * from pg_stat_activity' | grep -o -E '(dspaceWeb|dspaceApi|dspaceCli)' | sort | uniq -c
5 dspaceApi
6 dspaceCli
14 dspaceWeb
$ psql -c 'select * from pg_stat_activity' | wc -l
30
</code></pre><ul>
<li>Tezira said she cleared her browser cache and then was able to submit again
<ul>
<li>She said once she logged back in she had very many &ldquo;Untitled&rdquo; submissions pending</li>
<li>I see that the database connections are indeed much lower now:</li>
</ul>
</li>
</ul>
<p><img src="/cgspace-notes/2020/04/postgres_connections_cgspace-day.png" alt="Tomcat postgres connections week"></p>
<ul>
<li>The PostgreSQL log shows a lot of errors about deadlocks and queries waiting on other processes&hellip;</li>
</ul>
<pre><code>ERROR: deadlock detected
</code></pre><!-- raw HTML omitted -->
2020-04-02 09:54:46 +02:00
</article>
</div> <!-- /.blog-main -->
<aside class="col-sm-3 ml-auto blog-sidebar">
<section class="sidebar-module">
<h4>Recent Posts</h4>
<ol class="list-unstyled">
2020-11-02 18:34:10 +01:00
<li><a href="/cgspace-notes/2020-11/">November, 2020</a></li>
2020-10-06 15:59:31 +02:00
<li><a href="/cgspace-notes/2020-10/">October, 2020</a></li>
2020-09-03 12:50:56 +02:00
<li><a href="/cgspace-notes/2020-09/">September, 2020</a></li>
2020-08-06 09:56:13 +02:00
<li><a href="/cgspace-notes/2020-08/">August, 2020</a></li>
2020-08-02 21:14:16 +02:00
2020-07-01 14:37:20 +02:00
<li><a href="/cgspace-notes/2020-07/">July, 2020</a></li>
2020-04-02 09:54:46 +02:00
</ol>
</section>
<section class="sidebar-module">
<h4>Links</h4>
<ol class="list-unstyled">
<li><a href="https://cgspace.cgiar.org">CGSpace</a></li>
<li><a href="https://dspacetest.cgiar.org">DSpace Test</a></li>
<li><a href="https://github.com/ilri/DSpace">CGSpace @ GitHub</a></li>
</ol>
</section>
</aside>
</div> <!-- /.row -->
</div> <!-- /.container -->
<footer class="blog-footer">
<p dir="auto">
Blog template created by <a href="https://twitter.com/mdo">@mdo</a>, ported to Hugo by <a href='https://twitter.com/mralanorth'>@mralanorth</a>.
</p>
<p>
<a href="#">Back to top</a>
</p>
</footer>
</body>
</html>