docker icon indicating copy to clipboard operation
docker copied to clipboard

Marketplace Plugins are gone after re-build the image

Open jkoehne opened this issue 6 years ago • 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:-))

jkoehne avatar Apr 30 '18 13:04 jkoehne

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 https://github.com/matomo-org/matomo/issues/6063 is maybe worked on in the future

mattab avatar May 02 '18 08:05 mattab

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

mattab avatar May 02 '18 08:05 mattab

@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 ?

crazy-max avatar May 07 '18 12:05 crazy-max

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 avatar May 21 '18 09:05 clement-michelet

@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.

crazy-max avatar May 24 '18 23:05 crazy-max

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.

jinglejengel avatar Jun 13 '18 00:06 jinglejengel

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

J0WI avatar Jun 13 '18 00:06 J0WI

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.

jinglejengel avatar Jun 13 '18 00:06 jinglejengel

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

jinglejengel avatar Jun 13 '18 00:06 jinglejengel

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

mattab avatar Jun 13 '18 09:06 mattab

@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.

crazy-max avatar Jun 13 '18 09:06 crazy-max

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.

J0WI avatar Jun 13 '18 19:06 J0WI

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!

jinglejengel avatar Jun 13 '18 19:06 jinglejengel