|
1 | 1 | # ns8-matomo |
2 | 2 |
|
3 | | -This is a module for [ns8-matomo8] for the Project (https://github.com/matomo-org/matomo). |
4 | | -This is a module is based on the matomo Docker [matomo.org] (https://github.com/matomo-org/docker). |
| 3 | +This is a module for [NS8](https://github.com/NethServer/ns8-matomo) for the [Matomo](https://github.com/matomo-org/matomo) project. |
5 | 4 |
|
6 | | -Start and configure a Matomo instance: |
| 5 | +The module is based on the official [Matomo Docker image](https://github.com/matomo-org/docker). |
7 | 6 |
|
8 | | -with PHP FPM + nginx as a proxy |
9 | | -redis caching |
10 | | -MariaDB database The module uses Official matomo image. |
| 7 | +## Features |
11 | 8 |
|
12 | | -1. Rename some references inside the repo: |
13 | | - ``` |
14 | | - modulename=$(basename $(pwd) | sed 's/^ns8-//') |
15 | | - git mv imageroot/systemd/user/matomo.service imageroot/systemd/user/${modulename}.service |
16 | | - git mv tests/matomo.robot tests/${modulename}.robot |
17 | | - sed -i "s/matomo/${modulename}/g" $(find .github/ * -type f) |
18 | | - git commit -a -m "Repository initialization" |
19 | | - ``` |
20 | | - |
21 | | - |
22 | | - |
23 | | -1. Adjust `.github/workflows` to your needs. `clean-registry.yml` might |
24 | | - need the proper list of image names to work correctly. Unused workflows |
25 | | - can be disabled from the GitHub Actions interface. |
26 | | - |
27 | | -1. Commit and push your local changes |
| 9 | +- PHP FPM with nginx as reverse proxy |
| 10 | +- Redis caching |
| 11 | +- MariaDB database |
28 | 12 |
|
29 | 13 | ## Install |
30 | 14 |
|
31 | 15 | Instantiate the module with: |
32 | 16 |
|
33 | | - add-module ghcr.io/compgeniuses/matomo:latest 1 |
| 17 | +```bash |
| 18 | +add-module ghcr.io/geniusdynamics/matomo:latest 1 |
| 19 | +``` |
34 | 20 |
|
35 | 21 | The output of the command will return the instance name. |
36 | | -Output example: |
37 | 22 |
|
38 | | - {"module_id": "matomo1", "image_name": "matomo", "image_url": "ghcr.io/compgeniuses/matomo:latest"} |
| 23 | +Example output: |
| 24 | + |
| 25 | +```json |
| 26 | +{ |
| 27 | + "module_id": "matomo1", |
| 28 | + "image_name": "matomo", |
| 29 | + "image_url": "ghcr.io/geniusdynamics/matomo:latest" |
| 30 | +} |
| 31 | +``` |
39 | 32 |
|
40 | 33 | ## Configure |
41 | 34 |
|
42 | | -Let's assume that the dokuwiki istance is named `matomo1`. |
| 35 | +Assuming the Matomo instance is named `matomo1`, launch `configure-module` with the following parameters: |
| 36 | + |
| 37 | +### MariaDB Service Configuration |
43 | 38 |
|
44 | | -Then launch `configure-module`, by setting the following parameters: |
45 | | -## MAriDB Service Configurations |
| 39 | +| Parameter | Value | |
| 40 | +| -------------------------------- | ----------------------------------- | |
| 41 | +| `MYSQL_ROOT_PASSWORD` | Set a strong password for root user | |
| 42 | +| `MARIADB_AUTO_UPGRADE` | 1 | |
| 43 | +| `MARIADB_DISABLE_UPGRADE_BACKUP` | 1 | |
46 | 44 |
|
47 | | -- `MYSQL_ROOT_PASSWORD`: |
48 | | -- `MARIADB_AUTO_UPGRADE`: 1 |
49 | | -- `MARIADB_DISABLE_UPGRADE_BACKUP`: 1 |
| 45 | +### Database Configuration |
50 | 46 |
|
51 | | -## DB Configurations |
| 47 | +| Parameter | Description | |
| 48 | +| ------------------------------- | ------------------------------------- | |
| 49 | +| `MYSQL_PASSWORD` | Password for the Matomo database user | |
| 50 | +| `MYSQL_DATABASE` | Name of the Matomo database | |
| 51 | +| `MYSQL_USER` | Username for the Matomo database | |
| 52 | +| `MATOMO_DATABASE_ADAPTER` | mysql | |
| 53 | +| `MATOMO_DATABASE_TABLES_PREFIX` | Table prefix (optional) | |
| 54 | +| `MATOMO_DATABASE_USERNAME` | Database username | |
| 55 | +| `MATOMO_DATABASE_PASSWORD` | Database password | |
| 56 | +| `MATOMO_DATABASE_DBNAME` | Database name | |
| 57 | +| `MARIADB_INITDB_SKIP_TZINFO` | 1 | |
52 | 58 |
|
53 | | -- `MYSQL_PASSWORD`: administrator mail address |
54 | | -- `MYSQL_DATABASE`: administrator mail address |
55 | | -- `MYSQL_USER`: administrator mail address |
56 | | -- `MATOMO_DATABASE_ADAPTER`: mysql |
57 | | -- `MATOMO_DATABASE_TABLES_PREFIX`: administrator mail address |
58 | | -- `MATOMO_DATABASE_USERNAME`: administrator mail address |
59 | | -- `MATOMO_DATABASE_PASSWORD`: administrator mail address |
60 | | -- `MATOMO_DATABASE_DBNAME`: administrator mail address |
61 | | -- `MARIADB_AUTO_UPGRADE`: 1 |
62 | | -- `MARIADB_INITDB_SKIP_TZINFO`: 1 |
| 59 | +### Matomo Environment Configuration |
63 | 60 |
|
64 | | -## matomo env Configurations |
65 | | -- `MATOMO_DATABASE_HOST`: 1 |
66 | | -- `PHP_MEMORY_LIMIT`: 2048 |
67 | | -- `host`: a fully qualified domain name for the wiki |
68 | | -- `http2https`: enable or disable HTTP to HTTPS redirection |
69 | | -- `lets_encrypt`: enable or disable Let's Encrypt certificate |
| 61 | +| Parameter | Description | |
| 62 | +| ---------------------- | ------------------------------------------- | |
| 63 | +| `MATOMO_DATABASE_HOST` | Database host (e.g., MariaDB module) | |
| 64 | +| `PHP_MEMORY_LIMIT` | PHP memory limit (e.g., 2048M) | |
| 65 | +| `host` | Fully qualified domain name for Matomo | |
| 66 | +| `http2https` | Enable or disable HTTP to HTTPS redirection | |
| 67 | +| `lets_encrypt` | Enable or disable Let's Encrypt certificate | |
70 | 68 |
|
71 | 69 | Example: |
72 | 70 |
|
73 | | - api-cli run module/matomo1/configure-module --data '{}' |
| 71 | +```bash |
| 72 | +api-cli run module/matomo1/configure-module --data '{}' |
| 73 | +``` |
74 | 74 |
|
75 | | -The above command will: |
76 | | -- start and configure the matomo instance |
77 | | -- (describe configuration process) |
78 | | -- ... |
| 75 | +The above command will start and configure the Matomo instance. |
79 | 76 |
|
80 | | -Send a test HTTP request to the matomo backend service: |
| 77 | +Test the Matomo backend service: |
81 | 78 |
|
82 | | - curl http://127.0.0.1/matomo/ |
| 79 | +```bash |
| 80 | +curl http://127.0.0.1/matomo/ |
| 81 | +``` |
83 | 82 |
|
84 | | -## Smarthost setting discovery |
| 83 | +## Smarthost Setting Discovery |
85 | 84 |
|
86 | | -Some configuration settings, like the smarthost setup, are not part of the |
87 | | -`configure-module` action input: they are discovered by looking at some |
88 | | -Redis keys. To ensure the module is always up-to-date with the |
89 | | -centralized [smarthost |
90 | | -setup](https://compgeniuses.github.io/ns8-core/core/smarthost/) every time |
91 | | -matomo starts, the command `bin/discover-smarthost` runs and refreshes |
92 | | -the `state/smarthost.env` file with fresh values from Redis. |
| 85 | +Some configuration settings, like the smarthost setup, are not part of the `configure-module` action input: they are discovered by looking at some Redis keys. To ensure the module is always up-to-date with the centralized [smarthost setup](https://geniusdynamics.github.io/ns8-core/core/smarthost/) every time Matomo starts, the command `bin/discover-smarthost` runs and refreshes the `state/smarthost.env` file with fresh values from Redis. |
93 | 86 |
|
94 | | -Furthermore if smarthost setup is changed when matomo is already |
95 | | -running, the event handler `events/smarthost-changed/10reload_services` |
96 | | -restarts the main module service. |
| 87 | +Furthermore if smarthost setup is changed when Matomo is already running, the event handler `events/smarthost-changed/10reload_services` restarts the main module service. |
97 | 88 |
|
98 | 89 | See also the `systemd/user/matomo.service` file. |
99 | 90 |
|
100 | | -This setting discovery is just an example to understand how the module is |
101 | | -expected to work: it can be rewritten or discarded completely. |
| 91 | +This setting discovery is just an example to understand how the module is expected to work: it can be rewritten or discarded completely. |
| 92 | + |
| 93 | +## Update |
| 94 | + |
| 95 | +You can forcefully update the module |
| 96 | + |
| 97 | +```bash |
| 98 | +api-cli run update-module --data '{"module_url":"ghcr.io/geniusdynamics/matomo:latest","instances":["matomo1"],"force":true}' |
| 99 | +``` |
102 | 100 |
|
103 | 101 | ## Uninstall |
104 | 102 |
|
105 | 103 | To uninstall the instance: |
106 | 104 |
|
107 | | - remove-module --no-preserve matomo1 |
| 105 | +```bash |
| 106 | +remove-module --no-preserve matomo1 |
| 107 | +``` |
108 | 108 |
|
109 | 109 | ## Testing |
110 | 110 |
|
111 | 111 | Test the module using the `test-module.sh` script: |
112 | 112 |
|
| 113 | +```bash |
| 114 | +./test-module.sh <NODE_ADDR> ghcr.io/geniusdynamics/matomo:latest |
| 115 | +``` |
113 | 116 |
|
114 | | - ./test-module.sh <NODE_ADDR> ghcr.io/compgeniuses/matomo:latest |
| 117 | +The tests are made using [Robot Framework](https://robotframework.org/). |
115 | 118 |
|
116 | | -The tests are made using [Robot Framework](https://robotframework.org/) |
117 | | - |
118 | | -## UI translation |
| 119 | +## UI Translation |
119 | 120 |
|
120 | 121 | Translated with [Weblate](https://hosted.weblate.org/projects/ns8/). |
121 | 122 |
|
122 | 123 | To setup the translation process: |
123 | 124 |
|
124 | | -- add [GitHub Weblate app](https://docs.weblate.org/en/latest/admin/continuous.html#github-setup) to your repository |
125 | | -- add your repository to [hosted.weblate.org]((https://hosted.weblate.org) or ask a compgeniuses developer to add it to ns8 Weblate project |
| 125 | +1. Add [GitHub Weblate app](https://docs.weblate.org/en/latest/admin/continuous.html#github-setup) to your repository |
| 126 | +2. Add your repository to [hosted.weblate.org](https://hosted.weblate.org) or ask a NethServer developer to add it to the NS8 Weblate project |
| 127 | + |
0 commit comments