Skip to content

Cwivagg/matomo 20220618#3304

Merged
holta merged 33 commits intoiiab:masterfrom
cwivagg:cwivagg/matomo_20220618
Aug 13, 2022
Merged

Cwivagg/matomo 20220618#3304
holta merged 33 commits intoiiab:masterfrom
cwivagg:cwivagg/matomo_20220618

Conversation

@cwivagg
Copy link
Copy Markdown
Contributor

@cwivagg cwivagg commented Jul 12, 2022

Matomo Role

Instructions: https://github.com/cwivagg/iiab/tree/cwivagg/matomo_20220618/roles/matomo#readme [revised from June]

Updates Adam's pull request #3253.

Context links:

  1. AWStats community patterns/analytics/statistics/metrics #1268

  2. IIAB Community Analytics framework, above & beyond AWStats (likely Matomo?) #1762

Testing instructions

curl iiab.io/fast.txt | sudo bash -s 3304
cd /opt/iiab/iiab
sudo ./runrole matomo

Comment thread roles/0-init/tasks/validate_vars.yml Outdated
Comment thread roles/matomo/README.adoc Outdated
cwivagg and others added 2 commits July 12, 2022 09:13
Co-authored-by: A Holt <holta@users.noreply.github.com>
Co-authored-by: A Holt <holta@users.noreply.github.com>
@holta
Copy link
Copy Markdown
Member

holta commented Jul 12, 2022

Git is being difficult!

@cwivagg can you resolve the 1-liner by clicking "Resolve Conflicts" at the bottom of this (#3304) ticket?
(Or I can do it if you prefer!)

@holta
Copy link
Copy Markdown
Member

holta commented Jul 12, 2022

@cwivagg Git is definitely torturing us. Apologies.

One more try to set https://github.com/cwivagg/iiab/blob/cwivagg/matomo_20220618/roles/0-init/tasks/validate_vars.yml#L67 to "46 + 46 + 42" instead of "45 + 45 + 41" ? (Or I can do it if you prefer!)

@holta
Copy link
Copy Markdown
Member

holta commented Jul 19, 2022

@cwivagg the comment should be 44 + 44 + 40 but again it's just a comment, no worries!

Currently it contains a small typo 44 + 44 + 0 here:
https://github.com/cwivagg/iiab/blob/cwivagg/matomo_20220618/roles/0-init/tasks/validate_vars.yml#L67

Let's try to get this PR fully merged before August, if possible, so this frivolous side issue can be put behind us!

Correcting per iiab#3304 (comment) to change: 44 + 44 + 0 to: 44 + 44 + 40
@avni
Copy link
Copy Markdown
Member

avni commented Jul 20, 2022

PR which has this comment fix here: cwivagg#1

@holta
Copy link
Copy Markdown
Member

holta commented Jul 20, 2022

PR which has this comment fix here: cwivagg#1

40 days + 40 nights until IIAB's release around end of August, for the new school year?

(If only Matomo could help IIAB schools graph + learn about the weather ! Possibly Node-RED is a better IIAB app for that? During this complicated year especially...)

"The food security crisis could kill more people than Covid has [in Africa especially] says Senegal minister at G-20"
https://www.cnbc.com/2022/07/19/food-security-crisis-could-kill-more-people-than-covid-amadou-hott.html

Correcting typo in comment on L67
@cwivagg
Copy link
Copy Markdown
Contributor Author

cwivagg commented Jul 28, 2022

I tried to install on a fresh ubuntu 22.04 vm pc.

This was the response:

TASK [matomo : Configure Matomo to track IIAB] ************************************
fatal: [127.0.0.1]: FAILED! => {"cache_control": "no-store, must-revalidate", "changed": false, "connection": "close", "content_security_policy": "default-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src 'self' 'unsafe-inline' 'unsafe-eval' data:;", "content_type": "text/html; charset=utf-8", "cookies": {}, "cookies_string": "", "date": "Tue, 12 Jul 2022 20:08:56 GMT", "elapsed": 0, "msg": "Status code was 200 and not [302]: OK (unknown bytes)", "redirected": false, "referrer_policy": "same-origin", "server": "nginx/1.18.0 (Ubuntu)", "status": 200, "transfer_encoding": "chunked", "url": "http://box.lan/matomo/index.php?action=firstWebsiteSetup&module=Installation", "x_matomo_request_id": "6af5a"}

PLAY RECAP ************************************************************************
127.0.0.1                  : ok=249  changed=129  unreachable=0    failed=1    skipped=70   rescued=0    ignored=3  

Thank you again for testing this feature! As I guessed, it was related to the way that Matomo processes timezones. Apparently the timezones set by Multipass (which defaults to your area, mine was set to EST) do not match Matomo's expectations. I did not encounter this problem during development on VirtualBox because Virtualbox defaults to UTC. I've simply deleted the line of code fetching Ansible's datetime (which is the system time, without intervention), which allows Matomo to fetch the system time itself. I tested this on Multipass and VirtualBox with my own defaults, and, for fun, with Singapore. All of them worked.

In short, I believe the issue is now fixed. Thank you again for bringing it to myattention.

@holta
Copy link
Copy Markdown
Member

holta commented Jul 28, 2022

@cwivagg this doesn't seem to install on our mainline OS (Raspberry Pi OS, e.g. on Raspberry Pi 4 and similar computers).

Can you tell why this is happening below?

TASK [matomo : Configure Matomo to track IIAB] *********************************
fatal: [127.0.0.1]: FAILED! => {"cache_control": "no-store, must-revalidate", "changed": false, "connection": "close", "content_security_policy": "default-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src 'self' 'unsafe-inline' 'unsafe-eval' data:;", "content_type": "text/html; charset=utf-8", "cookies": {}, "cookies_string": "", "date": "Thu, 28 Jul 2022 21:03:51 GMT", "elapsed": 2, "msg": "Status code was 200 and not [302]: OK (unknown bytes)", "redirected": false, "referrer_policy": "same-origin", "server": "nginx/1.18.0", "status": 200, "transfer_encoding": "chunked", "url": "http://box.lan/matomo/index.php?action=firstWebsiteSetup&module=Installation", "x_matomo_request_id": "0d4e9"}

Anything else I should try?

Context: The above error is the result of running cd /opt/iiab/iiab and then sudo ./runrole matomo on an existing IIAB (that was freshly installed 6 days ago).

@cwivagg
Copy link
Copy Markdown
Contributor Author

cwivagg commented Jul 29, 2022

@cwivagg this doesn't seem to install on our mainline OS (Raspberry Pi OS, e.g. on Raspberry Pi 4 and similar computers).

Can you tell why this is happening below?

TASK [matomo : Configure Matomo to track IIAB] *********************************
fatal: [127.0.0.1]: FAILED! => {"cache_control": "no-store, must-revalidate", "changed": false, "connection": "close", "content_security_policy": "default-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src 'self' 'unsafe-inline' 'unsafe-eval' data:;", "content_type": "text/html; charset=utf-8", "cookies": {}, "cookies_string": "", "date": "Thu, 28 Jul 2022 21:03:51 GMT", "elapsed": 2, "msg": "Status code was 200 and not [302]: OK (unknown bytes)", "redirected": false, "referrer_policy": "same-origin", "server": "nginx/1.18.0", "status": 200, "transfer_encoding": "chunked", "url": "http://box.lan/matomo/index.php?action=firstWebsiteSetup&module=Installation", "x_matomo_request_id": "0d4e9"}

Anything else I should try?

Context: The above error is the result of running cd /opt/iiab/iiab and then sudo ./runrole matomo on an existing IIAB (that was freshly installed 6 days ago).

This looks like the same error. If you're sure you picked up the most recent commit, we can try two things:

  1. I can get my own Raspberry Pi and try to reproduce;

  2. I can give you a debugging branch that will write the output we need to a file, which you can then post back here.

  3. might take a bit longer, but I can start looking into it today. For 2) this branch should capture the debug output in the directory from which execution is happening. In principle, the same result could be achieved by using Ansible's debug to print the output to the screen, but then there is a pretty hefty copy/paste job.

@holta
Copy link
Copy Markdown
Member

holta commented Jul 29, 2022

This looks like the same error. If you're sure you picked up the most recent commit,

Yes, fyi:

root@box:/opt/iiab/iiab# git log
commit 4e9635f97e97af549cea4cb0ee9d7b434b20cdd5 (HEAD -> matomo)
Merge: 2efd7c01 cd635851
Author: root <holta@users.noreply.github.com>
Date:   Thu Jul 28 21:01:21 2022 +0000

    Merge branch 'cwivagg/matomo_20220618' of https://github.com/cwivagg/iiab into matomo

commit cd6358514d0cab3e660aa916a7b6f5420888c0ac
Author: A Holt <holta@users.noreply.github.com>
Date:   Thu Jul 28 16:55:16 2022 -0400

    Modernize matomo/tasks/main.yml for skip_role_on_error #3255

commit 2efd7c01982ccecfb1297ae2bc93087172b38c2a (origin/master, origin/HEAD, master)
Merge: 004b8901 9ad5a9ca
Author: A Holt <holta@users.noreply.github.com>
Date:   Thu Jul 28 10:23:35 2022 -0400

    Merge pull request #3323 from holta/can_be_ap-patch

    network/tasks/detected_network.yml: can_be_ap grep failed on absence of regex

commit 9ad5a9caa128cbb5e3748fe6fe8f58f9619ff5b4
Author: A Holt <holta@users.noreply.github.com>
Date:   Thu Jul 28 14:18:49 2022 +0000

    network/tasks/detected_network.yml: can_be_ap grep failed on absence of regex

commit c6ee32d0c08bf7d6595d7c9b707d3f47352bc043
Author: Carl Wivagg <cwivagg@gmail.com>
Date:   Thu Jul 28 06:36:33 2022 -0400

    fix timezone issue

we can try two things:

  1. I can get my own Raspberry Pi and try to reproduce;
  2. I can give you a debugging branch that will write the output we need to a file, which you can then post back here.
  3. might take a bit longer, but I can start looking into it today. For 2) this branch should capture the debug output in the directory from which execution is happening. In principle, the same result could be achieved by using Ansible's debug to print the output to the screen, but then there is a pretty hefty copy/paste job.

I'll give you direct/online access to several Raspberry Pi's. Call me if poss?

PS I'm pretty sure this IIAB restructuring commit ("Modernize matomo/tasks/main.yml for skip_role_on_error #3255") is 100% irrelevant — but possibly pull/merge/cherry-pick this commit into your debug branch: cd63585

@holta
Copy link
Copy Markdown
Member

holta commented Jul 29, 2022

@cwivagg call me if poss? So you can log in and grab the debug info etc.

Yesterday's test had 64-bit Raspberry Pi OS Lite 2022-04-04 set to Etc/UTC (using this PR's branch cwivagg/matomo_20220618) and today's new test used America/New_York with a freshly installed copy of the same OS (below, using test branch cwivagg/matomo_20220618_debug).

On this virgin OS today, I then ran as root:

mkdir /opt/iiab
cd /opt/iiab
apt install git
git clone https://github.com/iiab/iiab
cd /opt/iiab/iiab
git switch -c matomo    # Same as: git checkout -b matomo
git pull https://github.com/cwivagg/iiab.git cwivagg/matomo_20220618_debug
curl iiab.io/fast.txt | bash

Then I typed '0' [zero] for a /etc/iiab/local_vars.yml tailored to unit-testing which I then edited to contain:

matomo_install: True
matomo_enabled: True

Then I ran sudo iiab to try to complete the install.

Today's results are:

TASK [matomo : Configure Matomo to track IIAB] *************************************************************************************************************************
fatal: [127.0.0.1]: FAILED! => {"changed": false, "connection": "close", "content": "", "content_type": "text/html; charset=UTF-8", "date": "Fri, 29 Jul 2022 17:41:18 GMT", "elapsed": 1, "location": "http://box.lan/matomo/index.php?action=trackingCode&module=Installation&site_idSite=1&site_name=IIAB", "msg": "Status code was 302 and not [200]: HTTP Error 302: Found", "redirected": false, "server": "nginx/1.18.0", "status": 302, "transfer_encoding": "chunked", "url": "http://box.lan/matomo/index.php?action=firstWebsiteSetup&module=Installation", "x_matomo_request_id": "2e174", "x_robots_tag": "noindex"}

@holta
Copy link
Copy Markdown
Member

holta commented Aug 3, 2022

FYI Matomo 4.11 is now official!

https://github.com/matomo-org/matomo/releases/tag/4.11.0

@holta
Copy link
Copy Markdown
Member

holta commented Aug 10, 2022

Thank you to @cwivagg who is diligently testing this PR on all 4 of IIAB's mainline OS's!

[1] http://FAQ.IIAB.IO -> "What OS should I use?"
[2] https://github.com/iiab/iiab/wiki/IIAB-Platforms

Let's get this merged soon after 6 months of hard work!

Instructions for getting into Matomo
@holta
Copy link
Copy Markdown
Member

holta commented Aug 13, 2022

Huge Thanks @cwivagg for all your work, and for having tested this PR on 3+ different OS's (Mint 21, Ubuntu 22.04, Raspberry Pi OS Lite on Raspberry Pi 4) !

Let's declare victory — adding any touch-ups later, in subsequent PR's — as grassroots communities begin to learn how to use this and then ask for refinements/assistance en route 💯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants