mirror of
https://gh.llkk.cc/https://github.com/WeblateOrg/scripts.git
synced 2025-10-03 15:01:00 +08:00
Configure Matomo offline logs
Signed-off-by: Michal Čihař <michal@cihar.com>
This commit is contained in:
parent
bada941362
commit
374d678c9b
2 changed files with 25 additions and 1 deletions
|
@ -8,6 +8,8 @@ echo "Sentry DNS:"
|
|||
read sentry
|
||||
echo "Matomo site id:"
|
||||
read matomo
|
||||
echo "Matomo token:"
|
||||
read matomo_token
|
||||
echo "Munin allow:"
|
||||
read munin
|
||||
|
||||
|
@ -17,9 +19,12 @@ cat > /etc/weblate-bootstrap <<EOT
|
|||
WEBLATE_DOMAIN="$domain"
|
||||
WEBLATE_TITLE="$title"
|
||||
WEBLATE_SECRET=$(openssl rand -hex 32)
|
||||
WEBLATE_PIWIK="$matomo"
|
||||
WEBLATE_SENTRY="$sentry"
|
||||
|
||||
# Matomo
|
||||
MATOMO_SITE="$matomo"
|
||||
MATOMO_TOKEN="$matomo_token"
|
||||
|
||||
# Exim
|
||||
EXIM_PASS=$smtp_pass
|
||||
# $(openssl passwd -6 "$smtp_pass")
|
||||
|
|
|
@ -134,3 +134,22 @@ EOT
|
|||
sed -i "0,/server_name $WEBLATE_DOMAIN.*/s//&\\ninclude snippets\/weblate.conf;/" /etc/nginx/sites-available/default
|
||||
# Delete default location, replaced by snippet
|
||||
sed -i ':a;N;$!ba;s/\(snippets\/weblate.conf;\)[^}]*}/\1/g' /etc/nginx/sites-available/default
|
||||
|
||||
# Matomo
|
||||
sudo -u weblate git clone https://github.com/matomo-org/matomo-log-analytics.git /home/weblate/matomo-log-analytics
|
||||
cat > /home/weblate/run-matomo.sh <<EOT
|
||||
#!/bin/sh
|
||||
/usr/bin/python2 \
|
||||
/home/weblate/matomo-log-analytics/import_logs.py \
|
||||
--url=https://stats.cihar.com/ \
|
||||
--idsite=$MATOMO_SITE \
|
||||
--token-auth=$MATOMO_TOKEN \
|
||||
/var/log/nginx/access.log.1
|
||||
EOT
|
||||
chmod +x /home/weblate/run-matomo.sh
|
||||
chown weblate:weblate /home/weblate/run-matomo.sh
|
||||
crontab -u weblate -l > /tmp/weblate-cron
|
||||
echo >> /tmp/weblate-cron
|
||||
echo '0 7 * * * /home/weblate/run-matomo.sh' >> /tmp/weblate-cron
|
||||
crontab -u weblate /tmp/weblate-cron
|
||||
rm /tmp/weblate-cron
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue