From bbca9d4fb74e2f921075bb05ad78a05ce13f8647 Mon Sep 17 00:00:00 2001
From: HongzheWang <hongzhe.wang@nexedi.com>
Date: Wed, 25 May 2022 14:42:25 +0200
Subject: [PATCH] software/matomo:simplify matomo

---
 software/matomo/apache-httpd.conf.in   | 24 ------------------------
 software/matomo/buildout.hash.cfg      |  6 +-----
 software/matomo/matomo-instance.cfg.in | 23 -----------------------
 software/matomo/software.cfg           |  7 +------
 4 files changed, 2 insertions(+), 58 deletions(-)
 delete mode 100644 software/matomo/apache-httpd.conf.in

diff --git a/software/matomo/apache-httpd.conf.in b/software/matomo/apache-httpd.conf.in
deleted file mode 100644
index 775ef8b27..000000000
--- a/software/matomo/apache-httpd.conf.in
+++ /dev/null
@@ -1,24 +0,0 @@
-<VirtualHost *:{{ parameter_dict['port'] }}>
-  ServerAdmin admin@example.com
-  DocumentRoot {{ parameter_dict['document-root'] }}/matomo
-
-  SetEnvIf Origin "^http(s)?://(.+\.)?(app\.officejs\.com)$" ORIGIN_DOMAIN=$0
-  Header always set Access-Control-Allow-Origin "%{ORIGIN_DOMAIN}e" env=ORIGIN_DOMAIN
-  Header always set Access-Control-Allow-Credentials "true" env=ORIGIN_DOMAIN
-  Header always set Access-Control-Allow-Methods "PROPFIND, PROPPATCH, COPY, MOVE, DELETE, MKCOL, LOCK, UNLOCK, PUT, GETLIB, VERSION-CONTROL, CHECKIN, CHECKOUT, UNCHECKOUT, REPORT, UPDATE, CANCELUPLOAD, HEAD, OPTIONS, GET, POST" env=ORIGIN_DOMAIN
-  Header always set Access-Control-Allow-Headers "Overwrite, Destination, Content-Type, Depth, User-Agent, X-File-Size, X-Requested-With, If-Modified-Since, X-File-Name, Cache-Control, Authorization" env=ORIGIN_DOMAIN
-  Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains"
-
-  <Directory {{ parameter_dict['document-root'] }}>
-      Options +FollowSymlinks
-      AllowOverride All
-      Require all granted
-      SetEnv HOME {{ parameter_dict['document-root'] }}
-      SetEnv HTTP_HOME {{ parameter_dict['document-root'] }}
-      Dav off
-
-  </Directory>
-  ErrorLog "{{ parameter_dict['log-dir'] }}/matomo-error.log"
-  CustomLog "{{ parameter_dict['log-dir'] }}/matomo-access.log" combined
-
-</VirtualHost>
diff --git a/software/matomo/buildout.hash.cfg b/software/matomo/buildout.hash.cfg
index 0a27af62b..5ed952575 100644
--- a/software/matomo/buildout.hash.cfg
+++ b/software/matomo/buildout.hash.cfg
@@ -13,13 +13,9 @@
 # section inheritance (< = ...) are NOT supported (but you should really
 # not need these here).
 
-[template-apache-httpd]
-filename = apache-httpd.conf.in
-md5sum = 9940e05d5e624a7884f4e6e062355798
-
 [template-matomo-instance]
 filename = matomo-instance.cfg.in
-md5sum = f82fd755c4ca5569836e0638a7502306
+md5sum = 63cca2dab84791adf805922b2b73ab4a
 
 [template-matomo-backup.sh]
 filename = matomo-backup.sh.in
diff --git a/software/matomo/matomo-instance.cfg.in b/software/matomo/matomo-instance.cfg.in
index 7122c9f34..34bc129ad 100644
--- a/software/matomo/matomo-instance.cfg.in
+++ b/software/matomo/matomo-instance.cfg.in
@@ -5,22 +5,6 @@ dir-backup = ${directory:backup}
 find-bin = {{ findutils_location }}
 diff-bin = {{ diffutils_location }}
 
-#php.ini parameters
-php.memory_limit = 512M
-php.date.timezone = Europe/Paris
-php.upload_max_filesize = 10240M
-php.post_max_size = 10240M
-php.session.cookie_secure = True
-php.max_execution_time = 1800
-php.max_input_time = 3600
-php.output_buffering = 'Off'
-php.max_file_uploads = 100
-
-[php-bin]
-recipe = slapos.cookbook:wrapper
-wrapper-path = ${directory:bin}/php
-command-line = ${instance-parameter:php-bin} -c ${php.ini-conf:output}
-
 [matomo-backup-cron]
 recipe = slapos.cookbook:cron.d
 cron-entries = ${cron:cron-entries}
@@ -28,13 +12,6 @@ name = matomo-backup
 frequency = 0 0 * * *
 command = ${matomo-backup.sh:output}
 
-[matomo-apache-httpd]
-recipe = slapos.recipe.template:jinja2
-url = {{ matomo_apache_httpd }}
-output = ${directory:apache.d}/matomo.conf
-context =
-  section parameter_dict apache-php-configuration
-
 [matomo-backup.sh]
 recipe = slapos.recipe.template:jinja2
 url = {{ matomo_backup_sh }}
diff --git a/software/matomo/software.cfg b/software/matomo/software.cfg
index c9b4c8d3a..c25bab4ec 100644
--- a/software/matomo/software.cfg
+++ b/software/matomo/software.cfg
@@ -33,7 +33,7 @@ md5sum = 8d592676bc2c0d51363ad7b2caf171fe
 # Without it the instance-matomo.cfg file will not be executed
 [custom-application-deployment]
 path = ${template-matomo-instance:output}
-part-list = matomo-backup.sh matomo-backup-cron matomo-apache-httpd
+part-list = matomo-backup.sh matomo-backup-cron
 db-name = matomo
 db-user = matomo
 db-password = 12345678
@@ -49,13 +49,8 @@ context =
           key gzip_location gzip:location
           key python3_location python3:location
           key php_location apache-php:location
-          key matomo_apache_httpd template-apache-httpd:target
           key matomo_backup_sh template-matomo-backup.sh:target
 
-# download apache-httpd.conf.in
-[template-apache-httpd]
-<= matomo-download
-
 # download matomo-backup.sh.in
 [template-matomo-backup.sh]
 <= matomo-download
-- 
2.30.9