Skip to content

Commit d847de6

Browse files
authored
Merge pull request #24 from MITLibraries/INFRA-517
INFRA-517: Phase 2
2 parents 3430e80 + 4267d1a commit d847de6

11 files changed

+543
-77
lines changed

.github/workflows/dev-build.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
### This is the Terraform-generated dev-build.yml workflow for the docker-matomo-dev app repository ###
2-
### If this is a Lambda repo, uncomment the FUNCTION line at the end of the document ###
3-
### If the container requires any additional pre-build commands, uncomment and edit ###
4-
### the PREBUILD line at the end of the document. ###
1+
### This is the Terraform-generated dev-build.yml workflow for the ###
2+
### docker-matomo-dev app repository. ###
3+
### If this is a Lambda repo, uncomment the FUNCTION line at the end of the ###
4+
### document. If the container requires any additional pre-build commands, ###
5+
### uncomment and edit the PREBUILD line at the end of the document. ###
56
name: Dev Container Build and Deploy
67
on:
78
workflow_dispatch:
@@ -11,8 +12,15 @@ on:
1112
paths-ignore:
1213
- '.github/**'
1314

15+
permissions: read-all
16+
1417
jobs:
1518
deploy:
19+
# These permissions are needed to interact with GitHub's OIDC Token endpoint.
20+
permissions:
21+
id-token: write
22+
contents: read
23+
1624
name: Dev Container Deploy
1725
uses: mitlibraries/.github/.github/workflows/ecr-shared-deploy-dev.yml@main
1826
secrets: inherit

.github/workflows/prod-promote.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
1-
### This is the Terraform-generated prod-promote.yml workflow for the docker-matomo-prod repository. ###
2-
### If this is a Lambda repo, uncomment the FUNCTION line at the end of the document. ###
1+
### This is the Terraform-generated prod-promote.yml workflow for the ###
2+
### docker-matomo-prod repository. ###
3+
### If this is a Lambda repo, uncomment the FUNCTION line at the end of the ###
4+
### document. ###
35
name: Prod Container Promote
46
on:
57
workflow_dispatch:
68
release:
79
types: [published]
810

11+
permissions: read-all
12+
913
jobs:
1014
deploy:
15+
# These permissions are needed to interact with GitHub's OIDC Token endpoint.
16+
permissions:
17+
id-token: write
18+
contents: read
19+
1120
name: Prod Container Promote
1221
uses: mitlibraries/.github/.github/workflows/ecr-shared-promote-prod.yml@main
1322
secrets: inherit

.github/workflows/stage-build.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
### This is the Terraform-generated dev-build.yml workflow for the docker-matomo-stage app repository ###
2-
### If this is a Lambda repo, uncomment the FUNCTION line at the end of the document ###
3-
### If the container requires any additional pre-build commands, uncomment and edit ###
4-
### the PREBUILD line at the end of the document. ###
1+
### This is the Terraform-generated dev-build.yml workflow for the ###
2+
### docker-matomo-stage app repository. ###
3+
### If this is a Lambda repo, uncomment the FUNCTION line at the end of the ###
4+
### document. If the container requires any additional pre-build commands, ###
5+
### uncomment and edit the PREBUILD line at the end of the document. ###
56
name: Stage Container Build and Deploy
67
on:
78
workflow_dispatch:
@@ -11,8 +12,15 @@ on:
1112
paths-ignore:
1213
- '.github/**'
1314

15+
permissions: read-all
16+
1417
jobs:
1518
deploy:
19+
# These permissions are needed to interact with GitHub's OIDC Token endpoint.
20+
permissions:
21+
id-token: write
22+
contents: read
23+
1624
name: Stage Container Deploy
1725
uses: mitlibraries/.github/.github/workflows/ecr-shared-deploy-stage.yml@main
1826
secrets: inherit

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
.env
22
**/.DS_Store
3+
temp/

Dockerfile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,16 @@ COPY ./files/plugin-HeatmapSessionRecording-5.2.3/ /var/www/html/plugins/Heatmap
1414
# Add the UsersFlow plugin
1515
COPY ./files/plugin-UsersFlow-5.0.5/ /var/www/html/plugins/UsersFlow
1616

17-
# Preconfigure settings
17+
# Our custom configuration settings
1818
COPY ./files/config.ini.php /var/www/html/config/config.ini.php
1919

20+
# The HeatmapSessionRecording and UsersFlow update the matomo.js and piwik.js
21+
# files when they are activated. Those updates have been captured and we
22+
# pre-load them here (we put them in /usr/src because the entrypoint.sh is what
23+
# actually builds the /var/www/html folder as a Docker VOLUME)
24+
COPY --chmod=0644 ./files/post_premium_plugins_matomo.js /usr/src/matomo/matomo.js
25+
COPY --chmod=0644 ./files/post_premium_plugins_piwik.js /usr/src/matomo/piwik.js
26+
2027
# Address "public" directories problem
2128
COPY --chmod=0644 --chown=root:root ./files/lang-htaccess /var/www/html/lang/.htaccess
2229
COPY --chmod=0644 --chown=root:root ./files/config-htaccess /var/www/html/config/.htaccess

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
.PHONY: help dist-dev publish-dev dist-stage publish-stage
22
SHELL=/bin/bash
33
### This is the Terraform-generated header for docker-matomo-dev. If ###
4-
### this is a Lambda repo, uncomment the FUNCTION line below ###
5-
### and review the other commented lines in the document. ###
4+
### this is a Lambda repo, uncomment the FUNCTION line below ###
5+
### and review the other commented lines in the document. ###
66
ECR_NAME_DEV:=docker-matomo-dev
77
ECR_URL_DEV:=222053980223.dkr.ecr.us-east-1.amazonaws.com/docker-matomo-dev
88
# FUNCTION_DEV:=
9-
### End of Terraform-generated header ###
9+
### End of Terraform-generated header ###
1010

1111
help: ## Print this message
1212
@awk 'BEGIN { FS = ":.*##"; print "Usage: make <target>\n\nTargets:" } \

docs/HowTos/HOWTO-migrate-from-legacy-AWS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ Before getting started, make sure that you have access to the `root` password fo
2121

2222
### Legacy AWS
2323

24-
In the legacy Stage/Prod account, log in to the `efs-access-matomo-<env>` EC2 instance (`<env>` is either `stage` or `prod` depending on the database being backed up). Requires AWS CLI v2, AWS Session-Manager Plugin for AWSCLI.
24+
In the legacy Stage/Prod account, log in to the `matomo-efs-mgmt` EC2 instance (`<env>` is either `stage` or `prod` depending on the database being backed up). Requires AWS CLI v2, AWS Session-Manager Plugin for AWSCLI.
2525

2626
To capture the InstanceID of the EC2 instance to connect to, run the following command:
2727

2828
```bash
29-
aws ec2 describe-instances --filters "Name=tag:Name,Values=efs-access-matomo-<env>" --query "Reservations[*].Instances[*].[InstanceId]" --output text
29+
aws ec2 describe-instances --filters "Name=tag:Name,Values=matomo-efs-mgmt" --query "Reservations[*].Instances[*].[InstanceId]" --output text
3030
```
3131

3232
To capture the RDS_ENDPOINT for the database, run the following command:

docs/HowTos/HOWTO-premium-plugins.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ In the end, the premium plugin installation is a two-pass process.
2323
### High level overview
2424

2525
1. Install license key (via UI or CLI) so that it is in the database.
26-
2. Go through a dev -> stage -> prod deployment cycle of the container to install the plugin folder(s) into the container and update the `config.ini.php` file with new line(s) in the `[PluginsInstalled]` section.
26+
2. Go through a dev -> stage -> prod deployment cycle of the container to install the plugin folder(s) into the container.
2727
3. Activate the new plugin(s) (via UI or CLI) so that any database changes are properly executed.
2828
4. Go through a dev -> stage -> prod deployment cycle of the container to match the updated `config.ini.php` file on the server.
2929

@@ -41,20 +41,20 @@ According to the support team at Matomo, the premium license key can be installe
4141

4242
This needs to be done on each of the stage & prod instances of Matomo.
4343

44-
#### 2. Install plugin
44+
#### 2. Install the plugin files
4545

46-
In this phase, the files are installed in the container and the `config.ini.php` is updated to match the installation. This will **not** activate the plugins, it will just make them visible in the UI. The only new lines in the `config.ini.php` should be in the `[PluginsInstalled]` section.
46+
In this phase, the files are installed in the container *but no changes are made to the `config.ini.php` file. This will **not** activate the plugins, it will just make them visible in the UI.
4747

48-
#### 3. Activate plugin
48+
#### 3. Activate the plugin
4949

50-
Once the plugin is installed, it's time to activate it. In the UI, it's just a matter of clicking the `Activate` link for the plugin. For the CLI, the command is
50+
Once the plugin files are installed in the container, it's time to activate the plugin. In the UI, it's just a matter of clicking the `Activate` link for the plugin. For the CLI, the command is
5151

5252
```bash
5353
./console plugin:activate [<plugin>...]
5454
```
5555

5656
This will change the `config.ini.php` file on the container. It is **very** important to capture these changes and put them back in the `config.ini.php` in the container (see step 4).
5757

58-
#### 4. Deploy new config.ini.php
58+
#### 4. Backfill this repo
5959

60-
After capturing the changes to `config.ini.php`, go through another round of dev -> stage -> prod deploys.
60+
Update the `config.ini.php` file in this repo and go through another dev -> stage -> prod deployment to ensure that the repo code matches the container running in AWS.

files/config.ini.php

Lines changed: 75 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -88,81 +88,102 @@
8888
Plugins[] = "Resolution"
8989
Plugins[] = "DevicePlugins"
9090
Plugins[] = "Heartbeat"
91-
Plugins[] = "Marketplace"
9291
Plugins[] = "Intl"
92+
Plugins[] = "Marketplace"
93+
Plugins[] = "CustomJsTracker"
9394
Plugins[] = "Tour"
9495
Plugins[] = "PagePerformance"
9596
Plugins[] = "CustomDimensions"
9697
Plugins[] = "FeatureFlags"
9798
Plugins[] = "MobileAppMeasurable"
9899
Plugins[] = "CustomVariables"
99100
Plugins[] = "EnvironmentVariables"
101+
Plugins[] = "HeatmapSessionRecording"
102+
Plugins[] = "UsersFlow"
103+
100104

101105
[PluginsInstalled]
102-
PluginsInstalled[] = "Diagnostics"
103-
PluginsInstalled[] = "Login"
106+
PluginsInstalled[] = "API"
107+
PluginsInstalled[] = "Actions"
108+
PluginsInstalled[] = "Annotations"
109+
PluginsInstalled[] = "BulkTracking"
110+
PluginsInstalled[] = "Contents"
104111
PluginsInstalled[] = "CoreAdminHome"
105-
PluginsInstalled[] = "UsersManager"
106-
PluginsInstalled[] = "SitesManager"
107-
PluginsInstalled[] = "Installation"
108-
PluginsInstalled[] = "Monolog"
109-
PluginsInstalled[] = "Intl"
110-
PluginsInstalled[] = "CorePluginsAdmin"
112+
PluginsInstalled[] = "CoreConsole"
111113
PluginsInstalled[] = "CoreHome"
112-
PluginsInstalled[] = "WebsiteMeasurable"
113-
PluginsInstalled[] = "IntranetMeasurable"
114+
PluginsInstalled[] = "CorePluginsAdmin"
115+
PluginsInstalled[] = "CoreUpdater"
114116
PluginsInstalled[] = "CoreVisualizations"
115-
PluginsInstalled[] = "Proxy"
116-
PluginsInstalled[] = "API"
117-
PluginsInstalled[] = "Widgetize"
118-
PluginsInstalled[] = "Transitions"
119-
PluginsInstalled[] = "LanguagesManager"
120-
PluginsInstalled[] = "Actions"
117+
PluginsInstalled[] = "CoreVue"
118+
PluginsInstalled[] = "CustomDimensions"
119+
PluginsInstalled[] = "CustomVariables"
120+
PluginsInstalled[] = "CustomJsTracker"
121+
PluginsInstalled[] = "DBStats"
121122
PluginsInstalled[] = "Dashboard"
122-
PluginsInstalled[] = "MultiSites"
123-
PluginsInstalled[] = "Referrers"
124-
PluginsInstalled[] = "UserLanguage"
123+
PluginsInstalled[] = "DevicePlugins"
125124
PluginsInstalled[] = "DevicesDetection"
126-
PluginsInstalled[] = "Goals"
125+
PluginsInstalled[] = "Diagnostics"
127126
PluginsInstalled[] = "Ecommerce"
128-
PluginsInstalled[] = "SEO"
127+
PluginsInstalled[] = "EnvironmentVariables"
129128
PluginsInstalled[] = "Events"
130-
PluginsInstalled[] = "UserCountry"
131-
PluginsInstalled[] = "GeoIp2"
132-
PluginsInstalled[] = "VisitsSummary"
133-
PluginsInstalled[] = "VisitFrequency"
134-
PluginsInstalled[] = "VisitTime"
135-
PluginsInstalled[] = "VisitorInterest"
136-
PluginsInstalled[] = "RssWidget"
129+
PluginsInstalled[] = "FeatureFlags"
137130
PluginsInstalled[] = "Feedback"
138-
PluginsInstalled[] = "TwoFactorAuth"
139-
PluginsInstalled[] = "CoreUpdater"
140-
PluginsInstalled[] = "CoreConsole"
141-
PluginsInstalled[] = "ScheduledReports"
142-
PluginsInstalled[] = "UserCountryMap"
143-
PluginsInstalled[] = "Live"
144-
PluginsInstalled[] = "CustomVariables"
145-
PluginsInstalled[] = "PrivacyManager"
131+
PluginsInstalled[] = "GeoIp2"
132+
PluginsInstalled[] = "Goals"
133+
PluginsInstalled[] = "Heartbeat"
134+
PluginsInstalled[] = "HeatmapSessionRecording"
146135
PluginsInstalled[] = "ImageGraph"
147-
PluginsInstalled[] = "Annotations"
148-
PluginsInstalled[] = "MobileMessaging"
149-
PluginsInstalled[] = "Overlay"
150-
PluginsInstalled[] = "SegmentEditor"
151136
PluginsInstalled[] = "Insights"
152-
PluginsInstalled[] = "Morpheus"
153-
PluginsInstalled[] = "Contents"
154-
PluginsInstalled[] = "BulkTracking"
155-
PluginsInstalled[] = "Resolution"
156-
PluginsInstalled[] = "DevicePlugins"
157-
PluginsInstalled[] = "Heartbeat"
137+
PluginsInstalled[] = "Installation"
138+
PluginsInstalled[] = "Intl"
139+
PluginsInstalled[] = "IntranetMeasurable"
140+
PluginsInstalled[] = "JsTrackerInstallCheck"
141+
PluginsInstalled[] = "LanguagesManager"
142+
PluginsInstalled[] = "Live"
143+
PluginsInstalled[] = "Login"
158144
PluginsInstalled[] = "Marketplace"
159-
PluginsInstalled[] = "ProfessionalServices"
160-
PluginsInstalled[] = "Tour"
161-
PluginsInstalled[] = "EnvironmentVariables"
162-
PluginsInstalled[] = "CoreVue"
163145
PluginsInstalled[] = "MobileAppMeasurable"
146+
PluginsInstalled[] = "MobileMessaging"
147+
PluginsInstalled[] = "Monolog"
148+
PluginsInstalled[] = "Morpheus"
149+
PluginsInstalled[] = "MultiSites"
150+
PluginsInstalled[] = "Overlay"
164151
PluginsInstalled[] = "PagePerformance"
165-
PluginsInstalled[] = "CustomDimensions"
166-
PluginsInstalled[] = "FeatureFlags"
152+
PluginsInstalled[] = "PrivacyManager"
153+
PluginsInstalled[] = "ProfessionalServices"
154+
PluginsInstalled[] = "Proxy"
155+
PluginsInstalled[] = "Referrers"
156+
PluginsInstalled[] = "Resolution"
157+
PluginsInstalled[] = "RssWidget"
158+
PluginsInstalled[] = "SEO"
159+
PluginsInstalled[] = "ScheduledReports"
160+
PluginsInstalled[] = "SegmentEditor"
161+
PluginsInstalled[] = "SitesManager"
162+
PluginsInstalled[] = "TagManager"
163+
PluginsInstalled[] = "Tour"
164+
PluginsInstalled[] = "Transitions"
165+
PluginsInstalled[] = "TwoFactorAuth"
166+
PluginsInstalled[] = "UserCountry"
167+
PluginsInstalled[] = "UserCountryMap"
168+
PluginsInstalled[] = "UserId"
169+
PluginsInstalled[] = "UserLanguage"
167170
PluginsInstalled[] = "UsersFlow"
168-
PluginsInstalled[] = "HeatmapSessionRecording"
171+
PluginsInstalled[] = "UsersManager"
172+
PluginsInstalled[] = "VisitFrequency"
173+
PluginsInstalled[] = "VisitTime"
174+
PluginsInstalled[] = "VisitorInterest"
175+
PluginsInstalled[] = "VisitsSummary"
176+
PluginsInstalled[] = "WebsiteMeasurable"
177+
PluginsInstalled[] = "Widgetize"
178+
179+
[HeatmapSessionRecording]
180+
add_tracking_code_only_when_needed = 1
181+
session_recording_sample_limits = "50,100,250,500,1000,2000,5000"
182+
load_css_from_db = 1
183+
max_time_allowed_on_page_column_limit = "9.2233720368548E+18"
184+
default_heatmap_width = 1920
185+
186+
[UsersFlow]
187+
UsersFlow_num_max_steps = 10
188+
UsersFlow_num_max_rows_in_actions = 100
189+
UsersFlow_num_max_links_per_interaction = 5000

0 commit comments

Comments
 (0)