Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
tiredofit committed Sep 22, 2023
1 parent ef9973f commit 0f77c01
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 85 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ARG PHP_VERSION=8.1
ARG PHP_VERSION=8.2
ARG DISTRO="alpine"

FROM docker.io/tiredofit/nginx-php-fpm:${PHP_VERSION}-${DISTRO}
FROM docker.io/tiredofit/unit-php:${PHP_VERSION}-${DISTRO}
LABEL maintainer="Dave Conroy (github.com/tiredofit)"

ENV CRON_PERIOD=60 \
Expand All @@ -18,7 +18,7 @@ ENV CRON_PERIOD=60 \
PHP_ENABLE_XML=TRUE \
PHP_ENABLE_XMLREADER=TRUE \
PHP_ENABLE_CREATE_SAMPLE_PHP=FALSE \
NGINX_SITE_ENABLED=matomo \
UNIT_SITE_ENABLED=matomo \
IMAGE_NAME="tiredofit/matomo" \
IMAGE_REPO_URL="https://github.com/tiredofit/docker-matomo"

Expand Down
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ Dockerfile to build a [matomo](https://www.matomo.org/) container image. It is a

It will automatically download the latest Piwik release upon build, and if you have set correct environment variables, will autocreate a database if you wish.

This Container uses Alpine:Edge as a base.
Additional Components are PHP7 w/ APC, OpCache, LDAP Support - MySQL Client is also available.


[Changelog](CHANGELOG.md)

Expand Down Expand Up @@ -63,7 +60,7 @@ The following directories are used for configuration and can be mapped for persi
| Directory | Description |
| ------------- | -------------------------- |
| `/www/matomo` | Root matomo Directory |
| `/www/logs` | Nginx and php-fpm logfiles |
| `/var/log/unit` | Nginx Unit logfiles |

### Database

Expand Down
16 changes: 8 additions & 8 deletions install/etc/cont-init.d/30-matomo
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
source /assets/functions/00-container
PROCESS_NAME="matomo"

check_service_initialized init 20-php-fpm
check_service_initialized init 10-unit

sanity_db
db_ready mariadb

if [ ! -f "${NGINX_WEBROOT}"/index.php ]; then
if [ ! -f "${UNIT_WEBROOT}"/index.php ]; then
print_warn "No Matomo Installation Found, Installing..."
mkdir -p "${NGINX_WEBROOT}"
curl https://builds.matomo.org/piwik-latest.tar.gz | tar xfz - --strip 1 -C "${NGINX_WEBROOT}"
curl https://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz | gunzip -c > "${NGINX_WEBROOT}"/misc/GeoIPCity.dat
mkdir -p "${UNIT_WEBROOT}"
curl https://builds.matomo.org/piwik-latest.tar.gz | tar xfz - --strip 1 -C "${UNIT_WEBROOT}"
curl https://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz | gunzip -c > "${UNIT_WEBROOT}"/misc/GeoIPCity.dat
print_info "Install Complete"
fi

echo "*/${CRON_PERIOD} * * * * sudo -u ${NGINX_USER} TZ=${TIMEZONE} php ${NGINX_WEBROOT}/console core:archive >/dev/null 2>&1" > /assets/cron/matomo_archive_reports
echo "alias console='cd ${NGINX_WEBROOT}; sudo -u ${NGINX_USER} php ./console'" >> /root/.bashrc
chown -R "${NGINX_USER}":"${NGINX_GROUP}" "${NGINX_WEBROOT}"
echo "*/${CRON_PERIOD} * * * * sudo -u ${UNIT_USER} TZ=${TIMEZONE} php ${UNIT_WEBROOT}/console core:archive >/dev/null 2>&1" > /assets/cron/matomo_archive_reports
echo "alias console='cd ${UNIT_WEBROOT}; sudo -u ${UNIT_USER} php ./console'" >> /root/.bashrc
chown -R "${UNIT_USER}":"${UNIT_GROUP}" "${UNIT_WEBROOT}"

liftoff
70 changes: 0 additions & 70 deletions install/etc/nginx/sites.available/matomo.conf

This file was deleted.

15 changes: 15 additions & 0 deletions install/etc/unit/sites.available/matomo-application.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"{{UNIT_SITE_ENABLED}}": {
"type": "php",
"targets": {
"direct": {
"root": "{{UNIT_WEBROOT}}/"
},

"index": {
"root": "{{UNIT_WEBROOT}}/",
"script": "index.php"
}
}
}
}
5 changes: 5 additions & 0 deletions install/etc/unit/sites.available/matomo-listener.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"{{UNIT_LISTEN_IP}}:{{UNIT_LISTEN_PORT}}": {
"pass": "routes"
}
}
62 changes: 62 additions & 0 deletions install/etc/unit/sites.available/matomo-route.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
[
{
"match": {
"uri": [
"/index.php",
"/js/index.php",
"/matomo.php",
"/misc/cron/archive.php",
"/piwik.php",
"/plugins/HeatmapSessionRecording/configs.php"
]
},

"action": {
"pass": "applications/{{UNIT_SITE_ENABLED}}/direct"
}
},
{
"match": {
"uri": [
"*.php",
"*/.htaccess",
"/config/*",
"/core/*",
"/lang/*",
"/tmp/*"
]
},

"action": {
"return": 404
}
},
{
"match": {
"uri": "~\\.(css|gif|html?|ico|jpg|js(on)?|png|svg|ttf|woff2?)$"
},

"action": {
"share": "{{UNIT_WEBROOT}}$uri"
}
},
{
"match": {
"uri": [
"!/libs/*",
"!/node_modules/*",
"!/plugins/*",
"!/vendor/*",
"!/misc/cron/*",
"!/misc/user/*"
]
},

"action": {
"share": "{{UNIT_WEBROOT}}$uri",
"fallback": {
"pass": "applications/{{UNIT_SITE_ENABLED}}/index"
}
}
}
]

0 comments on commit 0f77c01

Please sign in to comment.