Skip to content

Commit

Permalink
chore: drop matomo integration
Browse files Browse the repository at this point in the history
  • Loading branch information
nijel committed Jun 28, 2024
1 parent 7bd60a0 commit a33b5d1
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 42 deletions.
12 changes: 0 additions & 12 deletions bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,6 @@ else
echo "Sentry Token:"
read -r sentry_token
fi
echo "Matomo site id:"
read -r matomo
if [ -f ~/.config/weblate-bootstrap/matomo_token ] ; then
matomo_token=$(cat ~/.config/weblate-bootstrap/matomo_token)
else
echo "Matomo token:"
read -r matomo_token
fi

smtp_pass=$(openssl rand -hex 32)

Expand All @@ -41,10 +33,6 @@ WEBLATE_SENTRY="$sentry"
WEBLATE_SENTRY_TOKEN="$sentry_token"
WEBLATE_VERSION="$2"
# Matomo
MATOMO_SITE="$matomo"
MATOMO_TOKEN="$matomo_token"
# Exim
EXIM_PASS=$smtp_pass
# $(openssl passwd -6 "$smtp_pass")
Expand Down
30 changes: 0 additions & 30 deletions install-weblate
Original file line number Diff line number Diff line change
Expand Up @@ -199,45 +199,15 @@ cat > /etc/nginx/snippets/weblate.conf <<EOT
root $WEBLATE_HOME/weblate-env/lib/python$PYVER/site-packages/wllegal/templates;
internal;
}
access_log /var/log/nginx/matomo.log matomo;
access_log /var/log/nginx/access.log;
EOT
cat > /etc/nginx/conf.d/matomo.conf <<EOT
log_format matomo '{"ip": "\$remote_addr",'
'"host": "\$host",'
'"path": "\$request_uri",'
'"status": "\$status",'
'"referrer": "\$http_referer",'
'"user_agent": "\$http_user_agent",'
'"length": \$bytes_sent,'
'"generation_time_milli": \$request_time,'
'"date": "\$time_iso8601"}';
EOT
# Insert include after first server_name stanza
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
systemctl enable nginx.service
systemctl restart nginx.service

# Matomo
sudo -u weblate git clone https://github.com/matomo-org/matomo-log-analytics.git $WEBLATE_HOME/matomo-log-analytics
cat > $WEBLATE_HOME/run-matomo.sh <<EOT
#!/bin/sh
/usr/bin/python3 \
$WEBLATE_HOME/matomo-log-analytics/import_logs.py \
--url=https://stats.cihar.com \
--enable-http-errors \
--idsite=$MATOMO_SITE \
--token-auth=$MATOMO_TOKEN \
/var/log/nginx/matomo.log.1
EOT
chmod +x $WEBLATE_HOME/run-matomo.sh
chown weblate:weblate $WEBLATE_HOME/run-matomo.sh
echo "0 7 * * * $WEBLATE_HOME/run-matomo.sh | logger -t matomo" > /tmp/weblate-cron
crontab /tmp/weblate-cron
rm /tmp/weblate-cron

# Licensee
apt install -y ruby-licensee

Expand Down

0 comments on commit a33b5d1

Please sign in to comment.