OpenMediaVault-Plugin-Developers / openmediavault-compose

openmediavault plugin for docker-compose
14 stars 5 forks source link

schedule update not working as it should #21

Closed sbe-arg closed 10 months ago

sbe-arg commented 10 months ago

when the schedule runs it pulls new images but does not recreate the containers.

this happens then using tags such as :latest if I update image:v1 to image:v2 in the compose file then the update reacts to version differences.

would be amazing to have a flag that forces compose up -d post update regardless of the outcome of version diff check of each service.

ryecoaaron commented 10 months ago

The scheduled update does a docker compose pull followed by a docker compose up -d. So, it is relying on docker compose itself doing the version diff check. I have used this method for years and have not seen the issue you are referring to (unless I am misunderstanding the issue).

sbe-arg commented 10 months ago

Ill post some logs to clarify what I see with the versions check diff not doing up.

ryecoaaron commented 10 months ago

Try the latest update of the plugin that I just pushed to the repo. It would also be helpful to know details about the system and version of docker and docker compose.

sbe-arg commented 10 months ago

Yes ill provide all those details.

But I'm running the latest stable of everything I patch/update weekly.

Thanks for the quick responses.

ryecoaaron commented 10 months ago

I literally pushed the update minutes before i posted. So, you will need to update again.

sbe-arg commented 10 months ago

Amazing updated the plugin ran the schedule manually and is working.

[2023-11-12 15:06:44+1300] [composeupdate] status :: running(5)
[2023-11-12 15:06:44+1300] [composeupdate] version before :: 
[2023-11-12 15:06:44+1300] [composeupdate] version before :: 
[2023-11-12 15:06:44+1300] [composeupdate] version before :: 
[2023-11-12 15:06:44+1300] [composeupdate] version before :: 
[2023-11-12 15:06:44+1300] [composeupdate] version before :: 
[2023-11-12 15:06:44+1300] [composeupdate] Pulling new images ...
 falcosidekick Pulling 
 falco Pulling 
 falcoredis Pulling 
 falcosidekick-ui Pulling 
 dd-agent Pulling 
 falcosidekick Pulled 
 falcoredis Pulled 
 falcosidekick-ui Pulled 
 falco Pulled 
 dd-agent Pulled 
[2023-11-12 15:06:48+1300] [composeupdate] version after :: 
[2023-11-12 15:06:48+1300] [composeupdate] version after :: 
[2023-11-12 15:06:48+1300] [composeupdate] version after :: 
[2023-11-12 15:06:48+1300] [composeupdate] version after :: 
[2023-11-12 15:06:48+1300] [composeupdate] version after :: 
[2023-11-12 15:06:48+1300] [composeupdate] Recreating containers with new images ...
 Container falcoredis  Running
 Container dd-agent  Running
 Container falcosidekick  Recreate
 Container falcosidekick-ui  Running
 Container falco  Running
 Container falcosidekick  Recreated
 Container falcosidekick  Starting
 Container falcosidekick  Started
[2023-11-12 15:07:02+1300] [composeupdate] Done.

this part is confusing but at least is working version before ::???

sbe-arg commented 10 months ago

Would be awesome to be able to also run images prune post recreating

ryecoaaron commented 10 months ago

What does your compose file look like? I could see this happening if you weren't using tags. It is purely for logging though and doesn't have anything to do with the update.

You could just add "docker image prune" as a scheduled task in System -> Scheduled Tasks.

sbe-arg commented 10 months ago

the compose looks like this, left only the images and titles parts

version: '3.9'

name: 'monitoring'

services:

  falco:
    container_name: falco
    hostname: falco
    image: docker.io/falcosecurity/falco:latest

  falcosidekick:
    container_name: falcosidekick
    hostname: falcosidekick
    image: docker.io/falcosecurity/falcosidekick:latest

  falcoredis:
    container_name: falcoredis
    hostname: falcoredis
    image: docker.io/redis/redis-stack:latest

  falcosidekick-ui:
    container_name: falcosidekick-ui
    hostname: falcosidekick-ui
    image: docker.io/falcosecurity/falcosidekick-ui:latest

  dd-agent:
    container_name: dd-agent
    hostname: dd-agent
    image: docker.io/datadog/agent:latest
sbe-arg commented 10 months ago

Happy for this to be closed marked resolved anyway.

ryecoaaron commented 10 months ago

It looks like the version output isn't working because the images you are using have docker.io in the image name but the docker image ls command is dropping the docker.io part. This doesn't happen for non-docker.io, third party repos. So, only docker.io images will not show their versions since the code is failing to find a matching image.

docker image ls --all --format "{{.ID}},{{.Repository}}:{{.Tag}}"

a9af23d10156,lscr.io/linuxserver/beets:latest 67fc56d61ea7,lscr.io/linuxserver/bookstack:latest c20060033e06,nginx:latest 7c0d3fe179cc,lscr.io/linuxserver/mariadb:latest d7d10d76c340,falcosecurity/falco:latest

I can fix it but I'm thinking about removing the version display since it is just showing a checksum anyway.