fork 0k-charms
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.
 
 

77 lines
1.7 KiB

#!/bin/bash
. lib/common
set -e
#domain=$(relation-get domain) || exit 1
domain="matomo"
url=$(relation-get url) || exit 1
# location=$CONFIGSTORE/$BASE_SERVICE_NAME/var/www/$domain
upload_dir="${SERVICE_DATASTORE}/var/www/$domain/uploads"
if [ -d "$upload_dir" ]; then
uid_gid=$(stat --format=%u:%g "$upload_dir")
else
err "Upload dir '${upload_dir}' was not created. Can't continue."
exit 1
fi
dirs=(
/var/cache/matomo
/var/lib/matomo{,/assets}
/var/log/matomo
/var/tmp/matomo{,/tcpdf,/templates_c}
)
to_create=()
for dir in "${dirs[@]}"; do
fdir="${SERVICE_DATASTORE}${dir}"
if ! [ -d "$fdir" ]; then
to_create+=("$fdir")
fi
done
if [ "${#to_create[@]}" -gt 0 ]; then
mkdir -p "${to_create[@]}" &&
chown -v "$uid_gid" "${to_create[@]}" &&
chmod -v g+rwx "${to_create[@]}"
fi
config-add "
services:
$MASTER_TARGET_SERVICE_NAME:
volumes:
- $SERVICE_DATASTORE/var/tmp/matomo:/var/www/$domain/tmp:rw
- $SERVICE_DATASTORE/var/cache/matomo:/var/www/$domain/tmp/cache:rw
- $SERVICE_DATASTORE/var/lib/matomo/assets:/var/www/$domain/tmp/assets:rw
- $SERVICE_DATASTORE/var/log/matomo:/var/www/$domain/tmp/logs:rw
- $SERVICE_DATASTORE/var/tmp/matomo/tcpdf:/var/www/$domain/tmp/tcpdf:rw
- $SERVICE_DATASTORE/var/tmp/matomo/templates_c:/var/www/$domain/tmp/templates_c:rw
"
#
#cat <<EOF >> "${MATOMO_CODE}"/.env
#
#BASE_PROTOCOL=${url%%://*}
#BASE_URL=$domain
#BASE_PATH=/index.php
#
#EOF
#
#
#cat <<EOF > "${MATOMO_CODE}"/web/.htaccess
#
#Options -MultiViews
#RewriteEngine On
#RewriteRule ^js/.* - [L]
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteRule ^(.*)$ index.php/\$1 [QSA,L]
#
#EOF
#