libresh/compose-matomo

Updating piwik

Closed this issue · 5 comments

Hi,

I set up this piwik docker version when 2.16.1 was current. Now 2.16.2 is current and I was wondering why my setup is still running 2.16.1. I'm running docker-compose pull && docker-compose up -d regularly on my setups via a cron job. So the update should have happened.

So I inspected my piwik_app container and it actually shows the ENV variable "PIWIK_VERSION=2.16.2". But the webinterface is still nagging me to update.
The code that is in /var/www/html actually is the old one.

In /usr/src/piwik I find the current version. So my guess is that the https://github.com/piwik/docker-piwik/blob/master/docker-entrypoint.sh code is not executed. Actually there is this line that checks if there is already a piwik.php in /var/www/html.

So I'm guessing the problem is: The volume (which is defined by the Dockerfile) would be recreated when the container is re-setup on update. But as the web container is also using it it is not destroyed and so is already populated when the update happens. /var/www/html is defined in the Dockerfile as volume. Volumes are persisted, so it's still there after the update and the new piwik code is not copied over the old code.

So my question boils down to: is updating piwik actually working for anyone and something in my setup is broken or is this a general problem of the image? And if it is working for you, how do you run your update?

You probably need to docker-compose rm -f. Be careful though on how you store the data.

Related to that: matomo-org/docker#34

Yes, the referenced ticket is exactly my issue.

The docker-compose rm -f solution is working. But it's not really suitable for a cronjob. Or I need to check if the image was really updated before running this.

Is there any reason why checking if the installed version matches the container version in the docker-entrypoint.sh is not done? Aside from the implementation work?

When I'm messing with this kind of issue here is my clean way to restart compose. I'll be happy to hear your thoughts on best practices.

        echo && echo "PikWi says: docker-compose stop" && \
    docker-compose stop && \
        echo "PikWi says: docker-compose rm ..." && \
    docker-compose rm -f --all && \    
        echo "PikWi says: docker-compose pull" && \
    docker-compose pull && \
        echo "PikWi says: docker-compose build ..." && \
    docker-compose build --no-cache && \
        echo "PikWi says: docker-compose up ..." && \
    docker-compose up -d --force-recreate --remove-orphans

@pascalandy I'd do it this way:

        echo "PikWi says: docker-compose pull" && \
    docker-compose pull && \
        echo "PikWi says: docker-compose build ..." && \
    docker-compose build --no-cache && \
        echo && echo "PikWi says: docker-compose stop" && \
    docker-compose stop && \
        echo "PikWi says: docker-compose rm ..." && \
    docker-compose rm -f --all && \    
        echo "PikWi says: docker-compose up ..." && \
    docker-compose up -d --force-recreate --remove-orphans

This would make it with less downtime :)

@heinemml I'm assuming you solved your issue :) Feel free to reopen if not!

Thanks this looks good :)