You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
1.6 KiB

  1. #!/bin/bash
  2. . lib/common
  3. set -e
  4. domain=$(relation-get domain) || exit 1
  5. url=$(relation-get url) || exit 1
  6. # location=$CONFIGSTORE/$BASE_SERVICE_NAME/var/www/$domain
  7. upload_dir="${SERVICE_DATASTORE}/var/www/$domain/uploads"
  8. if [ -d "$upload_dir" ]; then
  9. uid_gid=$(stat --format=%u:%g "$upload_dir")
  10. else
  11. err "Upload dir '${upload_dir}' was not created. Can't continue."
  12. exit 1
  13. fi
  14. dirs=(
  15. /var/cache/matomo
  16. /var/lib/matomo{,/assets}
  17. /var/log/matomo
  18. /var/tmp/matomo{,/tcpdf,/templates_c}
  19. )
  20. to_create=()
  21. for dir in "${dirs[@]}"; do
  22. fdir="${SERVICE_DATASTORE}${dir}"
  23. if ! [ -d "$fdir" ]; then
  24. to_create+=("$fdir")
  25. fi
  26. done
  27. if [ "${#to_create[@]}" -gt 0 ]; then
  28. mkdir -p "${to_create[@]}" &&
  29. chown -v "$uid_gid" "${to_create[@]}" &&
  30. chmod -v g+rwx "${to_create[@]}"
  31. fi
  32. config-add "
  33. services:
  34. $MASTER_TARGET_SERVICE_NAME:
  35. volumes:
  36. - $SERVICE_DATASTORE/var/tmp/matomo:/var/www/$domain/tmp:rw
  37. - $SERVICE_DATASTORE/var/cache/matomo:/var/www/$domain/tmp/cache:rw
  38. - $SERVICE_DATASTORE/var/lib/matomo/assets:/var/www/$domain/tmp/assets:rw
  39. - $SERVICE_DATASTORE/var/log/matomo:/var/www/$domain/tmp/logs:rw
  40. - $SERVICE_DATASTORE/var/tmp/matomo/tcpdf:/var/www/$domain/tmp/tcpdf:rw
  41. - $SERVICE_DATASTORE/var/tmp/matomo/templates_c:/var/www/$domain/tmp/templates_c:rw
  42. "
  43. #
  44. #cat <<EOF >> "${MATOMO_CODE}"/.env
  45. #
  46. #BASE_PROTOCOL=${url%%://*}
  47. #BASE_URL=$domain
  48. #BASE_PATH=/index.php
  49. #
  50. #EOF
  51. #
  52. #
  53. #cat <<EOF > "${MATOMO_CODE}"/web/.htaccess
  54. #
  55. #Options -MultiViews
  56. #RewriteEngine On
  57. #RewriteRule ^js/.* - [L]
  58. #RewriteCond %{REQUEST_FILENAME} !-f
  59. #RewriteRule ^(.*)$ index.php/\$1 [QSA,L]
  60. #
  61. #EOF
  62. #