Skip to content
This repository has been archived by the owner on Jul 27, 2022. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/ISAICP-4974' into ISAICP-5399
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiu-cristea committed Jul 15, 2019
2 parents a89884a + 8fdc032 commit da2c23e
Show file tree
Hide file tree
Showing 20 changed files with 399 additions and 440 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,5 +212,3 @@ there is information on handling draft in CRUD operations for rdf entities.
there is information on how to handle notifications in Joinup.
* In [Joinup core module](web/modules/custom/joinup_core/README.md) there is
information on how to handle and create workflows.
* In [Matomo analytics](docs/matomo.md) you find information about working with
the web analytics platform used in Joinup.
138 changes: 3 additions & 135 deletions build.matomo.xml
Original file line number Diff line number Diff line change
@@ -1,87 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>

<project name="Matomo" default="help">

<!-- Checks if all required software to install Matomo is available. -->
<target name="check-matomo-requirements">
<echo message="Matomo installation requires git and docker-compose to be installed." />
<echo message="Checking if git is installed. Ref. https://git-scm.com/downloads" />
<exec
command="${git.bin} --version"
dir="${project.basedir}"
passthru="true"
checkreturn="true" />
<echo message="Checking if docker-compose is installed. Ref. https://docs.docker.com/compose/install/" />
<exec
command='docker-compose --version'
dir="${project.basedir}"
passthru="true"
checkreturn="true" />
</target>

<!-- Downloads the repository that contains the Matomo docker configuration. -->
<target
name="download-matomo-repository"
depends="check-matomo-requirements">
<if>
<available file="${matomo.dir}/.git" type="dir" property="matomo.repo.available" />
<then>
<echo message="Matomo repository exists (${matomo.dir}), fetching latest changes." />
<gitfetch
gitPath="${git.bin}"
repository="${matomo.dir}"
refspec="${matomo.branch}" />
</then>
<else>
<mkdir dir="${matomo.dir}" />
<gitclone
gitPath="${git.bin}"
repository="${matomo.repo}"
branch="${matomo.branch}"
targetPath="${matomo.dir}" />
</else>
</if>
</target>

<target
name="configure-matomo-docker"
depends="download-matomo-repository">
<!-- Start by doing a clean checkout of the branch. -->
<gitcheckout
gitPath="${git.bin}"
repository="${matomo.dir}"
branchname="${matomo.branch}"
force="true" />
<!-- Configure docker. -->
<reflexive>
<fileset dir="${matomo.dir}">
<include pattern="${matomo.config}" />
</fileset>
<filterchain>
<!-- Comment out references to the external network 'lb_web'. -->
<replaceregexp>
<regexp
pattern="^(.*lb_web.*)$"
replace="#\1"
modifiers="m" />
</replaceregexp>
<replaceregexp>
<regexp
pattern="^(.*external: true.*)$"
replace="#\1"
modifiers="m" />
</replaceregexp>
<!-- Insert the port configuration. -->
<replaceregexp>
<regexp
pattern="^(.*)(cron:.*)$"
replace="\1 ports:${line.separator}\1 - &quot;${matomo.port}:80&quot;${line.separator}\1 - &quot;8443:443&quot;${line.separator}\1\2"
modifiers="m" />
</replaceregexp>
</filterchain>
</reflexive>
</target>

<target name="configure-matomo-drupal">
<reflexive>
<fileset dir="${website.settings.dir}">
Expand All @@ -91,65 +10,14 @@
<!-- Comment out previous configuration. -->
<replaceregexp>
<regexp
pattern="^[^#](.*matomo.*\.settings.*)$"
replace="#\1"
pattern="^[^#].*(matomo|oe_webtools_analytics).*\.settings.*$${line.separator}"
replace=""
modifiers="m" />
</replaceregexp>
</filterchain>
</reflexive>
<append
destFile="${website.settings.local.php}"
text="$config['matomo.settings']['site_id'] = '${matomo.website_id}';${line.separator}$config['matomo.settings']['url_http'] = '${matomo.url.http}';${line.separator}$config['matomo.settings']['url_https'] = '${matomo.url.https}';${line.separator}$config['matomo_reporting_api.settings']['token_auth'] = '${matomo.token}';${line.separator}" />
</target>

<target
name="download-matomo-containers"
depends="download-matomo-repository">
<exec
command='docker-compose up --no-start'
dir="${matomo.dir}"
passthru="true"
checkreturn="true" />
text="$config['matomo.settings']['site_id'] = '${matomo.website_id}';${line.separator}$config['matomo.settings']['url_http'] = '${matomo.url.http}';${line.separator}$config['matomo.settings']['url_https'] = '${matomo.url.https}';${line.separator}$config['matomo_reporting_api.settings']['token_auth'] = '${matomo.token}';${line.separator}$config['oe_webtools_analytics.settings']['siteID'] = '${webtools_analytics.site_id}';${line.separator}$config['oe_webtools_analytics.settings']['sitePath'] = '${webtools_analytics.site_path}';${line.separator}$config['oe_webtools_analytics.settings']['instance'] = '${webtools_analytics.instance}';${line.separator}" />
</target>

<target
name="start-matomo"
description="Start the containerized Matomo instance.">
<exec
command='MYSQL_ROOT_PASSWORD=${matomo.db.password} docker-compose up -d'
dir="${matomo.dir}"
passthru="true"
checkreturn="true" />
<echo message="Matomo is now running at http://localhost:${matomo.port}" />
<echo message="Use the following settings when configuring the instance through the web interface:${line.separator}
Database server: db${line.separator}
Login: root${line.separator}
Password: ${matomo.db.password}${line.separator}
Database name: matomo${line.separator}${line.separator}
Super user login and password: whatever you like${line.separator}${line.separator}
Website name: Joinup${line.separator}
Website URL: ${drupal.base_url}" />
</target>

<target
name="stop-matomo"
description="Stop the containerized Matomo instance.">
<exec
command='docker-compose down'
dir="${matomo.dir}"
passthru="true"
checkreturn="true" />
</target>

<target
name="restart-matomo"
depends="stop-matomo, start-matomo"
description="Restart the Matomo containers.">
</target>

<target
name="setup-matomo"
description="Set up and start Matomo."
depends="download-matomo-containers, configure-matomo-docker, start-matomo" />

</project>
37 changes: 18 additions & 19 deletions build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -280,32 +280,16 @@ migration.mock_filesystem = TRUE
# migration.acceptance = 1


# Matomo configuration
# -------------------

# Installation path.
matomo.dir = ${project.basedir}/vendor/matomo-org/matomo

# Git repository.
matomo.repo = https://github.com/libresh/compose-matomo.git
matomo.branch = master

# Configuration file.
matomo.config = docker-compose.yml

# Credentials.
matomo.db.password = ${drupal.db.password}

# Port to use. Matomo will be available on http://localhost:{port}
matomo.port = 8000
# Analytics configuration
# -----------------------

# Website ID. This can be seen in the Matomo UI, at Administration > Websites >
# Manage.
matomo.website_id = 1

# Optional HTTP URL to the Matomo server. Only intended for development
# environments.
matomo.url.http = http://localhost:${matomo.port}/
matomo.url.http =

# Optional HTTPS URL to the Matomo server. Intended for production environments.
matomo.url.https =
Expand All @@ -314,6 +298,21 @@ matomo.url.https =
# Administration > Platform > API > User authentication.
matomo.token = 0123456789abcdef0123456789abcdef

# The site ID to use with Webtools Analytics.
webtools_analytics.site_id = ${matomo.website_id}

# The site path to use with Webtools Analytics. This defaults to the user
# acceptance environment so that we will not accidentally pollute our analytics
# data when running Joinup on an environment that doesn't properly override
# these properties.
webtools_analytics.site_path = joinup.uat.fpfis.tech.ec.europa.eu

# The Webtools Analytics server instance to use. This defaults to the test
# environment so that we will not accidentally pollute our analytics data when
# running Joinup on an environment that doesn't properly override these
# properties.
webtools_analytics.instance = testing


# Redis configuration
# -------------------
Expand Down
16 changes: 16 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
"jacklmoore/autosize": "dev-master",
"masterminds/html5": "^2.6",
"ml/json-ld": "^1.0",
"openeuropa/oe_webtools": "~1.0",
"openeuropa/oe_webtools_location": "dev-master",
"pear/console_table": "~1.3",
"phing/phing": "^2.15.0",
Expand Down Expand Up @@ -269,6 +270,9 @@
},
"masterminds/html5": {
"Apply default UTF-8 encoding @see https://github.com/Masterminds/html5-php/pull/168": "https://patch-diff.githubusercontent.com/raw/Masterminds/html5-php/pull/168.patch"
},
"openeuropa/oe_webtools": {
"Include the smartloader on pages where analytics are used.": "https://patch-diff.githubusercontent.com/raw/openeuropa/oe_webtools/pull/71.patch"
}
}
},
Expand All @@ -281,6 +285,18 @@
"type": "vcs",
"url": "https://github.com/ec-europa/spdx.git"
},
{
"type": "package",
"package": {
"name": "spdx/license-list-data",
"version": "master",
"source": {
"url": "https://github.com/spdx/license-list-data",
"type": "git",
"reference": "master"
}
}
},
{
"type": "vcs",
"url": "https://github.com/ec-europa/rdf_entity.git"
Expand Down
Loading

0 comments on commit da2c23e

Please sign in to comment.