matomo-org/docker

Marketplace Plugins are gone after re-build the image

jkoehne opened this issue ยท 13 comments

After re-build the image all post-installed Plugins from the marketplaces are gone. What is the most convenient way to avoid that (if there is one:-))

Hi there,

Could you maybe ask in the docker project if you use this? https://github.com/matomo-org/docker

The idea is that you need to save your config/config.ini.php file as it contains the list of activated plugins until matomo-org/matomo#6063 is maybe worked on in the future

Sorry I didn't notice it was already created in the right repo

@jkoehne I think it's a persistence issue. Like #89 (see my comment).
Can you post your docker run command or docker-compose.yml please ?

Hi !
I have the same issue every time I pull the latest image version.
The file is shared on host.

version: '3'

networks:
  backend:
    driver: 'bridge'

services:
  db:
    image: mariadb:latest
    restart: always
    volumes:
      - /path/to/mysql:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=<password>
      - MYSQL_USER=<user>
      - MYSQL_PASSWORD=<password>
      - MYSQL_DATABASE=<database>
    networks:
      - 'backend'
  app:
    image: piwik:apache
    restart: always
    links:
      - db
    volumes:
      - /path/to/config:/var/www/html/config:rw
      - /path/to/logs:/var/www/html/logs
    networks:
      - 'backend'

@clement-michelet Plugins path is not persisted in your compose file but again same issue as #89. I will create an issue on the main repository about plugins path issue.

Running into this as well because of the entrypoint.sh overwriting everything ): Is there a proposed way to fix this? I'm trying to run matomo in kubernetes on a custom baked image using a FROM matomo:3.5.1 and adding custom configs/plugins from a zip.

J0WI commented

How about -v /path/to/custom-plugin:/var/www/html/plugin/custom-plugin?

I'm getting a step closer to fooling the image, but this is all feeling hacky. I add the plugins to /usr/src/pwiki which then successfully adds them. However, I then need to activate them with ./console plugin:activate $PLUGIN which adding a CMD step in my Dockerfile breaks it from running in k8s since it detects the container as "completed" obviously. Trying out a few other things to see if I can trick it some more... Ideally we'd like to be able to do this without having to use any volume mounts, since most of the important things are in the database.

Anyone happen to know where data is persisted when running ./console plugin:activate ?

@Joeskyyy both in the DB and the config/config.ini.php file

@Joeskyyy I've proposed to separate core and "user" plugins to handle this (matomo-org/matomo#12988) like Nextcloud does but developers don't want to make this change.
So for the moment i handle this case in my docker image with a watcher using inotify tools.

J0WI commented

Or just keep the whole -v /path/to/data:/var/www/html/ and use matomos update mechanism. The image itself will still handle php/library updates.

Was able to finally get around this in a hacky way for those running in kubernetes...

My Dockerfile looks something like this:

FROM matomo:3.5.1

ADD configs/config.ini.php /usr/src/piwik/config/config.ini.php
ADD configs/intranet_geoip_config.php /usr/src/piwik/config/IntranetGeoIP.data.php
ADD matomo_setup.sh matomo_setup.sh
RUN bash matomo_setup.sh && rm matomo_setup.sh

matomo_setup.sh is just downloading the zips for the plugins to /usr/src/piwik/plugins/.

One weird thing I needed to have run in the script as well is:

mkdir -p /usr/src/piwik/tmp/cache/tracker

Otherwise matomo would fail to start.

Lastly, I added a lifecycle for k8s to my deployment:

        lifecycle:
          postStart:
            exec:
              command: [ "sh", "-c", "sleep 30; /var/www/html/console plugin:activate LoginLdap; /var/www/html/console plugin:activate IntranetGeoIP; chown -R www-data:www-data /var/www/html" ]

Matomo now comes online with my plugins activated. ๐Ÿ‘

Hacky, but works!