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

713 lines
38 KiB
HTML

<!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
I updated the fifty-eight existing items on CGSpace
Looking into the items Udana had asked about last week that were missing Altmetric donuts:
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)
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
" />
<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" />
<meta property="article:modified_time" content="2020-05-31T20:15:08+03: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
I updated the fifty-eight existing items on CGSpace
Looking into the items Udana had asked about last week that were missing Altmetric donuts:
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)
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
"/>
<meta name="generator" content="Hugo 0.105.0">
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "BlogPosting",
"headline": "April, 2020",
"url": "https://alanorth.github.io/cgspace-notes/2020-04/",
"wordCount": "3406",
"datePublished": "2020-04-02T10:53:24+03:00",
"dateModified": "2020-05-31T20:15:08+03: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 -->
<link href="https://alanorth.github.io/cgspace-notes/css/style.c6ba80bc50669557645abe05f86b73cc5af84408ed20f1551a267bc19ece8228.css" rel="stylesheet" integrity="sha256-xrqAvFBmlVdkWr4F&#43;GtzzFr4RAjtIPFVGiZ7wZ7Ogig=" crossorigin="anonymous">
<!-- minified Font Awesome for SVG icons -->
<script defer src="https://alanorth.github.io/cgspace-notes/js/fontawesome.min.f5072c55a0721857184db93a50561d7dc13975b4de2e19db7f81eb5f3fa57270.js" integrity="sha256-9QcsVaByGFcYTbk6UFYdfcE5dbTeLhnbf4HrXz&#43;lcnA=" crossorigin="anonymous"></script>
<!-- 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>
<p class="blog-post-meta">
<time datetime="2020-04-02T10:53:24+03:00">Thu Apr 02, 2020</time>
in
<span class="fas fa-folder" aria-hidden="true"></span>&nbsp;<a href="/categories/notes/" rel="category tag">Notes</a>
</p>
</header>
<h2 id="2020-04-02">2020-04-02</h2>
<ul>
<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>
<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>
<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>
</ul>
<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>
<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 tabindex="0"><code>$ psql -h localhost -U postgres dspace -c &#34;DELETE FROM metadatavalue WHERE resource_type_id=2 AND metadata_field_id=240 AND text_value LIKE &#39;%Ballantyne%&#39;;&#34;
DELETE 97
$ ./add-orcid-identifiers-csv.py -i 2020-04-07-peter-orcids.csv -db dspace -u dspace -p &#39;fuuu&#39; -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 tabindex="0"><code>dc.contributor.author,cg.creator.id
&#34;Ballantyne, Peter G.&#34;,&#34;Peter G. Ballantyne: 0000-0001-9346-2893&#34;
</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 tabindex="0"><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 tabindex="0"><code>dc.contributor.author,cg.creator.id
&#34;Ballantyne, Peter G.&#34;,&#34;Peter G. Ballantyne: 0000-0001-9346-2893&#34;
&#34;Ramirez-Villegas, Julian&#34;,&#34;Julian Ramirez-Villegas: 0000-0002-8044-583X&#34;
&#34;Villegas-Ramirez, J&#34;,&#34;Julian Ramirez-Villegas: 0000-0002-8044-583X&#34;
&#34;Ishitani, Manabu&#34;,&#34;Manabu Ishitani: 0000-0002-6950-4018&#34;
&#34;Manabu, Ishitani&#34;,&#34;Manabu Ishitani: 0000-0002-6950-4018&#34;
&#34;Ishitani, M.&#34;,&#34;Manabu Ishitani: 0000-0002-6950-4018&#34;
&#34;Ishitani, M.&#34;,&#34;Manabu Ishitani: 0000-0002-6950-4018&#34;
&#34;Buruchara, Robin A.&#34;,&#34;Robin Buruchara: 0000-0003-0934-1218&#34;
&#34;Buruchara, Robin&#34;,&#34;Robin Buruchara: 0000-0003-0934-1218&#34;
&#34;Jarvis, Andy&#34;,&#34;Andy Jarvis: 0000-0001-6543-0798&#34;
&#34;Jarvis, Andrew&#34;,&#34;Andy Jarvis: 0000-0001-6543-0798&#34;
&#34;Jarvis, A.&#34;,&#34;Andy Jarvis: 0000-0001-6543-0798&#34;
&#34;Tohme, Joseph M.&#34;,&#34;Joe Tohme: 0000-0003-2765-7101&#34;
&#34;Hansen, James&#34;,&#34;James Hansen: 0000-0002-8599-7895&#34;
&#34;Hansen, James W.&#34;,&#34;James Hansen: 0000-0002-8599-7895&#34;
&#34;Asseng, Senthold&#34;,&#34;Senthold Asseng: 0000-0002-7583-3811&#34;
</code></pre><ul>
<li>Then I deleted <em>all</em> their existing ORCID identifier records:</li>
</ul>
<pre tabindex="0"><code>dspace=# DELETE FROM metadatavalue WHERE resource_type_id=2 AND metadata_field_id=240 AND text_value SIMILAR TO &#39;%(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)%&#39;;
DELETE 994
</code></pre><ul>
<li>And then I added them again using the <code>add-orcid-identifiers</code> records:</li>
</ul>
<pre tabindex="0"><code>$ ./add-orcid-identifiers-csv.py -i 2020-04-07-fix-duplicate-orcids.csv -db dspace -u dspace -p &#39;fuuu&#39; -d
</code></pre><ul>
<li>I ran the fixes on DSpace Test and CGSpace as well</li>
<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>
<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 tabindex="0"><code>dspace63=# DELETE FROM schema_version WHERE version IN (&#39;5.8.2015.12.03.3&#39;);
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 tabindex="0"><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 tabindex="0"><code>$ export JAVA_OPTS=&#34;-Xmx1024m -Dfile.encoding=UTF-8&#34;
$ ~/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>
</ul>
</li>
</ul>
<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 tabindex="0"><code>$ export JAVA_OPTS=&#34;-Xmx2000m -Dfile.encoding=UTF-8&#34;
$ ~/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 tabindex="0"><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 tabindex="0"><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
</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 tabindex="0"><code>dspace=# UPDATE metadatavalue SET text_value=&#39;Knight-Jones, Theodore J.D.&#39; WHERE resource_type_id=2 AND metadata_field_id=3 AND text_value=&#39;Knight-Jones, T.J.D.&#39;;
</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>
<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>
<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 tabindex="0"><code># cat /var/log/nginx/*.log /var/log/nginx/*.log.1 | grep -E &#34;19/Apr/2020:0[6789]&#34; | 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 tabindex="0"><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 &#39;10568/35187&#39;
8900
</code></pre><ul>
<li>I thought the host might have been Yandex misbehaving, but its user agent is:</li>
</ul>
<pre tabindex="0"><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 tabindex="0"><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 tabindex="0"><code>$ ./add-orcid-identifiers-csv.py -i 2020-04-20-add-orcids.csv -db dspace -u dspace -p &#39;fuuu&#39; -d
</code></pre><ul>
<li>The contents of <code>2020-04-20-add-orcids.csv</code> was:</li>
</ul>
<pre tabindex="0"><code>dc.contributor.author,cg.creator.id
&#34;Schut, Marc&#34;,&#34;Marc Schut: 0000-0002-3361-4581&#34;
&#34;Schut, M.&#34;,&#34;Marc Schut: 0000-0002-3361-4581&#34;
&#34;Kamau, G.&#34;,&#34;Geoffrey Kamau: 0000-0002-6995-4801&#34;
&#34;Kamau, G&#34;,&#34;Geoffrey Kamau: 0000-0002-6995-4801&#34;
&#34;Triomphe, Bernard&#34;,&#34;Bernard Triomphe: 0000-0001-6657-3002&#34;
&#34;Waters-Bayer, Ann&#34;,&#34;Ann Waters-Bayer: 0000-0003-1887-7903&#34;
&#34;Klerkx, Laurens&#34;,&#34;Laurens Klerkx: 0000-0002-1664-886X&#34;
</code></pre><ul>
<li>I confirmed some of the authors&rsquo; names from the report itself, then by looking at their profiles on ORCID.org</li>
<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>
<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>
<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 tabindex="0"><code>$ export JAVA_OPTS=&#34;-Dfile.encoding=UTF-8 -Xmx1024m&#34;
$ 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 tabindex="0"><code>Error: ERROR: update or delete on table &#34;bitstream&#34; violates foreign key constraint &#34;bundle_primary_bitstream_id_fkey&#34; on table &#34;bundle&#34;
Detail: Key (bitstream_id)=(184980) is still referenced from table &#34;bundle&#34;.
</code></pre><ul>
<li>The solution is, as always:</li>
</ul>
<pre tabindex="0"><code>$ psql -d dspace -U dspace -c &#39;update bundle set primary_bitstream_id=NULL where primary_bitstream_id in (183996);&#39;
UPDATE 1
</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 tabindex="0"><code>.breadcrumb &gt; li + li:before {
content: &#34;/\00a0&#34;;
}
</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>
<li>Trying to test the <code>com.atmire.statistics.util.update.atomic.AtomicStatisticsUpdateCLI</code> script but there is an error:</li>
</ul>
<pre tabindex="0"><code>Exception: org.apache.solr.search.SyntaxError: Cannot parse &#39;cua_version:${cua.version.number}&#39;: Encountered &#34; &#34;}&#34; &#34;} &#34;&#34; at line 1, column 32.
Was expecting one of:
&#34;TO&#34; ...
&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 tabindex="0"><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>
</ul>
<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>
<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
<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>
<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 tabindex="0"><code>Record uid: ee085cc0-0110-42c5-80b9-0fad4015ed9f couldn&#39;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>
</ul>
</li>
<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 tabindex="0"><code>$ grep ERROR dspace.log.2020-04-29 | cut -f 3- -d&#39; &#39; | 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 tabindex="0"><code>$ psql -c &#39;select * from pg_stat_activity&#39; | grep -o -E &#39;(dspaceWeb|dspaceApi|dspaceCli)&#39; | sort | uniq -c
5 dspaceApi
6 dspaceCli
88 dspaceWeb
</code></pre><ul>
<li>Most of those are idle in transaction:</li>
</ul>
<pre tabindex="0"><code>$ psql -c &#39;select * from pg_stat_activity&#39; | grep &#39;dspaceWeb&#39; | grep -c &#34;idle in transaction&#34;
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>
<li>I looked at the Solr stats for this month and see lots of suspicious IPs:</li>
</ul>
<pre tabindex="0"><code>$ curl -s &#39;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
&#34;88.99.115.53&#34;,23621, # Hetzner, using XMLUI and REST API with no user agent
&#34;104.154.216.0&#34;,11865,# Google cloud, scraping XMLUI with no user agent
&#34;104.198.96.245&#34;,4925,# Google cloud, using REST API with no user agent
&#34;52.34.238.26&#34;,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 tabindex="0"><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 tabindex="0"><code>$ curl &#39;http://localhost:8081/solr/statistics/select?q=*%3A*&amp;rows=0&amp;wt=json&amp;indent=true&amp;facet=true&amp;facet.field=userAgent&#39;
...
&#34;Delphi 2009&#34;,50725,
&#34;OgScrper/1.0.0&#34;,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 tabindex="0"><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 tabindex="0"><code>$ curl -s &#34;http://localhost:8081/solr/statistics/select&#34; -d &#34;q=userAgent:/Delphi 2009/&amp;rows=0&#34;
...
&lt;lst name=&#34;responseHeader&#34;&gt;&lt;int name=&#34;status&#34;&gt;0&lt;/int&gt;&lt;int name=&#34;QTime&#34;&gt;52&lt;/int&gt;&lt;lst name=&#34;params&#34;&gt;&lt;str name=&#34;q&#34;&gt;userAgent:/Delphi 2009/&lt;/str&gt;&lt;str name=&#34;rows&#34;&gt;0&lt;/str&gt;&lt;/lst&gt;&lt;/lst&gt;&lt;result name=&#34;response&#34; numFound=&#34;38760&#34; start=&#34;0&#34;&gt;&lt;/result&gt;
$ for year in {2010..2019}; do curl -s &#34;http://localhost:8081/solr/statistics-$year/update?softCommit=true&#34; -H &#34;Content-Type: text/xml&#34; --data-binary &#39;&lt;delete&gt;&lt;query&gt;userAgent:&#34;Delphi 2009&#34;&lt;/query&gt;&lt;/delete&gt;&#39;; done
$ curl -s &#34;http://localhost:8081/solr/statistics/update?softCommit=true&#34; -H &#34;Content-Type: text/xml&#34; --data-binary &#39;&lt;delete&gt;&lt;query&gt;userAgent:&#34;Delphi 2009&#34;&lt;/query&gt;&lt;/delete&gt;&#39;
</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>
</ul>
<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 tabindex="0"><code># mv /etc/letsencrypt /etc/letsencrypt.bak
# /opt/certbot-auto certonly --standalone --email fu@m.com -d dspacetest.cgiar.org --standalone --pre-hook &#34;/bin/systemctl stop nginx&#34; --post-hook &#34;/bin/systemctl start nginx&#34;
# /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>
<li>Tezira is still having issue submitting to CGSpace and the database is definitely busy according to Munin:</li>
</ul>
<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 tabindex="0"><code>$ psql -c &#39;select * from pg_stat_activity&#39; | grep -o -E &#39;(dspaceWeb|dspaceApi|dspaceCli)&#39; | sort | uniq -c
5 dspaceApi
6 dspaceCli
14 dspaceWeb
$ psql -c &#39;select * from pg_stat_activity&#39; | 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 tabindex="0"><code>ERROR: deadlock detected
</code></pre><!-- raw HTML omitted -->
</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">
<li><a href="/cgspace-notes/2022-12/">December, 2022</a></li>
<li><a href="/cgspace-notes/2022-11/">November, 2022</a></li>
<li><a href="/cgspace-notes/2022-10/">October, 2022</a></li>
<li><a href="/cgspace-notes/2022-09/">September, 2022</a></li>
<li><a href="/cgspace-notes/2022-08/">August, 2022</a></li>
</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>