You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+44-9Lines changed: 44 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,15 +5,22 @@ This repository supports MIT Libraries' implementation of [Matomo](https://matom
5
5
## Dependencies
6
6
7
7
* Deploying this container to AWS requires that the AWS ECR Repository for the container has been created by the [mitlib-tf-workloads-ecr](https://github.com/MITLibraries/mitlib-tf-workloads-ecr) repository.
8
+
* Running this container in AWS requires the [mitlib-tf-workloads-matomo](https://github.com/mitlibraries/mitlib-tf-workloads-matomo) infrastructure repository.
8
9
* Building this container requires access to [Official Docker Matomo](https://hub.docker.com/_/matomo/).
9
10
10
-
## Build
11
+
## Dev/Test Build
11
12
12
13
Run `make dist-dev` to create a new container tagged as `matomo:latest`.
13
14
14
-
## Deploy
15
+
## Dev/Test Deploy
15
16
16
-
Run `make publish-dev` to build, tag, and push a container to Dev1 for testing, or open a PR to `main`. Merge a PR to `main` to build, tag, and push the container to Stage-Workloads. After merging the PR to `main`, tag a release to promote to production.
17
+
Run `make publish-dev` to build, tag, and push a container to Dev1 for testing, or open a PR to `main` (a GitHub Action will build, tag, push the container for you).
18
+
19
+
## Stage Builds and Promotion to Prod
20
+
21
+
Merge a PR to `main` to build, tag, and push the container to Stage-Workloads. After merging the PR to `main`, tag a release on the `main` branch to promote to production. GitHub Actions in this repo will take care of the build, tag, push to Stage and the copy from Stage to Production.
22
+
23
+
**Important Note**: There is no automation in GitHub to automatically deploy the new container after it is push to the ECR repository in AWS. At this time, the only method to deploy the updated container is to force a new deployment of the Matomo service via the AWS Console.
17
24
18
25
## Implementation notes
19
26
@@ -24,15 +31,39 @@ For detailed instructions on initial setup, migration, database upgrades, and ap
24
31
"State" for Matomo is managed/stored in at most two locations:
25
32
26
33
* the `config.ini.php` file
27
-
* the MySQL database
34
+
* the MariaDB database
35
+
36
+
The `config.ini.php` file contains some core Matomo configuration. There are a couple of sections worth addressing. First, a note about a special plugin we use.
37
+
38
+
#### The EnvironmentVariables Plugin
39
+
40
+
We use the [EnvironmentVariables](https://plugins.matomo.org/EnvironmentVariables) plugin that allows us to set configuration values for Matomo via environment variables via the [mitlib-tf-workloads-matomo](https://github.com/mitlibraries/mitlib-tf-workloads-matomo) infrastructure repo.
41
+
42
+
The current practice is to set the following core configuration information in `config.ini.php` via environment variables.
43
+
44
+
* Database connection information
45
+
* SSL/TLS configuration
46
+
* SMTP information
47
+
48
+
The remainder of the configuration values should be set by modifying the [config.ini.php](./files/config.ini.php) file and building an updated container.
28
49
29
-
The `config.ini.php` file contains some core Matomo configuration. There are a couple of sections worth addressing:
50
+
#### [Plugins] and [PluginsInstalled]
30
51
31
-
1. The `[Plugins]` section tells Matomo which plugins to enable on installation. To disable a plugin, simply remove it from this section. Our preference is to modify this section and not the `PluginsInstalled` section, as removing a plugin from `PluginsInstalled` would remove it from the application completely. *Sadly, with the container-based Matomo, it seems to only way to activate a plugin is to use the Matomo web UI*.
32
-
1. The `[mail]` section configures the SMTP server. Matomo uses mailers for several core functions, including password resets and reporting. Some related config values (e.g., `login_password_recovery_email_address`) are defined in the `[General]` section.
33
-
1. The `[General]` section handles other configurations. A few of these settings are covered by the EnvironmentVariables plugin, but the rest are managed in this code.
52
+
The `[Plugins]` section tells Matomo which plugins to enable on installation. To disable a plugin, simply remove it from this section. Our preference is to modify this section and not the `PluginsInstalled` section, as removing a plugin from `PluginsInstalled` would remove it from the application completely. While plugins can get installed in the container build, they are not automatically activated. There are two activation methods that can be used: via the web UI or via the CLI. See [Install a new plugin](https://matomo.org/faq/plugins/faq_21/) in the official Matomo documentation.
34
53
35
-
By using the [EnvironmentVariables](https://plugins.matomo.org/EnvironmentVariables) plugin for Matomo, we generally don't need to store much in the `config.ini.php` file. Instead, the [mitlib-tf-workloads-matomo](https://github.com/MITLibraries/mitlib-tf-workloads-matomo) code defines the key environment variables for the ECS service, overriding anything in `config.ini.php` and `global.ini.php`.
54
+
Any time plugins are installed/removed, it is imperative to capture a backup of the `config.ini.php` file (via the EFS partition) before launching the updated container and then compare it to the `config.ini.php` file after verifying that the plugin is activated. This is one of the few situations where the Matomo application might update/overwrite the `config.ini.php` file.
55
+
56
+
#### [Mail]
57
+
58
+
The `[mail]` section configures the SMTP server. Matomo uses mailers for several core functions, including password resets and reporting. Some related config values (e.g., `login_password_recovery_email_address`) are defined in the `[General]` section.
59
+
60
+
All of the settings in `[mail]` are managed via environment variables that are set by the [mitlib-tf-workloads-matomo](https://github.com/mitlibraries/mitlib-tf-workloads-matomo) infrastructure repo.
61
+
62
+
#### [General]
63
+
64
+
The `[General]` section handles other configurations. A few of these settings are covered by the EnvironmentVariables plugin, but the rest are managed in this code.
65
+
66
+
#### Other configuration
36
67
37
68
The database stores the rest of the state of Matomo: all the data itself along with the Superuser credentials and the other user accounts and credentials.
38
69
@@ -54,6 +85,10 @@ We generally assign the 'View' role to new users, unless they require a higher p
54
85
55
86
Matomo has built-in two-factor authentication, which we enforce for all accounts. When a user logs in to Matomo for the first time, they will be prompted to configure 2FA. At this time, we are recommending Duo as an authenticator.
56
87
88
+
#### Recover from lost 2FA
89
+
90
+
See the official [Recover from lost 2FA](https://matomo.org/faq/how-to/faq_27248) documentation. This allows us to recover the Superuser login if we lose the 2FA information.
91
+
57
92
## Additional documentation
58
93
59
94
*[MIT Libraries dev docs](https://mitlibraries.github.io/guides/misc/matomo.html) - includes information about setting up a website for tracking in Matomo.
Detailed how-to instructions for upgrade scenarios.
4
+
5
+
## Upgrade Database Engine
6
+
7
+
The database engine is managed by [mitlib-tf-workloads-matomo](https://github.com/mitlibraries/mitlib-tf-workloads-matomo). In testing, Matomo had no problems with database engine upgrades through different MariaDB versions.
8
+
9
+
## Update Matomo version
10
+
11
+
1. Ensure that a backup of the current `config/config.ini.php` exists in the EFS mount.
12
+
1. Publish updated container to ECR.
13
+
1. Deploy updated container for ECS service.
14
+
1. Verify via webUI that the Matomo installation is ready to be upgraded.
15
+
1. SSH (via AWSCLI + Session Manager) to the container and run the upgrade on the CLI (see the [Troubleshooting](./HOWTO-miscellaneous.md) section). It might be possible to do this via the web UI, but there seems to be a timeout issue related to health checks.
16
+
1. Copy updated `config/config.ini.php` to the EFS mount.
17
+
1. Verify that there were no changes to the `config.ini.php` file that need to be captured here.
0 commit comments