mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 18:14:26 +00:00
[CST-18963] Fixes issues with matomo on docker compose
feat: - Adds matomo.tracker.url override inside the docker-compose. - Improves logging of exceptions during connection for the matomo client
This commit is contained in:
@@ -24,6 +24,8 @@ services:
|
|||||||
db__P__url: 'jdbc:postgresql://dspacedb:5432/dspace'
|
db__P__url: 'jdbc:postgresql://dspacedb:5432/dspace'
|
||||||
# solr.server: Ensure we are using the 'dspacesolr' image for Solr
|
# solr.server: Ensure we are using the 'dspacesolr' image for Solr
|
||||||
solr__P__server: http://dspacesolr:8983/solr
|
solr__P__server: http://dspacesolr:8983/solr
|
||||||
|
# matomo.tracker.url: Ensure we are using the 'matomo' image for Matomo
|
||||||
|
matomo__P__tracker__P__url: http://matomo
|
||||||
# proxies.trusted.ipranges: This setting is required for a REST API running in Docker to trust requests
|
# proxies.trusted.ipranges: This setting is required for a REST API running in Docker to trust requests
|
||||||
# from the host machine. This IP range MUST correspond to the 'dspacenet' subnet defined above.
|
# from the host machine. This IP range MUST correspond to the 'dspacenet' subnet defined above.
|
||||||
proxies__P__trusted__P__ipranges: '172.23.0'
|
proxies__P__trusted__P__ipranges: '172.23.0'
|
||||||
|
@@ -131,7 +131,7 @@ public abstract class MatomoAbstractClient<C, T, U> implements MatomoClient {
|
|||||||
cookiesValue.append("; ").append(requestCookies);
|
cookiesValue.append("; ").append(requestCookies);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!cookiesValue.isEmpty()) {
|
if (cookiesValue.length() > 0) {
|
||||||
connection.setRequestProperty("Cookie", cookiesValue.toString());
|
connection.setRequestProperty("Cookie", cookiesValue.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -65,7 +65,13 @@ public class MatomoAsyncClientImpl extends MatomoAbstractClient<HttpClient, Http
|
|||||||
) {
|
) {
|
||||||
httpClient
|
httpClient
|
||||||
.sendAsync(createRequest(requestBody, cookies), java.net.http.HttpResponse.BodyHandlers.ofString())
|
.sendAsync(createRequest(requestBody, cookies), java.net.http.HttpResponse.BodyHandlers.ofString())
|
||||||
.thenAccept(response -> responseConsumer.accept(response, requestBody));
|
.thenAccept(response -> responseConsumer.accept(response, requestBody))
|
||||||
|
.exceptionally(this::logError);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Void logError(Throwable throwable) {
|
||||||
|
log.error("Cannot track this request to Matomo! Check the matomo.tracking.url configured. ", throwable);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int getStatusCode(HttpResponse<String> response) {
|
protected int getStatusCode(HttpResponse<String> response) {
|
||||||
|
@@ -12,7 +12,9 @@ matomo.tracker.url = http://localhost:8081
|
|||||||
# Add 'none' to disable the tracking for bitstreams
|
# Add 'none' to disable the tracking for bitstreams
|
||||||
# matomo.track.bundles = ORIGINAL
|
# matomo.track.bundles = ORIGINAL
|
||||||
# Specifies custom cookies that will be tracked ( default is _pk_ref,_pk_hsr,_pk_ses ) directly from the request
|
# Specifies custom cookies that will be tracked ( default is _pk_ref,_pk_hsr,_pk_ses ) directly from the request
|
||||||
matomo.request.customcookies.cookie-name = _pk_ref,_pk_hsr,_pk_ses
|
# This configuration is not usable as of now.
|
||||||
|
# All the cookies set by the matomo provider are not allowed to be cross-domain.
|
||||||
|
# matomo.request.customcookies.cookie-name = _pk_ref,_pk_hsr,_pk_ses
|
||||||
|
|
||||||
#---------------------------------------------------------------#
|
#---------------------------------------------------------------#
|
||||||
#----------------MATOMO CLIENTS CONFIGURATION-------------------#
|
#----------------MATOMO CLIENTS CONFIGURATION-------------------#
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
<bean id="urlEnricher" class="org.dspace.matomo.factory.MatomoRequestDetailsEnricherFactory" factory-method="urlEnricher"/>
|
<bean id="urlEnricher" class="org.dspace.matomo.factory.MatomoRequestDetailsEnricherFactory" factory-method="urlEnricher"/>
|
||||||
<bean id="downloadEnricher" class="org.dspace.matomo.factory.MatomoRequestDetailsEnricherFactory" factory-method="downloadEnricher"/>
|
<bean id="downloadEnricher" class="org.dspace.matomo.factory.MatomoRequestDetailsEnricherFactory" factory-method="downloadEnricher"/>
|
||||||
<bean id="trackerIdEnricher" class="org.dspace.matomo.factory.MatomoRequestDetailsEnricherFactory" factory-method="trackerIdentifierEnricher"/>
|
<bean id="trackerIdEnricher" class="org.dspace.matomo.factory.MatomoRequestDetailsEnricherFactory" factory-method="trackerIdentifierEnricher"/>
|
||||||
<!-- As of now these cookie enricher are not working, because we are not treating cross-domain Matomo Cookies -->
|
<!-- As of now these cookie enrichers are not working, because we are not treating cross-domain Matomo Cookies -->
|
||||||
<!--
|
<!--
|
||||||
<bean id="cookieIdEnricher" class="org.dspace.matomo.factory.MatomoRequestCookieIdentifierEnricher"/>
|
<bean id="cookieIdEnricher" class="org.dspace.matomo.factory.MatomoRequestCookieIdentifierEnricher"/>
|
||||||
<bean id="cookieSessionEnricher" class="org.dspace.matomo.factory.MatomoRequestCookieSessionEnricher"/>
|
<bean id="cookieSessionEnricher" class="org.dspace.matomo.factory.MatomoRequestCookieSessionEnricher"/>
|
||||||
|
@@ -35,4 +35,5 @@ services:
|
|||||||
- MATOMO_DATABASE_PASSWORD=matomo
|
- MATOMO_DATABASE_PASSWORD=matomo
|
||||||
- MATOMO_DATABASE_DBNAME=matomo
|
- MATOMO_DATABASE_DBNAME=matomo
|
||||||
ports:
|
ports:
|
||||||
- '8081:80'
|
- published: 8081
|
||||||
|
target: 80
|
Reference in New Issue
Block a user