Skip to content

Commit

Permalink
Working matomo. Now using islandora.localhost
Browse files Browse the repository at this point in the history
  • Loading branch information
dannylamb committed Jun 8, 2020
1 parent b78424b commit 544b045
Show file tree
Hide file tree
Showing 9 changed files with 1,212 additions and 24 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ following urls.
- <http://activemq.localhost/admin>
- <http://blazegraph.localhost/bigdata>
- <http://drupal.localhost>
- <http://islandora.localhost>
- <http://fcrepo.localhost/fcrepo/reset>
- <http://matomo.localhost>
Expand All @@ -304,7 +304,7 @@ virtual network, and you can access that address from your machine.
```properties
x.x.x.x activemq.localhost
x.x.x.x blazegraph.localhost
x.x.x.x drupal.localhost
x.x.x.x islandora.localhost
x.x.x.x fcrepo.localhost
x.x.x.x matomo.localhost
```
Expand Down
6 changes: 3 additions & 3 deletions commands/open-in-browser.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,18 +105,18 @@ function main {
activemq) open "http://activemq.localhost/admin" &> /dev/null;;
alpaca) open $(url alpaca 8181 /system/console) &> /dev/null;;
blazegraph) open "http://blazegraph.localhost/bigdata" &> /dev/null;;
cantaloupe) open $(url cantaloupe 8080 /cantaloupe/) &> /dev/null;;
cantaloupe) open "http://islandora.localhost/cantaloupe" &> /dev/null;;
crayfits) open $(url crayfits 8000 /) &> /dev/null;;
fcrepo) open "http://fcrepo.localhost/fcrepo/rest" &> /dev/null;;
gemini) open $(url gemini 8000 /) &> /dev/null;;
homarus) open $(url homarus 8000 /) &> /dev/null;;
houdini) open $(url houdini 8000 /) &> /dev/null;;
hypercube) open $(url hypercube 8000 /) &> /dev/null;;
drupal) open "http://drupal.localhost" &> /dev/null;;
drupal) open "http://islandora.localhost" &> /dev/null;;
milliner) open $(url milliner 8000 /) &> /dev/null;;
recast) open $(url recast 8000 /) &> /dev/null;;
solr) open "http://solr.localhost/solr" &> /dev/null;;
matomo) open "http://matomo.localhost" &> /dev/null;;
matomo) open "http://islandora.localhost/matomo" &> /dev/null;;
*) exit 1;;
esac
}
Expand Down
25 changes: 13 additions & 12 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
# loop back for localhost should make the following urls
# accessible in your browser:
#
# - islandora.localhost
# - activemq.localhost/admin
# - blazegraph.localhost/bigdata
# - drupal.localhost
# - fcrepo.localhost/fcrepo/reset
# - matomo.localhost
#
Expand Down Expand Up @@ -103,15 +103,11 @@ services:
image: ${REPOSITORY:-local}/cantaloupe:latest
volumes:
- cantaloupe-data:/data
networks:
default:
aliases:
- cantaloupe.localhost
labels:
- traefik.http.services.cantaloupe.loadbalancer.server.port=80
- traefik.http.routers.cantaloupe_http.service=cantaloupe
- traefik.http.routers.cantaloupe_http.entrypoints=http
- traefik.http.routers.cantaloupe_http.rule=Host(`drupal.localhost`) && PathPrefix(`/cantaloupe`)
- traefik.http.routers.cantaloupe_http.rule=Host(`islandora.localhost`) && PathPrefix(`/cantaloupe`)
crayfits:
image: ${REPOSITORY:-local}/crayfits:latest
depends_on:
Expand All @@ -137,14 +133,11 @@ services:
- fcrepo
- database
- activemq
networks:
default:
aliases:
- drupal.localhost
labels:
- traefik.http.services.drupal.loadbalancer.server.port=80
- traefik.http.routers.drupal_http.service=drupal
- traefik.http.routers.drupal_http.entrypoints=http
- traefik.http.routers.drupal_http.rule=Host(`islandora.localhost`)
fcrepo:
image: ${REPOSITORY:-local}/fcrepo:latest
volumes:
Expand Down Expand Up @@ -196,6 +189,12 @@ services:
- traefik.http.services.matomo.loadbalancer.server.port=80
- traefik.http.routers.matomo_http.service=matomo
- traefik.http.routers.matomo_http.entrypoints=http
- traefik.http.routers.matomo_http.rule=Host(`islandora.localhost`) && PathPrefix(`/matomo`)
- traefik.http.middlewares.matomo-stripprefix.stripprefix.prefixes=/matomo
- traefik.http.middlewares.matomo-customrequestheaders.headers.customrequestheaders.X-Forwarded-Uri=/matomo
- traefik.http.middlewares.matomo.chain.middlewares=matomo-stripprefix,matomo-customrequestheaders
- traefik.http.routers.matomo_http.middlewares=matomo
#matomo-stripprefix@docker
milliner:
image: ${REPOSITORY:-local}/milliner:latest
volumes:
Expand Down Expand Up @@ -234,5 +233,7 @@ services:
# Do not expose in production.
- traefik.http.routers.api.service=api@internal
networks:
- external
- default
external:
default:
aliases:
- islandora.localhost
10 changes: 10 additions & 0 deletions matomo/rootfs/etc/confd/conf.d/config.ini.php.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[template]
src = "config.ini.php.tmpl"
dest = "/opt/matomo/config/config.ini.php"
uid = 100
gid = 101
mode = "0644"
keys = [
"/db",
"/site",
]
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ dest = "/var/run/islandora/create-matomo-database.sql"
uid = 0
gid = 0
mode = "0600"
keys = [ "/db" ]
keys = [
"/db",
"/site",
"/user",
]
78 changes: 78 additions & 0 deletions matomo/rootfs/etc/confd/templates/config.ini.php.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
; <?php exit; ?> DO NOT REMOVE THIS LINE
; file automatically generated or modified by Matomo; you can manually override the default values in global.ini.php by redefining them in this file.
[database]
host = {{ getv "/db/host" "database" }}
username = {{ getv "/db/user" "matomo" }}
password = {{ getv "/db/password" "password" }}
dbname = {{ getv "/db/name" "matomo" }}
tables_prefix = "matomo_"

[General]
proxy_uri_header = 1
proxy_client_headers[] = "HTTP_X_FORWARDED_FOR"
proxy_host_headers[] = "HTTP_X_FORWARDED_HOST"
salt = "5a472390550bd59e4428a41aa472137b"
trusted_hosts[] = {{ getv "/site/host" "islandora.localhost" }}

[PluginsInstalled]
PluginsInstalled[] = "Diagnostics"
PluginsInstalled[] = "Login"
PluginsInstalled[] = "CoreAdminHome"
PluginsInstalled[] = "UsersManager"
PluginsInstalled[] = "SitesManager"
PluginsInstalled[] = "Installation"
PluginsInstalled[] = "Monolog"
PluginsInstalled[] = "Intl"
PluginsInstalled[] = "CorePluginsAdmin"
PluginsInstalled[] = "CoreHome"
PluginsInstalled[] = "WebsiteMeasurable"
PluginsInstalled[] = "IntranetMeasurable"
PluginsInstalled[] = "CoreVisualizations"
PluginsInstalled[] = "Proxy"
PluginsInstalled[] = "API"
PluginsInstalled[] = "Widgetize"
PluginsInstalled[] = "Transitions"
PluginsInstalled[] = "LanguagesManager"
PluginsInstalled[] = "Actions"
PluginsInstalled[] = "Dashboard"
PluginsInstalled[] = "MultiSites"
PluginsInstalled[] = "Referrers"
PluginsInstalled[] = "UserLanguage"
PluginsInstalled[] = "DevicesDetection"
PluginsInstalled[] = "Goals"
PluginsInstalled[] = "Ecommerce"
PluginsInstalled[] = "SEO"
PluginsInstalled[] = "Events"
PluginsInstalled[] = "UserCountry"
PluginsInstalled[] = "GeoIp2"
PluginsInstalled[] = "VisitsSummary"
PluginsInstalled[] = "VisitFrequency"
PluginsInstalled[] = "VisitTime"
PluginsInstalled[] = "VisitorInterest"
PluginsInstalled[] = "RssWidget"
PluginsInstalled[] = "Feedback"
PluginsInstalled[] = "TwoFactorAuth"
PluginsInstalled[] = "CoreUpdater"
PluginsInstalled[] = "CoreConsole"
PluginsInstalled[] = "ScheduledReports"
PluginsInstalled[] = "UserCountryMap"
PluginsInstalled[] = "Live"
PluginsInstalled[] = "CustomVariables"
PluginsInstalled[] = "PrivacyManager"
PluginsInstalled[] = "ImageGraph"
PluginsInstalled[] = "Annotations"
PluginsInstalled[] = "MobileMessaging"
PluginsInstalled[] = "Overlay"
PluginsInstalled[] = "SegmentEditor"
PluginsInstalled[] = "Insights"
PluginsInstalled[] = "Morpheus"
PluginsInstalled[] = "Contents"
PluginsInstalled[] = "BulkTracking"
PluginsInstalled[] = "Resolution"
PluginsInstalled[] = "DevicePlugins"
PluginsInstalled[] = "Heartbeat"
PluginsInstalled[] = "Marketplace"
PluginsInstalled[] = "ProfessionalServices"
PluginsInstalled[] = "UserId"
PluginsInstalled[] = "CustomPiwikJs"
PluginsInstalled[] = "Tour"
20 changes: 17 additions & 3 deletions matomo/rootfs/etc/confd/templates/create-matomo-database.sh.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ function main {
local port="{{ getv "/db/port" "3306" }}"
local user="{{ getv "/db/root/user" "root" }}"
local password="{{ getv "/db/root/password" "password" }}"
local dbname="{{getv "/db/name" "matomo"}}"

if [[ "${driver}" == "pdo_mysql" ]]; then
echo "Waiting for connection to database."
Expand All @@ -17,14 +18,27 @@ function main {
--user "${user}" \
--password "${password}"

echo "Create database / user if it does not exist."
mysql \
echo "Querying for an existing Matomo database named ${dbname}."
local databases=$(mysql \
--user="${user}" \
--password="${password}" \
--host="${host}" \
--port="${port}" \
--protocol=tcp \
< /var/run/islandora/create-matomo-database.sql
-e "SHOW DATABASES")

if ! grep -q "${dbname}" <<< "${databases}"; then
echo "No database found, creating a database named ${dbname}"
mysql \
--user="${user}" \
--password="${password}" \
--host="${host}" \
--port="${port}" \
--protocol=tcp \
< /var/run/islandora/create-matomo-database.sql
else
echo "Existing database found, skipping installation."
fi
else
echo "Only MySQL databases are supported for now."
exit 1
Expand Down
Loading

0 comments on commit 544b045

Please sign in to comment.